public AttributeCertificateInfo GenerateAttributeCertificateInfo() { if ((serialNumber == null) || (signature == null) || (issuer == null) || (startDate == null) || (endDate == null) || (holder == null) || (attributes == null)) { throw new InvalidOperationException("not all mandatory fields set in V2 AttributeCertificateInfo generator"); } Asn1EncodableVector v = new Asn1EncodableVector( version, holder, issuer, signature, serialNumber); // // before and after dates => AttCertValidityPeriod // v.Add(new AttCertValidityPeriod(startDate, endDate)); // Attributes v.Add(new DerSequence(attributes)); if (issuerUniqueID != null) { v.Add(issuerUniqueID); } if (extensions != null) { v.Add(extensions); } return AttributeCertificateInfo.GetInstance(new DerSequence(v)); }
/** * Constructor for elliptic curves over binary fields * <code>F<sub>2<sup>m</sup></sub></code>. * @param m The exponent <code>m</code> of * <code>F<sub>2<sup>m</sup></sub></code>. * @param k1 The integer <code>k1</code> where <code>x<sup>m</sup> + * x<sup>k3</sup> + x<sup>k2</sup> + x<sup>k1</sup> + 1</code> * represents the reduction polynomial <code>f(z)</code>. * @param k2 The integer <code>k2</code> where <code>x<sup>m</sup> + * x<sup>k3</sup> + x<sup>k2</sup> + x<sup>k1</sup> + 1</code> * represents the reduction polynomial <code>f(z)</code>. * @param k3 The integer <code>k3</code> where <code>x<sup>m</sup> + * x<sup>k3</sup> + x<sup>k2</sup> + x<sup>k1</sup> + 1</code> * represents the reduction polynomial <code>f(z)</code>.. */ public X9FieldID( int m, int k1, int k2, int k3) { this.id = X9ObjectIdentifiers.CharacteristicTwoField; Asn1EncodableVector fieldIdParams = new Asn1EncodableVector(new DerInteger(m)); if (k2 == 0) { fieldIdParams.Add( X9ObjectIdentifiers.TPBasis, new DerInteger(k1)); } else { fieldIdParams.Add( X9ObjectIdentifiers.PPBasis, new DerSequence( new DerInteger(k1), new DerInteger(k2), new DerInteger(k3))); } this.parameters = new DerSequence(fieldIdParams); }
/** * <pre> * Challenge ::= SEQUENCE { * owf AlgorithmIdentifier OPTIONAL, * * -- MUST be present in the first Challenge; MAY be omitted in * -- any subsequent Challenge in POPODecKeyChallContent (if * -- omitted, then the owf used in the immediately preceding * -- Challenge is to be used). * * witness OCTET STRING, * -- the result of applying the one-way function (owf) to a * -- randomly-generated INTEGER, A. [Note that a different * -- INTEGER MUST be used for each Challenge.] * challenge OCTET STRING * -- the encryption (under the public key for which the cert. * -- request is being made) of Rand, where Rand is specified as * -- Rand ::= SEQUENCE { * -- int INTEGER, * -- - the randomly-generated INTEGER A (above) * -- sender GeneralName * -- - the sender's name (as included in PKIHeader) * -- } * } * </pre> * @return a basic ASN.1 object representation. */ public override Asn1Object ToAsn1Object() { Asn1EncodableVector v = new Asn1EncodableVector(); v.AddOptional(owf); v.Add(witness); v.Add(challenge); return new DerSequence(v); }
/** * Produce an object suitable for an Asn1OutputStream. * <pre> * OtherInfo ::= Sequence { * keyInfo KeySpecificInfo, * partyAInfo [0] OCTET STRING OPTIONAL, * suppPubInfo [2] OCTET STRING * } * </pre> */ public override Asn1Object ToAsn1Object() { Asn1EncodableVector v = new Asn1EncodableVector(keyInfo); if (partyAInfo != null) { v.Add(new DerTaggedObject(0, partyAInfo)); } v.Add(new DerTaggedObject(2, suppPubInfo)); return new DerSequence(v); }
public override Asn1Object ToAsn1Object() { Asn1EncodableVector v = new Asn1EncodableVector(); if (version != null) { v.Add(version); } v.Add(iv); return new DerSequence(v); }
/** * <pre> * ScvpReqRes ::= SEQUENCE { * request [0] EXPLICIT ContentInfo OPTIONAL, * response ContentInfo } * </pre> * @return the ASN.1 primitive representation. */ public override Asn1Object ToAsn1Object() { Asn1EncodableVector v = new Asn1EncodableVector(); if (request != null) { v.Add(new DerTaggedObject(true, 0, request)); } v.Add(response); return new DerSequence(v); }
private void AddOptional(Asn1EncodableVector v, int tagNo, Asn1Encodable obj) { if (obj != null) { v.Add(new DerTaggedObject(true, tagNo, obj)); } }
private static Asn1EncodableVector ConvertVector(IList numbers) { Asn1EncodableVector av = new Asn1EncodableVector(); foreach (object o in numbers) { DerInteger di; if (o is BigInteger) { di = new DerInteger((BigInteger)o); } else if (o is int) { di = new DerInteger((int)o); } else { throw new ArgumentException(); } av.Add(di); } return av; }
/** * <pre> * OptionalValidity ::= SEQUENCE { * notBefore [0] Time OPTIONAL, * notAfter [1] Time OPTIONAL } --at least one MUST be present * </pre> * @return a basic ASN.1 object representation. */ public override Asn1Object ToAsn1Object() { Asn1EncodableVector v = new Asn1EncodableVector(); if (notBefore != null) { v.Add(new DerTaggedObject(true, 0, notBefore)); } if (notAfter != null) { v.Add(new DerTaggedObject(true, 1, notAfter)); } return new DerSequence(v); }
/** * Constructor for elliptic curves over binary fields * <code>F<sub>2<sup>m</sup></sub></code>. * @param m The exponent <code>m</code> of * <code>F<sub>2<sup>m</sup></sub></code>. * @param k1 The integer <code>k1</code> where <code>x<sup>m</sup> + * x<sup>k3</sup> + x<sup>k2</sup> + x<sup>k1</sup> + 1</code> * represents the reduction polynomial <code>f(z)</code>. * @param k2 The integer <code>k2</code> where <code>x<sup>m</sup> + * x<sup>k3</sup> + x<sup>k2</sup> + x<sup>k1</sup> + 1</code> * represents the reduction polynomial <code>f(z)</code>. * @param k3 The integer <code>k3</code> where <code>x<sup>m</sup> + * x<sup>k3</sup> + x<sup>k2</sup> + x<sup>k1</sup> + 1</code> * represents the reduction polynomial <code>f(z)</code>.. */ public X9FieldID( int m, int k1, int k2, int k3) { this.id = X9ObjectIdentifiers.CharacteristicTwoField; Asn1EncodableVector fieldIdParams = new Asn1EncodableVector(new DerInteger(m)); if(k2 == 0) { if(k3 != 0) throw new ArgumentException("inconsistent k values"); fieldIdParams.Add( X9ObjectIdentifiers.TPBasis, new DerInteger(k1)); } else { if(k2 <= k1 || k3 <= k2) throw new ArgumentException("inconsistent k values"); fieldIdParams.Add( X9ObjectIdentifiers.PPBasis, new DerSequence( new DerInteger(k1), new DerInteger(k2), new DerInteger(k3))); } this.parameters = new DerSequence(fieldIdParams); }
/** * <pre> * OobCertHash ::= SEQUENCE { * hashAlg [0] AlgorithmIdentifier OPTIONAL, * certId [1] CertId OPTIONAL, * hashVal BIT STRING * -- hashVal is calculated over the Der encoding of the * -- self-signed certificate with the identifier certID. * } * </pre> * @return a basic ASN.1 object representation. */ public override Asn1Object ToAsn1Object() { Asn1EncodableVector v = new Asn1EncodableVector(); AddOptional(v, 0, hashAlg); AddOptional(v, 1, certId); v.Add(hashVal); return new DerSequence(v); }
public virtual RevRepContent Build() { Asn1EncodableVector v = new Asn1EncodableVector(); v.Add(new DerSequence(status)); if (revCerts.Count != 0) { v.Add(new DerTaggedObject(true, 0, new DerSequence(revCerts))); } if (crls.Count != 0) { v.Add(new DerTaggedObject(true, 1, new DerSequence(crls))); } return RevRepContent.GetInstance(new DerSequence(v)); }
public TbsCertificateStructure GenerateTbsCertificate() { if ((serialNumber == null) || (signature == null) || (issuer == null) || (startDate == null) || (endDate == null) || (subject == null && !altNamePresentAndCritical) || (subjectPublicKeyInfo == null)) { throw new InvalidOperationException("not all mandatory fields set in V3 TBScertificate generator"); } DerSequence validity = new DerSequence(startDate, endDate); // before and after dates Asn1EncodableVector v = new Asn1EncodableVector( version, serialNumber, signature, issuer, validity); if (subject != null) { v.Add(subject); } else { v.Add(DerSequence.Empty); } v.Add(subjectPublicKeyInfo); if (issuerUniqueID != null) { v.Add(new DerTaggedObject(false, 1, issuerUniqueID)); } if (subjectUniqueID != null) { v.Add(new DerTaggedObject(false, 2, subjectUniqueID)); } if (extensions != null) { v.Add(new DerTaggedObject(3, extensions)); } return new TbsCertificateStructure(new DerSequence(v)); }
/** * Produce an object suitable for an Asn1OutputStream. * <pre> * OcspResponse ::= Sequence { * responseStatus OcspResponseStatus, * responseBytes [0] EXPLICIT ResponseBytes OPTIONAL } * </pre> */ public override Asn1Object ToAsn1Object() { Asn1EncodableVector v = new Asn1EncodableVector(responseStatus); if (responseBytes != null) { v.Add(new DerTaggedObject(true, 0, responseBytes)); } return new DerSequence(v); }
/** * <pre> * EssCertID ::= SEQUENCE { * certHash Hash, * issuerSerial IssuerSerial OPTIONAL } * </pre> */ public override Asn1Object ToAsn1Object() { Asn1EncodableVector v = new Asn1EncodableVector(certHash); if (issuerSerial != null) { v.Add(issuerSerial); } return new DerSequence(v); }
/** * Produce an object suitable for an Asn1OutputStream. * <pre> * OcspRequest ::= Sequence { * tbsRequest TBSRequest, * optionalSignature [0] EXPLICIT Signature OPTIONAL } * </pre> */ public override Asn1Object ToAsn1Object() { Asn1EncodableVector v = new Asn1EncodableVector(tbsRequest); if (optionalSignature != null) { v.Add(new DerTaggedObject(true, 0, optionalSignature)); } return new DerSequence(v); }
/** * Produce an object suitable for an Asn1OutputStream. * <pre> * ContentInfo ::= Sequence { * contentType ContentType, * content * [0] EXPLICIT ANY DEFINED BY contentType OPTIONAL } * </pre> */ public override Asn1Object ToAsn1Object() { Asn1EncodableVector v = new Asn1EncodableVector(contentType); if (content != null) { v.Add(new BerTaggedObject(0, content)); } return new BerSequence(v); }
/* * PolicyInformation ::= Sequence { * policyIdentifier CertPolicyId, * policyQualifiers Sequence SIZE (1..MAX) OF * PolicyQualifierInfo OPTIONAL } */ public override Asn1Object ToAsn1Object() { Asn1EncodableVector v = new Asn1EncodableVector(policyIdentifier); if (policyQualifiers != null) { v.Add(policyQualifiers); } return new DerSequence(v); }
/** * <pre> * TimeStampResp ::= SEQUENCE { * status PkiStatusInfo, * timeStampToken TimeStampToken OPTIONAL } * </pre> */ public override Asn1Object ToAsn1Object() { Asn1EncodableVector v = new Asn1EncodableVector(pkiStatusInfo); if (timeStampToken != null) { v.Add(timeStampToken); } return new DerSequence(v); }
public override Asn1Object ToAsn1Object() { Asn1EncodableVector seq = new Asn1EncodableVector(qcStatementId); if (qcStatementInfo != null) { seq.Add(qcStatementInfo); } return new DerSequence(seq); }
public override Asn1Object ToAsn1Object() { Asn1EncodableVector v = new Asn1EncodableVector(crlHash.ToAsn1Object()); if (crlIdentifier != null) { v.Add(crlIdentifier.ToAsn1Object()); } return new DerSequence(v); }
public override Asn1Object ToAsn1Object() { Asn1EncodableVector v = new Asn1EncodableVector( octStr, iterationCount); if (keyLength != null) { v.Add(keyLength); } return new DerSequence(v); }
/** * Produce an object suitable for an Asn1OutputStream. * <pre> * CrlID ::= Sequence { * crlUrl [0] EXPLICIT IA5String OPTIONAL, * crlNum [1] EXPLICIT Integer OPTIONAL, * crlTime [2] EXPLICIT GeneralizedTime OPTIONAL } * </pre> */ public override Asn1Object ToAsn1Object() { Asn1EncodableVector v = new Asn1EncodableVector(); if (crlUrl != null) { v.Add(new DerTaggedObject(true, 0, crlUrl)); } if (crlNum != null) { v.Add(new DerTaggedObject(true, 1, crlNum)); } if (crlTime != null) { v.Add(new DerTaggedObject(true, 2, crlTime)); } return new DerSequence(v); }
/** * <pre> * ContentHints ::= SEQUENCE { * contentDescription UTF8String (SIZE (1..MAX)) OPTIONAL, * contentType ContentType } * </pre> */ public override Asn1Object ToAsn1Object() { Asn1EncodableVector v = new Asn1EncodableVector(); if (contentDescription != null) { v.Add(contentDescription); } v.Add(contentType); return new DerSequence(v); }
public ExtendedKeyUsage(IEnumerable usages) { var v = new Asn1EncodableVector(); foreach (Asn1Object o in usages) { v.Add(o); _usageTable.Add(o, o); } _seq = new DerSequence(v); }
public ExtendedKeyUsage( ArrayList usages) { Asn1EncodableVector v = new Asn1EncodableVector(); foreach (Asn1Object o in usages) { v.Add(o); this.usageTable.Add(o, o); } this.seq = new DerSequence(v); }
/** * * <pre> * SignerAttribute ::= SEQUENCE OF CHOICE { * claimedAttributes [0] ClaimedAttributes, * certifiedAttributes [1] CertifiedAttributes } * * ClaimedAttributes ::= SEQUENCE OF Attribute * CertifiedAttributes ::= AttributeCertificate -- as defined in RFC 3281: see clause 4.1. * </pre> */ public override Asn1Object ToAsn1Object() { Asn1EncodableVector v = new Asn1EncodableVector(); if (claimedAttributes != null) { v.Add(new DerTaggedObject(0, claimedAttributes)); } else { v.Add(new DerTaggedObject(1, certifiedAttributes)); } return new DerSequence(v); }
public override Asn1Object ToAsn1Object() { Asn1EncodableVector asn1EncodableVector = new Asn1EncodableVector(new Asn1Encodable[] { this.policyIdentifier }); if (this.policyQualifiers != null) { asn1EncodableVector.Add(new Asn1Encodable[] { this.policyQualifiers }); } return(new DerSequence(asn1EncodableVector)); }
public override Asn1Object ToAsn1Object() { Asn1EncodableVector asn1EncodableVector = new Asn1EncodableVector(new Asn1Encodable[] { this.commitmentTypeIdentifier }); if (this.qualifier != null) { asn1EncodableVector.Add(new Asn1Encodable[] { this.qualifier }); } return(new DerSequence(asn1EncodableVector)); }
public override Asn1Object ToAsn1Object() { Asn1EncodableVector asn1EncodableVector = new Asn1EncodableVector(new Asn1Encodable[] { this.crlHash.ToAsn1Object() }); if (this.crlIdentifier != null) { asn1EncodableVector.Add(new Asn1Encodable[] { this.crlIdentifier.ToAsn1Object() }); } return(new DerSequence(asn1EncodableVector)); }
public override Asn1Object ToAsn1Object() { Asn1EncodableVector asn1EncodableVector = new Asn1EncodableVector(new Asn1Encodable[] { this.certs }); if (this.policies != null) { asn1EncodableVector.Add(new Asn1Encodable[] { this.policies }); } return(new DerSequence(asn1EncodableVector)); }
public override Asn1Object ToAsn1Object() { Asn1EncodableVector asn1EncodableVector = new Asn1EncodableVector(new Asn1Encodable[] { this.tbsRequest }); if (this.optionalSignature != null) { asn1EncodableVector.Add(new Asn1Encodable[] { new DerTaggedObject(true, 0, this.optionalSignature) }); } return(new DerSequence(asn1EncodableVector)); }
public override Asn1Object ToAsn1Object() { Asn1EncodableVector asn1EncodableVector = new Asn1EncodableVector(new Asn1Encodable[] { this.issuer }); if (this.locator != null) { asn1EncodableVector.Add(new Asn1Encodable[] { this.locator }); } return(new DerSequence(asn1EncodableVector)); }
public override Asn1Object ToAsn1Object() { Asn1EncodableVector asn1EncodableVector = new Asn1EncodableVector(new Asn1Encodable[] { this.version }); if (this.originatorInfo != null) { asn1EncodableVector.Add(new Asn1Encodable[] { new DerTaggedObject(false, 0, this.originatorInfo) }); } asn1EncodableVector.Add(new Asn1Encodable[] { this.recipientInfos, this.macAlgorithm }); if (this.digestAlgorithm != null) { asn1EncodableVector.Add(new Asn1Encodable[] { new DerTaggedObject(false, 1, this.digestAlgorithm) }); } asn1EncodableVector.Add(new Asn1Encodable[] { this.encapsulatedContentInfo }); if (this.authAttrs != null) { asn1EncodableVector.Add(new Asn1Encodable[] { new DerTaggedObject(false, 2, this.authAttrs) }); } asn1EncodableVector.Add(new Asn1Encodable[] { this.mac }); if (this.unauthAttrs != null) { asn1EncodableVector.Add(new Asn1Encodable[] { new DerTaggedObject(false, 3, this.unauthAttrs) }); } return(new BerSequence(asn1EncodableVector)); }
public override Asn1Object ToAsn1Object() { Asn1EncodableVector asn1EncodableVector = new Asn1EncodableVector(new Asn1Encodable[] { this.reqCert }); if (this.singleRequestExtensions != null) { asn1EncodableVector.Add(new Asn1Encodable[] { new DerTaggedObject(true, 0, this.singleRequestExtensions) }); } return(new DerSequence(asn1EncodableVector)); }
public override Asn1Object ToAsn1Object() { Asn1EncodableVector asn1EncodableVector = new Asn1EncodableVector(new Asn1Encodable[] { this.pkiStatusInfo }); if (this.timeStampToken != null) { asn1EncodableVector.Add(new Asn1Encodable[] { this.timeStampToken }); } return(new DerSequence(asn1EncodableVector)); }
public override Asn1Object ToAsn1Object() { Asn1EncodableVector asn1EncodableVector = new Asn1EncodableVector(new Asn1Encodable[] { this.otherCertHash.ToAsn1Object() }); if (this.issuerSerial != null) { asn1EncodableVector.Add(new Asn1Encodable[] { this.issuerSerial.ToAsn1Object() }); } return(new DerSequence(asn1EncodableVector)); }
public override Asn1Object ToAsn1Object() { Asn1EncodableVector asn1EncodableVector = new Asn1EncodableVector(new Asn1Encodable[] { this.infoType }); if (this.infoValue != null) { asn1EncodableVector.Add(new Asn1Encodable[] { this.infoValue }); } return(new DerSequence(asn1EncodableVector)); }
public override Asn1Object ToAsn1Object() { Asn1EncodableVector asn1EncodableVector = new Asn1EncodableVector(new Asn1Encodable[] { this.responseStatus }); if (this.responseBytes != null) { asn1EncodableVector.Add(new Asn1Encodable[] { new DerTaggedObject(true, 0, this.responseBytes) }); } return(new DerSequence(asn1EncodableVector)); }
/* * NameConstraints ::= SEQUENCE { permittedSubtrees [0] GeneralSubtrees * OPTIONAL, excludedSubtrees [1] GeneralSubtrees OPTIONAL } */ public override Asn1Object ToAsn1Object() { Asn1EncodableVector v = new Asn1EncodableVector(); if (permitted != null) { v.Add(new DerTaggedObject(false, 0, permitted)); } if (excluded != null) { v.Add(new DerTaggedObject(false, 1, excluded)); } return new DerSequence(v); }
public override Asn1Object ToAsn1Object() { Asn1EncodableVector asn1EncodableVector = new Asn1EncodableVector(new Asn1Encodable[] { this.qcStatementId }); if (this.qcStatementInfo != null) { asn1EncodableVector.Add(new Asn1Encodable[] { this.qcStatementInfo }); } return(new DerSequence(asn1EncodableVector)); }
public override Asn1Object ToAsn1Object() { Asn1EncodableVector asn1EncodableVector = new Asn1EncodableVector(new Asn1Encodable[] { this.contentType }); if (this.content != null) { asn1EncodableVector.Add(new Asn1Encodable[] { new BerTaggedObject(0, this.content) }); } return(new BerSequence(asn1EncodableVector)); }
public override Asn1Object ToAsn1Object() { Asn1EncodableVector asn1EncodableVector = new Asn1EncodableVector(new Asn1Encodable[] { this.revocationTime }); if (this.revocationReason != null) { asn1EncodableVector.Add(new Asn1Encodable[] { new DerTaggedObject(true, 0, this.revocationReason) }); } return(new DerSequence(asn1EncodableVector)); }
public override Asn1Object ToAsn1Object() { Asn1EncodableVector asn1EncodableVector = new Asn1EncodableVector(new Asn1Encodable[] { this.capabilityID }); if (this.parameters != null) { asn1EncodableVector.Add(new Asn1Encodable[] { this.parameters }); } return(new DerSequence(asn1EncodableVector)); }
/** * Produce an object suitable for an Asn1OutputStream. * <pre> * ECParameters ::= Sequence { * version Integer { ecpVer1(1) } (ecpVer1), * fieldID FieldID {{FieldTypes}}, * curve X9Curve, * base X9ECPoint, * order Integer, * cofactor Integer OPTIONAL * } * </pre> */ public override Asn1Object ToAsn1Object() { Asn1EncodableVector v = new Asn1EncodableVector( new DerInteger(1), fieldID, new X9Curve(curve, seed), new X9ECPoint(g), new DerInteger(n)); if (!h.Equals(BigInteger.One)) { v.Add(new DerInteger(h)); } return(new DerSequence(v)); }
/** * <pre> * * TstInfo ::= SEQUENCE { * version INTEGER { v1(1) }, * policy TSAPolicyId, * messageImprint MessageImprint, * -- MUST have the same value as the similar field in * -- TimeStampReq * serialNumber INTEGER, * -- Time-Stamping users MUST be ready to accommodate integers * -- up to 160 bits. * genTime GeneralizedTime, * accuracy Accuracy OPTIONAL, * ordering BOOLEAN DEFAULT FALSE, * nonce INTEGER OPTIONAL, * -- MUST be present if the similar field was present * -- in TimeStampReq. In that case it MUST have the same value. * tsa [0] GeneralName OPTIONAL, * extensions [1] IMPLICIT Extensions OPTIONAL } * * </pre> */ public override Asn1Object ToAsn1Object() { Asn1EncodableVector v = new Asn1EncodableVector(version, tsaPolicyId, messageImprint, serialNumber, genTime); v.AddOptional(accuracy); if (ordering != null && ordering.IsTrue) { v.Add(ordering); } v.AddOptional(nonce); v.AddOptionalTagged(true, 0, tsa); v.AddOptionalTagged(false, 1, extensions); return(new DerSequence(v)); }
private static Asn1Sequence MakeGeneralInfoSeq( InfoTypeAndValue[] generalInfos) { Asn1Sequence genInfoSeq = null; if (generalInfos != null) { Asn1EncodableVector v = new Asn1EncodableVector(); for (int i = 0; i < generalInfos.Length; ++i) { v.Add(generalInfos[i]); } genInfoSeq = new DerSequence(v); } return(genInfoSeq); }
/** * Produce an object suitable for an Asn1OutputStream. * <pre> * ECParameters ::= Sequence { * version Integer { ecpVer1(1) } (ecpVer1), * fieldID FieldID {{FieldTypes}}, * curve X9Curve, * base X9ECPoint, * order Integer, * cofactor Integer OPTIONAL * } * </pre> */ public override Asn1Object ToAsn1Object() { Asn1EncodableVector v = new Asn1EncodableVector( new DerInteger(BigInteger.One), fieldID, new X9Curve(curve, seed), g, new DerInteger(n)); if (h != null) { v.Add(new DerInteger(h)); } return(new DerSequence(v)); }
private Asn1Sequence ToSequence(ISet <DerObjectIdentifier> oids) { if (oids == null || oids.Count == 0) { return(null); } Asn1EncodableVector v = new Asn1EncodableVector(); for (IEnumerator it = oids.GetEnumerator(); it.MoveNext();) { v.Add((Asn1Encodable)it.Current); } return(new DerSequence(v)); }
public override Asn1Object ToAsn1Object() { Asn1EncodableVector asn1EncodableVector = new Asn1EncodableVector(new Asn1Encodable[] { this.ephemeralPublicKey }); if (this.addedukm != null) { asn1EncodableVector.Add(new Asn1Encodable[] { new DerTaggedObject(true, 0, this.addedukm) }); } return(new DerSequence(asn1EncodableVector)); }
/// <summary> /// Generate an PKCS#10 request based on the past in signer. /// </summary> /// <param name="signerFactory">the content signer to be used to generate the signature validating the certificate.</param> /// <returns>a holder containing the resulting PKCS#10 certification request.</returns> public Pkcs10CertificationRequest Build( ISignatureFactory <AlgorithmIdentifier> signerFactory) { CertificationRequestInfo info; if (attributes.Count == 0) { if (leaveOffEmpty) { info = new CertificationRequestInfo(subject, publicKeyInfo, null); } else { info = new CertificationRequestInfo(subject, publicKeyInfo, new DerSet()); } } else { Asn1EncodableVector v = new Asn1EncodableVector(); for (int i = 0; i != attributes.Count; i++) { v.Add(AttributePkcs.GetInstance(attributes[i])); } info = new CertificationRequestInfo(subject, publicKeyInfo, new DerSet(v)); } try { IStreamCalculator <IBlockResult> signer = signerFactory.CreateCalculator(); Stream sOut = signer.Stream; byte[] data = info.GetEncoded(Asn1Encodable.Der); sOut.Write(data, 0, data.Length); sOut.Close(); return(new Pkcs10CertificationRequest(new CertificationRequest(info, signerFactory.AlgorithmDetails, new DerBitString(signer.GetResult().Collect())))); } catch (IOException e) { throw new InvalidOperationException("cannot produce certification request signature: " + e.Message, e); } }
public IssuingDistributionPoint(DistributionPointName distributionPoint, bool onlyContainsUserCerts, bool onlyContainsCACerts, ReasonFlags onlySomeReasons, bool indirectCRL, bool onlyContainsAttributeCerts) { this._distributionPoint = distributionPoint; this._indirectCRL = indirectCRL; this._onlyContainsAttributeCerts = onlyContainsAttributeCerts; this._onlyContainsCACerts = onlyContainsCACerts; this._onlyContainsUserCerts = onlyContainsUserCerts; this._onlySomeReasons = onlySomeReasons; Asn1EncodableVector asn1EncodableVector = new Asn1EncodableVector(new Asn1Encodable[0]); if (distributionPoint != null) { asn1EncodableVector.Add(new Asn1Encodable[] { new DerTaggedObject(true, 0, distributionPoint) }); } if (onlyContainsUserCerts) { asn1EncodableVector.Add(new Asn1Encodable[] { new DerTaggedObject(false, 1, DerBoolean.True) }); } if (onlyContainsCACerts) { asn1EncodableVector.Add(new Asn1Encodable[] { new DerTaggedObject(false, 2, DerBoolean.True) }); } if (onlySomeReasons != null) { asn1EncodableVector.Add(new Asn1Encodable[] { new DerTaggedObject(false, 3, onlySomeReasons) }); } if (indirectCRL) { asn1EncodableVector.Add(new Asn1Encodable[] { new DerTaggedObject(false, 4, DerBoolean.True) }); } if (onlyContainsAttributeCerts) { asn1EncodableVector.Add(new Asn1Encodable[] { new DerTaggedObject(false, 5, DerBoolean.True) }); } this.seq = new DerSequence(asn1EncodableVector); }
public override Asn1Object ToAsn1Object() { Asn1EncodableVector asn1EncodableVector = new Asn1EncodableVector(); foreach (DerObjectIdentifier item in ordering) { X509Extension x509Extension = (X509Extension)extensions[item]; Asn1EncodableVector asn1EncodableVector2 = new Asn1EncodableVector(item); if (x509Extension.IsCritical) { asn1EncodableVector2.Add(DerBoolean.True); } asn1EncodableVector2.Add(x509Extension.Value); asn1EncodableVector.Add(new DerSequence(asn1EncodableVector2)); } return(new DerSequence(asn1EncodableVector)); }
/** * Creates a new <code>PolicyMappings</code> instance. * * @param mappings a <code>HashMap</code> value that maps * <code>string</code> oids * to other <code>string</code> oids. */ public PolicyMappings( IDictionary mappings) { Asn1EncodableVector v = new Asn1EncodableVector(); foreach (string idp in mappings.Keys) { string sdp = (string)mappings[idp]; v.Add( new DerSequence( new DerObjectIdentifier(idp), new DerObjectIdentifier(sdp))); } seq = new DerSequence(v); }
public void AddCrlEntry(DerInteger userCertificate, Time revocationDate, X509Extensions extensions) { Asn1EncodableVector asn1EncodableVector = new Asn1EncodableVector(new Asn1Encodable[] { userCertificate, revocationDate }); if (extensions != null) { asn1EncodableVector.Add(new Asn1Encodable[] { extensions }); } this.AddCrlEntry(new DerSequence(asn1EncodableVector)); }
public override Asn1Object ToAsn1Object() { Asn1EncodableVector asn1EncodableVector = new Asn1EncodableVector(new Asn1Encodable[] { this.publicKeyParamSet, this.digestParamSet }); if (this.encryptionParamSet != null) { asn1EncodableVector.Add(new Asn1Encodable[] { this.encryptionParamSet }); } return(new DerSequence(asn1EncodableVector)); }
/** * Creates a new <code>PolicyMappings</code> instance. * * @param mappings a <code>HashMap</code> value that maps * <code>string</code> oids * to other <code>string</code> oids. */ public PolicyMappings( IDictionary mappings) { Asn1EncodableVector v = new Asn1EncodableVector(); foreach (string idp in mappings.Keys) { string sdp = (string) mappings[idp]; v.Add( new DerSequence( new DerObjectIdentifier(idp), new DerObjectIdentifier(sdp))); } seq = new DerSequence(v); }
public override Asn1Object ToAsn1Object() { Asn1EncodableVector asn1EncodableVector = new Asn1EncodableVector(new Asn1Encodable[] { this.bagID, new DerTaggedObject(0, this.bagValue) }); if (this.bagAttributes != null) { asn1EncodableVector.Add(new Asn1Encodable[] { this.bagAttributes }); } return(new DerSequence(asn1EncodableVector)); }
public override Asn1Object ToAsn1Object() { Asn1EncodableVector asn1EncodableVector = new Asn1EncodableVector(new Asn1Encodable[] { new DerInteger(3), this.contentInfo }); if (this.macData != null) { asn1EncodableVector.Add(new Asn1Encodable[] { this.macData }); } return(new BerSequence(asn1EncodableVector)); }
/** * Constructor from given details. * * @param distributionPoint * May contain an URI as pointer to most current CRL. * @param onlyContainsUserCerts Covers revocation information for end certificates. * @param onlyContainsCACerts Covers revocation information for CA certificates. * * @param onlySomeReasons * Which revocation reasons does this point cover. * @param indirectCRL * If <code>true</code> then the CRL contains revocation * information about certificates ssued by other CAs. * @param onlyContainsAttributeCerts Covers revocation information for attribute certificates. */ public IssuingDistributionPoint( DistributionPointName distributionPoint, bool onlyContainsUserCerts, bool onlyContainsCACerts, ReasonFlags onlySomeReasons, bool indirectCRL, bool onlyContainsAttributeCerts) { this._distributionPoint = distributionPoint; this._indirectCRL = indirectCRL; this._onlyContainsAttributeCerts = onlyContainsAttributeCerts; this._onlyContainsCACerts = onlyContainsCACerts; this._onlyContainsUserCerts = onlyContainsUserCerts; this._onlySomeReasons = onlySomeReasons; Asn1EncodableVector vec = new Asn1EncodableVector(); if (distributionPoint != null) { // CHOICE item so explicitly tagged vec.Add(new DerTaggedObject(true, 0, distributionPoint)); } if (onlyContainsUserCerts) { vec.Add(new DerTaggedObject(false, 1, DerBoolean.True)); } if (onlyContainsCACerts) { vec.Add(new DerTaggedObject(false, 2, DerBoolean.True)); } if (onlySomeReasons != null) { vec.Add(new DerTaggedObject(false, 3, onlySomeReasons)); } if (indirectCRL) { vec.Add(new DerTaggedObject(false, 4, DerBoolean.True)); } if (onlyContainsAttributeCerts) { vec.Add(new DerTaggedObject(false, 5, DerBoolean.True)); } seq = new DerSequence(vec); }