public override AsymmetricCipher Generate(int cipherSize)
        {
            if (!base.CipherSize.Check(cipherSize))
            {
                throw new ArgumentException();
            }
            AsymmetricCipher result;

            using (DSACryptoServiceProvider dsaCryptoServiceProvider = new DSACryptoServiceProvider(cipherSize))
            {
                // 导出随机生成的公钥对
                result = new AsymmetricCipher(dsaCryptoServiceProvider.ExportCspBlob(true), dsaCryptoServiceProvider.ExportCspBlob(false));
            }
            return(result);
        }
 public AsymmetricCipherContainer(AsymmetricCipher cipher, DateTime generateTime)
 {
     this.Info   = new CipherInfo(generateTime);
     this.Cipher = cipher;
 }
 public AsymmetricCipherContainer()
 {
     this.Info   = new CipherInfo();
     this.Cipher = new AsymmetricCipher();
 }
 public AsymmetricCipherContainer(AsymmetricCipher cipher)
 {
     this.Info   = new CipherInfo();
     this.Cipher = cipher;
 }
示例#5
0
 public bool Equals(AsymmetricCipher other)
 {
     return(this.PrivateKey == other.PrivateKey && this.PublicKey == other.PublicKey);
 }