X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;ds=sidebyside;f=dsakey%2Fdsakey.go;fp=dsakey%2Fdsakey.go;h=23ab5fec0f3430beb8d6fad347cb83c8936f2fad;hb=293e53e15524518b254091a155c5d04f4305816d;hp=f5fa9b56036163ede6e93f3525b018caec47cc22;hpb=ba050281925d304417cc0d4a80340b9dab9b6da8;p=epoint diff --git a/dsakey/dsakey.go b/dsakey/dsakey.go index f5fa9b5..23ab5fe 100644 --- a/dsakey/dsakey.go +++ b/dsakey/dsakey.go @@ -1,12 +1,12 @@ package dsakey import ( - "crypto/sha1" + "crypto" "crypto/dsa" "crypto/openpgp" "crypto/openpgp/packet" "crypto/rand" - "crypto" + "crypto/sha1" "fmt" "io" "math/big" @@ -18,9 +18,9 @@ const G = "502FF28CC4D7BC1100123C9227994341C29773BFBD8D7E8FFED6D87A9D82FE573744A func PrivKey(r []byte) *dsa.PrivateKey { priv := new(dsa.PrivateKey) - priv.Parameters.P,_ = new(big.Int).SetString(P, 16) - priv.Parameters.Q,_ = new(big.Int).SetString(Q, 16) - priv.Parameters.G,_ = new(big.Int).SetString(G, 16) + priv.Parameters.P, _ = new(big.Int).SetString(P, 16) + priv.Parameters.Q, _ = new(big.Int).SetString(Q, 16) + priv.Parameters.G, _ = new(big.Int).SetString(G, 16) // q > 2^159 prime // x = sha1(r) @@ -84,23 +84,23 @@ func NewEntity(priv *dsa.PrivateKey, currentTimeSecs int64, name, comment, email IssuerKeyId: &e.PrimaryKey.KeyId, }, } -/* - e.Subkeys = make([]Subkey, 1) - e.Subkeys[0] = Subkey{ - PublicKey: packet.NewRSAPublicKey(t, &encryptingPriv.PublicKey, true), - PrivateKey: packet.NewRSAPrivateKey(t, encryptingPriv, true), - Sig: &packet.Signature{ - CreationTime: t, - SigType: packet.SigTypeSubkeyBinding, - PubKeyAlgo: packet.PubKeyAlgoRSA, - Hash: crypto.SHA256, - FlagsValid: true, - FlagEncryptStorage: true, - FlagEncryptCommunications: true, - IssuerKeyId: &e.PrimaryKey.KeyId, - }, - } -*/ + /* + e.Subkeys = make([]Subkey, 1) + e.Subkeys[0] = Subkey{ + PublicKey: packet.NewRSAPublicKey(t, &encryptingPriv.PublicKey, true), + PrivateKey: packet.NewRSAPrivateKey(t, encryptingPriv, true), + Sig: &packet.Signature{ + CreationTime: t, + SigType: packet.SigTypeSubkeyBinding, + PubKeyAlgo: packet.PubKeyAlgoRSA, + Hash: crypto.SHA256, + FlagsValid: true, + FlagEncryptStorage: true, + FlagEncryptCommunications: true, + IssuerKeyId: &e.PrimaryKey.KeyId, + }, + } + */ return } @@ -110,7 +110,7 @@ func NewIssuerEntity(r []byte, denomination string) (e *openpgp.Entity, err erro } // simple key generation for obligation holder clients func NewHolderEntity(r []byte, issuer, denomination string) (e *openpgp.Entity, err error) { - return NewEntity(PrivKey(r), 0, "Holder of " + issuer, denomination, "") + return NewEntity(PrivKey(r), 0, "Holder of "+issuer, denomination, "") } // check the issuer and denomination associated with the given pgp key