Ejemplo n.º 1
0
 /// <exception cref="System.Exception"></exception>
 public virtual void SetPrvKey(byte[] x, byte[] p, byte[] q, byte[] g)
 {
     DSAPrivateKeySpec dsaPrivKeySpec = new DSAPrivateKeySpec(new BigInteger(x), new BigInteger
         (p), new BigInteger(q), new BigInteger(g));
     PrivateKey prvKey = keyFactory.GeneratePrivate(dsaPrivKeySpec);
     signature.InitSign(prvKey);
 }
Ejemplo n.º 2
0
        public override PrivateKey GeneratePrivate(KeySpec key)
        {
            DSAPrivateKeySpec spec = (DSAPrivateKeySpec)key;
            DSAParameters     dsp  = new DSAParameters();

            dsp.G = spec.GetG().GetBytes();
            dsp.P = spec.GetP().GetBytes();
            dsp.Q = spec.GetQ().GetBytes();
            dsp.X = spec.GetX().GetBytes();
            return(new DSAPrivateKey(dsp));
        }