public static AsnToBeSignedCertificate FromRequest(AsnCertificationRequest request) { AsnToBeSignedCertificate tbsCert = new AsnToBeSignedCertificate { subject = request.requestInfo.subject, subjectPKInfo = request.requestInfo.subjectPKInfo }; // TODO: fill in the rest return(tbsCert); }
public static AsnCertificationRequest Decode(byte[] source, ref int pos) { AsnCertificationRequest instance = new AsnCertificationRequest(); //CheckContextTag(source, ref pos); pos++; long length = instance.GetLength(source, ref pos); instance.elements.Add(AsnCertificationRequestInfo.Decode(source, ref pos)); instance.elements.Add(AsnAlgorithmIdentifier.Decode(source, ref pos)); instance.elements.Add(AsnBitstring.Decode(source, ref pos)); return(instance); }
// RFC 2986 public AsnCertificationRequest Sign(AsnPrivateKeyPair key) { AsnCertificationRequest request = new AsnCertificationRequest(this); Encode(); RSA rsa = RSA.Create(); rsa.ImportParameters(key.parameters); // TODO: fix this request.signatureAlgorithm.algorithmID.value = new Oid("1.2.840.113549.1.1.11"); // sha256withRSA request.signature = new AsnBitstring(rsa.SignData(derValue, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1)); return(request); }