Пример #1
0
 public static RSACryptoServiceProvider ParseX509PrivateKey(string pem)
 {
     ASN1 root = new ASN1 (StripPEM (pem));
     ASN1 matl = new ASN1 (root [2].Value);
     RSAParameters rsa = default (RSAParameters);
     rsa.Modulus = matl [1].Value;
     rsa.Exponent = matl [2].Value;
     rsa.D = matl [3].Value;
     rsa.P = matl [4].Value;
     rsa.Q = matl [5].Value;
     rsa.DP = matl [6].Value;
     rsa.DQ = matl [7].Value;
     rsa.InverseQ = matl [8].Value;
     RSACryptoServiceProvider cp = new RSACryptoServiceProvider ();
     cp.ImportParameters (rsa);
     return cp;
 }
Пример #2
0
 public ASN1 Add(ASN1 asn1)
 {
     if (asn1 != null) {
         if (elist == null)
             elist = new ArrayList ();
         elist.Add (asn1);
     }
     return asn1;
 }
Пример #3
0
 public static RSACryptoServiceProvider ParseX509PublicKey(string pem)
 {
     ASN1 root = new ASN1 (StripPEM (pem));
     ASN1 proot = new ASN1 (RemoveSlopByte (root [1].Value));
     RSAParameters rsa = default(RSAParameters);
     rsa.Modulus = proot [0].Value;
     rsa.Exponent = proot [1].Value;
     RSACryptoServiceProvider cp = new RSACryptoServiceProvider ();
     cp.ImportParameters (rsa);
     return cp;
 }