コード例 #1
0
        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);
        }
コード例 #2
0
 public AsymmetricCipherContainer(AsymmetricCipher cipher, DateTime generateTime)
 {
     this.Info   = new CipherInfo(generateTime);
     this.Cipher = cipher;
 }
コード例 #3
0
 public AsymmetricCipherContainer()
 {
     this.Info   = new CipherInfo();
     this.Cipher = new AsymmetricCipher();
 }
コード例 #4
0
 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);
 }