public PkiMessage(PkiHeader header, PkiBody body, DerBitString protection, CmpCertificate[] extraCerts) { this.header = header; this.body = body; this.protection = protection; if (extraCerts != null) { this.extraCerts = new DerSequence(extraCerts); } }
private PkiMessage(Asn1Sequence seq) { header = PkiHeader.GetInstance(seq[0]); body = PkiBody.GetInstance(seq[1]); for (int i = 2; i < seq.Count; i++) { Asn1TaggedObject asn1TaggedObject = (Asn1TaggedObject)seq[i].ToAsn1Object(); if (asn1TaggedObject.TagNo == 0) { protection = DerBitString.GetInstance(asn1TaggedObject, isExplicit: true); } else { extraCerts = Asn1Sequence.GetInstance(asn1TaggedObject, explicitly: true); } } }
private byte[] CalculateSignature(IStreamCalculator signer, PkiHeader header, PkiBody body) { Asn1EncodableVector avec = new Asn1EncodableVector(); avec.Add(header); avec.Add(body); byte[] encoded = new DerSequence(avec).GetEncoded(); signer.Stream.Write(encoded, 0, encoded.Length); Object result = signer.GetResult(); if (result is DefaultSignatureResult) { return(((DefaultSignatureResult)result).Collect()); } else if (result is IBlockResult) { return(((IBlockResult)result).Collect()); } else if (result is byte[]) { return((byte[])result); } throw new InvalidOperationException("result is not byte[] or DefaultSignatureResult"); }
public ProtectedPart(PkiHeader header, PkiBody body) { this.header = header; this.body = body; }
private ProtectedPart(Asn1Sequence seq) { header = PkiHeader.GetInstance(seq[0]); body = PkiBody.GetInstance(seq[1]); }