示例#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);
 }
示例#2
0
文件: KeyFactory.cs 项目: shoff/ngit
        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));
        }