private ProtectedPkiMessage FinalizeMessage(PkiHeader header, DerBitString protection) { if (extraCerts.Count > 0) { CmpCertificate[] cmpCertificates = new CmpCertificate[extraCerts.Count]; for (int i = 0; i < cmpCertificates.Length; i++) { byte[] cert = ((X509Certificate)extraCerts[i]).GetEncoded(); cmpCertificates[i] = CmpCertificate.GetInstance((Asn1Sequence.FromByteArray(cert))); } return(new ProtectedPkiMessage(new PkiMessage(header, body, protection, cmpCertificates))); } return(new ProtectedPkiMessage(new PkiMessage(header, body, protection))); }
private CAKeyUpdAnnContent(Asn1Sequence seq) { oldWithNew = CmpCertificate.GetInstance(seq[0]); newWithOld = CmpCertificate.GetInstance(seq[1]); newWithNew = CmpCertificate.GetInstance(seq[2]); }
private static Asn1Encodable GetBodyForType(int type, Asn1Encodable o) { switch (type) { case 0: return(CertReqMessages.GetInstance(o)); case 1: return(CertRepMessage.GetInstance(o)); case 2: return(CertReqMessages.GetInstance(o)); case 3: return(CertRepMessage.GetInstance(o)); case 4: return(CertificationRequest.GetInstance(o)); case 5: return(PopoDecKeyChallContent.GetInstance(o)); case 6: return(PopoDecKeyRespContent.GetInstance(o)); case 7: return(CertReqMessages.GetInstance(o)); case 8: return(CertRepMessage.GetInstance(o)); case 9: return(CertReqMessages.GetInstance(o)); case 10: return(KeyRecRepContent.GetInstance(o)); case 11: return(RevReqContent.GetInstance(o)); case 12: return(RevRepContent.GetInstance(o)); case 13: return(CertReqMessages.GetInstance(o)); case 14: return(CertRepMessage.GetInstance(o)); case 15: return(CAKeyUpdAnnContent.GetInstance(o)); case 16: return(CmpCertificate.GetInstance(o)); case 17: return(RevAnnContent.GetInstance(o)); case 18: return(CrlAnnContent.GetInstance(o)); case 19: return(PkiConfirmContent.GetInstance(o)); case 20: return(PkiMessages.GetInstance(o)); case 21: return(GenMsgContent.GetInstance(o)); case 22: return(GenRepContent.GetInstance(o)); case 23: return(ErrorMsgContent.GetInstance(o)); case 24: return(CertConfirmContent.GetInstance(o)); case 25: return(PollReqContent.GetInstance(o)); case 26: return(PollRepContent.GetInstance(o)); default: throw new ArgumentException("unknown tag number: " + type, "type"); } }