public SingleResponse( Asn1Sequence seq) { this.certID = CertID.GetInstance(seq[0]); this.certStatus = CertStatus.GetInstance(seq[1]); this.thisUpdate = (DerGeneralizedTime)seq[2]; if (seq.Count > 4) { this.nextUpdate = DerGeneralizedTime.GetInstance( (Asn1TaggedObject) seq[3], true); this.singleExtensions = X509Extensions.GetInstance( (Asn1TaggedObject) seq[4], true); } else if (seq.Count > 3) { Asn1TaggedObject o = (Asn1TaggedObject) seq[3]; if (o.TagNo == 0) { this.nextUpdate = DerGeneralizedTime.GetInstance(o, true); } else { this.singleExtensions = X509Extensions.GetInstance(o, true); } } }
private AttributeCertificateInfo( Asn1Sequence seq) { if (seq.Count < 7 || seq.Count > 9) { throw new ArgumentException("Bad sequence size: " + seq.Count); } this.version = DerInteger.GetInstance(seq[0]); this.holder = Holder.GetInstance(seq[1]); this.issuer = AttCertIssuer.GetInstance(seq[2]); this.signature = AlgorithmIdentifier.GetInstance(seq[3]); this.serialNumber = DerInteger.GetInstance(seq[4]); this.attrCertValidityPeriod = AttCertValidityPeriod.GetInstance(seq[5]); this.attributes = Asn1Sequence.GetInstance(seq[6]); for (int i = 7; i < seq.Count; i++) { Asn1Encodable obj = (Asn1Encodable) seq[i]; if (obj is DerBitString) { this.issuerUniqueID = DerBitString.GetInstance(seq[i]); } else if (obj is Asn1Sequence || obj is X509Extensions) { this.extensions = X509Extensions.GetInstance(seq[i]); } } }
private ResponseObject( CertificateID certId, CertificateStatus certStatus, DerGeneralizedTime thisUpdate, DerGeneralizedTime nextUpdate, X509Extensions extensions) { this.certId = certId; if (certStatus == null) { this.certStatus = new CertStatus(); } else if (certStatus is UnknownStatus) { this.certStatus = new CertStatus(2, DerNull.Instance); } else { RevokedStatus rs = (RevokedStatus) certStatus; CrlReason revocationReason = rs.HasRevocationReason ? new CrlReason(rs.RevocationReason) : null; this.certStatus = new CertStatus( new RevokedInfo(new DerGeneralizedTime(rs.RevocationTime), revocationReason)); } this.thisUpdate = thisUpdate; this.nextUpdate = nextUpdate; this.extensions = extensions; }
public RequestObject( CertificateID certId, X509Extensions extensions) { this.certId = certId; this.extensions = extensions; }
public ResponseObject( CertificateID certId, CertificateStatus certStatus, DateTime thisUpdate, X509Extensions extensions) : this(certId, certStatus, new DerGeneralizedTime(thisUpdate), null, extensions) { }
public ResponseData( ResponderID responderID, DerGeneralizedTime producedAt, Asn1Sequence responses, X509Extensions responseExtensions) : this(V1, responderID, producedAt, responses, responseExtensions) { }
private RevDetails(Asn1Sequence seq) { certDetails = CertTemplate.GetInstance(seq[0]); if (seq.Count > 1) { crlEntryDetails = X509Extensions.GetInstance(seq[1]); } }
public Request( CertID reqCert, X509Extensions singleRequestExtensions) { if (reqCert == null) throw new ArgumentNullException("reqCert"); this.reqCert = reqCert; this.singleRequestExtensions = singleRequestExtensions; }
public TbsRequest( GeneralName requestorName, Asn1Sequence requestList, X509Extensions requestExtensions) { this.version = V1; this.requestorName = requestorName; this.requestList = requestList; this.requestExtensions = requestExtensions; }
private Request( Asn1Sequence seq) { reqCert = CertID.GetInstance(seq[0]); if (seq.Count == 2) { singleRequestExtensions = X509Extensions.GetInstance( (Asn1TaggedObject)seq[1], true); } }
private RevAnnContent(Asn1Sequence seq) { status = PkiStatusEncodable.GetInstance(seq[0]); certId = CertId.GetInstance(seq[1]); willBeRevokedAt = DerGeneralizedTime.GetInstance(seq[2]); badSinceDate = DerGeneralizedTime.GetInstance(seq[3]); if (seq.Count > 4) { crlDetails = X509Extensions.GetInstance(seq[4]); } }
public SingleResponse( CertID certID, CertStatus certStatus, DerGeneralizedTime thisUpdate, DerGeneralizedTime nextUpdate, X509Extensions singleExtensions) { this.certID = certID; this.certStatus = certStatus; this.thisUpdate = thisUpdate; this.nextUpdate = nextUpdate; this.singleExtensions = singleExtensions; }
public ResponseData( DerInteger version, ResponderID responderID, DerGeneralizedTime producedAt, Asn1Sequence responses, X509Extensions responseExtensions) { this.version = version; this.responderID = responderID; this.producedAt = producedAt; this.responses = responses; this.responseExtensions = responseExtensions; }
public TimeStampReq( MessageImprint messageImprint, DerObjectIdentifier tsaPolicy, DerInteger nonce, DerBoolean certReq, X509Extensions extensions) { // default this.version = new DerInteger(1); this.messageImprint = messageImprint; this.tsaPolicy = tsaPolicy; this.nonce = nonce; this.certReq = certReq; this.extensions = extensions; }
private CertTemplate(Asn1Sequence seq) { this.seq = seq; foreach (Asn1TaggedObject tObj in seq) { switch (tObj.TagNo) { case 0: version = DerInteger.GetInstance(tObj, false); break; case 1: serialNumber = DerInteger.GetInstance(tObj, false); break; case 2: signingAlg = AlgorithmIdentifier.GetInstance(tObj, false); break; case 3: issuer = X509Name.GetInstance(tObj, true); // CHOICE break; case 4: validity = OptionalValidity.GetInstance(Asn1Sequence.GetInstance(tObj, false)); break; case 5: subject = X509Name.GetInstance(tObj, true); // CHOICE break; case 6: publicKey = SubjectPublicKeyInfo.GetInstance(tObj, false); break; case 7: issuerUID = DerBitString.GetInstance(tObj, false); break; case 8: subjectUID = DerBitString.GetInstance(tObj, false); break; case 9: extensions = X509Extensions.GetInstance(tObj, false); break; default: throw new ArgumentException("unknown tag: " + tObj.TagNo, "seq"); } } }
private TimeStampReq( Asn1Sequence seq) { int nbObjects = seq.Count; int seqStart = 0; // version version = DerInteger.GetInstance(seq[seqStart++]); // messageImprint messageImprint = MessageImprint.GetInstance(seq[seqStart++]); for (int opt = seqStart; opt < nbObjects; opt++) { // tsaPolicy if (seq[opt] is DerObjectIdentifier) { tsaPolicy = DerObjectIdentifier.GetInstance(seq[opt]); } // nonce else if (seq[opt] is DerInteger) { nonce = DerInteger.GetInstance(seq[opt]); } // certReq else if (seq[opt] is DerBoolean) { certReq = DerBoolean.GetInstance(seq[opt]); } // extensions else if (seq[opt] is Asn1TaggedObject) { Asn1TaggedObject tagged = (Asn1TaggedObject) seq[opt]; if (tagged.TagNo == 0) { extensions = X509Extensions.GetInstance(tagged, false); } } } }
public void SetRequestExtensions( X509Extensions requestExtensions) { this.requestExtensions = requestExtensions; }
public TstInfo( DerObjectIdentifier tsaPolicyId, MessageImprint messageImprint, DerInteger serialNumber, DerGeneralizedTime genTime, Accuracy accuracy, DerBoolean ordering, DerInteger nonce, GeneralName tsa, X509Extensions extensions) { this.version = new DerInteger(1); this.tsaPolicyId = tsaPolicyId; this.messageImprint = messageImprint; this.serialNumber = serialNumber; this.genTime = genTime; this.accuracy = accuracy; this.ordering = ordering; this.nonce = nonce; this.tsa = tsa; this.extensions = extensions; }
/** * Set the extensions for the response. * * @param responseExtensions the extension object to carry. */ public void SetResponseExtensions( X509Extensions responseExtensions) { this.responseExtensions = responseExtensions; }
/** * Add a request with extensions * * @param certId certificate ID of interest * @param singleRequestExtensions the extensions to attach to the request */ public void AddRequest( CertificateID certId, X509Extensions singleRequestExtensions) { list.Add(new RequestObject(certId, singleRequestExtensions)); }
/** * Add a CRL entry with extensions. **/ public void AddCrlEntry( BigInteger userCertificate, DateTime revocationDate, X509Extensions extensions) { tbsGen.AddCrlEntry(new DerInteger(userCertificate), new Time(revocationDate), extensions); }
public TimeStampRequest Generate( string digestAlgorithmOid, byte[] digest, BigInteger nonce) { if (digestAlgorithmOid == null) { throw new ArgumentException("No digest algorithm specified"); } DerObjectIdentifier digestAlgOid = new DerObjectIdentifier(digestAlgorithmOid); AlgorithmIdentifier algID = new AlgorithmIdentifier(digestAlgOid, DerNull.Instance); MessageImprint messageImprint = new MessageImprint(algID, digest); X509Extensions ext = null; if (extOrdering.Count != 0) { ext = new X509Extensions(extOrdering, extensions); } DerInteger derNonce = nonce == null ? null : new DerInteger(nonce); return new TimeStampRequest( new TimeStampReq(messageImprint, reqPolicy, derNonce, certReq, ext)); }
public RevDetails(CertTemplate certDetails, X509Extensions crlEntryDetails) { this.crlEntryDetails = crlEntryDetails; }
public void SetExtensions( X509Extensions extensions) { this.extensions = extensions; }
public virtual CertTemplateBuilder SetExtensions(X509Extensions extens) { extensions = extens; return this; }
public void AddCrlEntry(DerInteger userCertificate, Time revocationDate, X509Extensions extensions) { Asn1EncodableVector v = new Asn1EncodableVector( userCertificate, revocationDate); if (extensions != null) { v.Add(extensions); } AddCrlEntry(new DerSequence(v)); }
private TstInfo( Asn1Sequence seq) { IEnumerator e = seq.GetEnumerator(); // version e.MoveNext(); version = DerInteger.GetInstance(e.Current); // tsaPolicy e.MoveNext(); tsaPolicyId = DerObjectIdentifier.GetInstance(e.Current); // messageImprint e.MoveNext(); messageImprint = MessageImprint.GetInstance(e.Current); // serialNumber e.MoveNext(); serialNumber = DerInteger.GetInstance(e.Current); // genTime e.MoveNext(); genTime = DerGeneralizedTime.GetInstance(e.Current); // default for ordering ordering = DerBoolean.False; while (e.MoveNext()) { Asn1Object o = (Asn1Object) e.Current; if (o is Asn1TaggedObject) { DerTaggedObject tagged = (DerTaggedObject) o; switch (tagged.TagNo) { case 0: tsa = GeneralName.GetInstance(tagged, true); break; case 1: extensions = X509Extensions.GetInstance(tagged, false); break; default: throw new ArgumentException("Unknown tag value " + tagged.TagNo); } } if (o is DerSequence) { accuracy = Accuracy.GetInstance(o); } if (o is DerBoolean) { ordering = DerBoolean.GetInstance(o); } if (o is DerInteger) { nonce = DerInteger.GetInstance(o); } } }
public void SetExtensions( X509Extensions extensions) { this.extensions = extensions; if (extensions != null) { X509Extension altName = extensions.GetExtension(X509Extensions.SubjectAlternativeName); if (altName != null && altName.IsCritical) { altNamePresentAndCritical = true; } } }
private TbsRequest( Asn1Sequence seq) { int index = 0; Asn1Encodable enc = seq[0]; if (enc is Asn1TaggedObject) { Asn1TaggedObject o = (Asn1TaggedObject) enc; if (o.TagNo == 0) { versionSet = true; version = DerInteger.GetInstance(o, true); index++; } else { version = V1; } } else { version = V1; } if (seq[index] is Asn1TaggedObject) { requestorName = GeneralName.GetInstance((Asn1TaggedObject) seq[index++], true); } requestList = (Asn1Sequence) seq[index++]; if (seq.Count == (index + 1)) { requestExtensions = X509Extensions.GetInstance((Asn1TaggedObject) seq[index], true); } }
internal TbsCertificateList( Asn1Sequence seq) { if (seq.Count < 3 || seq.Count > 7) { throw new ArgumentException("Bad sequence size: " + seq.Count); } int seqPos = 0; this.seq = seq; if (seq[seqPos] is DerInteger) { version = DerInteger.GetInstance(seq[seqPos++]); } else { version = new DerInteger(0); } signature = AlgorithmIdentifier.GetInstance(seq[seqPos++]); issuer = X509Name.GetInstance(seq[seqPos++]); thisUpdate = Time.GetInstance(seq[seqPos++]); if (seqPos < seq.Count && (seq[seqPos] is DerUtcTime || seq[seqPos] is DerGeneralizedTime || seq[seqPos] is Time)) { nextUpdate = Time.GetInstance(seq[seqPos++]); } if (seqPos < seq.Count && !(seq[seqPos] is DerTaggedObject)) { revokedCertificates = Asn1Sequence.GetInstance(seq[seqPos++]); } if (seqPos < seq.Count && seq[seqPos] is DerTaggedObject) { crlExtensions = X509Extensions.GetInstance(seq[seqPos]); } }
public void SetExtensions( X509Extensions extensions) { this.extensions = extensions; }