private ASN1Object GetName(X509Name name) { Func<KeyValuePair<string, ASN1Object>, ASN1Sequence> attrToRdn = attr => new ASN1Sequence(new[] { new ASN1ObjectIdentifier(attr.Key), attr.Value }); var rdns = name.Values.GroupBy(x => x.Key) .Select(attrs => new ASN1Set(attrs.Select(attrToRdn))) .Cast<ASN1Object>().ToList(); return new ASN1Sequence(rdns); }
public X509Certificate(byte version, BigInteger serialNumber, X509Validity validity, X509Name issuer, X509Name subject, X509AlgorithmIdentifier subjectPublicKeyAlgorithm, PublicKey subjectPublicKey, X509AlgorithmIdentifier signatureAlgorithm, BitArray signature, IEnumerable<X509Extension> extensions) { Version = version; SerialNumber = serialNumber; Validity = validity; SignatureAlgorithm = signatureAlgorithm; Signature = signature; Issuer = issuer; Subject = subject; SubjectPublicKeyAlgorithm = subjectPublicKeyAlgorithm; SubjectPublicKey = subjectPublicKey; Extensions = extensions.ToList(); }