예제 #1
0
 private void WriteChildren(ASN1Object value)
 {
     foreach (var elem in value.Elements)
     {
         Write(elem);
     }
 }
예제 #2
0
        public RSAPrivateKey(ASN1Object asn1Key)
        {
            // NOTE: currently only supporting PKCS#1 without optional OtherPrimeInfos

            var keySeq = asn1Key as ASN1Sequence;
            SecurityAssert.NotNull(keySeq);
            SecurityAssert.SAssert(keySeq.Count == 9);

            Modulus = GetInteger(keySeq, 1);
            PublicExponent = GetInteger(keySeq, 2);
            PrivateExponent = GetInteger(keySeq, 3);
            Prime1 = GetInteger(keySeq, 4);
            Prime2 = GetInteger(keySeq, 5);
            Exponent1 = GetInteger(keySeq, 6);
            Exponent2 = GetInteger(keySeq, 7);
            Coefficent = GetInteger(keySeq, 8);

            SecurityAssert.SAssert(Modulus == Prime1 * Prime2);
            SecurityAssert.SAssert(Exponent1 == (PrivateExponent % (Prime1 - 1)));
            SecurityAssert.SAssert(Exponent2 == (PrivateExponent % (Prime2 - 1)));
            // TODO assert Coefficent == ((inverse of q) mod p)
        }
예제 #3
0
 public void Write(ASN1Object obj)
 {
     obj.Accept(this);
 }
예제 #4
0
 public void Write(ASN1Object obj)
 {
     obj.Accept(this);
 }
예제 #5
0
 private void WriteChildren(ASN1Object value)
 {
     foreach (var elem in value.Elements)
     {
         Write(elem);
     }
 }
예제 #6
0
 public X509Extension(string id, bool critical, ASN1Object value)
 {
     this.Id = id;
     this.Critical = critical;
     this.Value = value;
 }