update genkey (+minor cleanups)
[epoint] / dsakey / dsakey.go
index f5fa9b5..23ab5fe 100644 (file)
@@ -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