private void WriteChildren(ASN1Object value) { foreach (var elem in value.Elements) { Write(elem); } }
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) }
public void Write(ASN1Object obj) { obj.Accept(this); }
public void Write(ASN1Object obj) { obj.Accept(this); }
private void WriteChildren(ASN1Object value) { foreach (var elem in value.Elements) { Write(elem); } }
public X509Extension(string id, bool critical, ASN1Object value) { this.Id = id; this.Critical = critical; this.Value = value; }