List of usage examples for org.bouncycastle.asn1 ASN1EncodableVector add
public void add(ASN1Encodable element)
From source file:org.glite.voms.ac.AttributeCertificate.java
License:eu-egee.org license
/** * Produce an object suitable for an ASN1OutputStream. * <pre>//from w w w .j ava2 s . c o m * AttributeCertificate ::= SEQUENCE { * acinfo AttributeCertificateInfo, * signatureAlgorithm AlgorithmIdentifier, * signatureValue BIT STRING * } * </pre> */ public ASN1Primitive toASN1Primitive() { ASN1EncodableVector v = new ASN1EncodableVector(); v.add(acInfo); v.add(signatureAlgorithm); v.add(signatureValue); return new DERSequence(v); }
From source file:org.glite.voms.ac.AttributeCertificateInfo.java
License:eu-egee.org license
/** * Produce an object suitable for an ASN1OutputStream. * * <pre>/* w w w .j a v a2 s .co m*/ * * * * AttributeCertificateInfo ::= SEQUENCE { * version AttCertVersion -- version is v2, * holder Holder, * issuer AttCertIssuer, * signature AlgorithmIdentifier, * serialNumber CertificateSerialNumber, * attrCertValidityPeriod AttCertValidityPeriod, * attributes SEQUENCE OF Attribute, * issuerUniqueID UniqueIdentifier OPTIONAL, * extensions Extensions OPTIONAL * } * * AttCertVersion ::= INTEGER { v2(1) } * * * * </pre> */ public ASN1Primitive toASN1Primitive() { ASN1EncodableVector v = new ASN1EncodableVector(); v.add(version); v.add(holder); v.add(issuer); v.add(signature); v.add(serialNumber); if (!badVomsEncoding) { v.add(attrCertValidityPeriod); } else { DEREncodableVector v2 = new DEREncodableVector(); v2.add(new DERTaggedObject(false, 0, new DEROctetString( (attrCertValidityPeriod.getNotBeforeTime().getTime().substring(0, 14) + "Z").getBytes()))); v2.add(new DERTaggedObject(false, 1, new DEROctetString( (attrCertValidityPeriod.getNotAfterTime().getTime().substring(0, 14) + "Z").getBytes()))); v.add(new DERSequence(v2)); } v.add(attributes); if (issuerUniqueID != null) { v.add(issuerUniqueID); } if (extensions != null) { v.add(extensions); } return new DERSequence(v); }
From source file:org.glite.voms.ac.Holder.java
License:eu-egee.org license
public ASN1Primitive toASN1Primitive() { ASN1EncodableVector v = new ASN1EncodableVector(); if (baseCertificateID != null) { v.add(new DERTaggedObject(false, 0, baseCertificateID)); }/*from ww w . j a va 2 s .c om*/ if (entityName != null) { v.add(new DERTaggedObject(false, 1, entityName)); } if (objectDigestInfo != null) { v.add(new DERTaggedObject(false, 2, objectDigestInfo)); } return new DERSequence(v); }
From source file:org.glite.voms.ac.ObjectDigestInfo.java
License:eu-egee.org license
/** * Produce an object suitable for an ASN1OutputStream. * <pre>/*from ww w . j a v a2 s .c o m*/ * ObjectDigestInfo ::= SEQUENCE { * digestedObjectType ENUMERATED { * publicKey (0), * publicKeyCert (1), * otherObjectTypes (2) }, * -- otherObjectTypes MUST NOT * -- be used in this profile * otherObjectTypeID OBJECT IDENTIFIER OPTIONAL, * digestAlgorithm AlgorithmIdentifier, * objectDigest BIT STRING * } * </pre> */ public ASN1Primitive toASN1Primitive() { ASN1EncodableVector v = new ASN1EncodableVector(); v.add(digestedObjectType); if (otherObjectTypeID != null) { v.add(otherObjectTypeID); } v.add(digestAlgorithm); v.add(objectDigest); return new DERSequence(v); }
From source file:org.glite.voms.ac.V2Form.java
License:eu-egee.org license
/** * Produce an object suitable for an ASN1OutputStream. * <pre>//from w w w. java 2 s. c o m * V2Form ::= SEQUENCE { * issuerName GeneralNames OPTIONAL, * baseCertificateID [0] IssuerSerial OPTIONAL, * objectDigestInfo [1] ObjectDigestInfo OPTIONAL * -- issuerName MUST be present in this profile * -- baseCertificateID and objectDigestInfo MUST NOT * -- be present in this profile * } * </pre> */ public ASN1Primitive toASN1Primitive() { ASN1EncodableVector v = new ASN1EncodableVector(); if (issuerName != null) { // IMPLICIT encoding of GeneralNames ... gosh, how I hate ASN.1 sometimes. v.add(((ASN1Sequence) issuerName.toASN1Primitive()).getObjectAt(0)); } if (baseCertificateID != null) { v.add(new DERTaggedObject(0, baseCertificateID)); } if (objectDigestInfo != null) { v.add(new DERTaggedObject(1, objectDigestInfo)); } return new DERSequence(v); }
From source file:org.glite.voms.contact.X509NameHelper.java
License:Apache License
/** * Appends the specified OID and value pair name component to the end of the * current name.//from w ww. j a v a 2s . c o m * * @param oid the name component oid, e.g. {@link X509Name#CN * X509Name.CN} * @param value the value (e.g. "proxy") */ public void add(DERObjectIdentifier oid, String value) { ASN1EncodableVector v = new ASN1EncodableVector(); v.add(oid); v.add(new DERPrintableString(value)); add(new DERSet(new DERSequence(v))); }
From source file:org.glite.voms.contact.X509NameHelper.java
License:Apache License
/** * Appends the specified name component entry to the current name. This can * be used to add handle multiple AVAs in one name component. * * @param entry the name component to add. *//*from w w w. j a v a 2 s .c om*/ public void add(ASN1Set entry) { ASN1EncodableVector v = new ASN1EncodableVector(); int size = seq.size(); for (int i = 0; i < size; i++) { v.add(seq.getObjectAt(i)); } v.add(entry); seq = new DERSequence(v); }
From source file:org.globus.gsi.bc.X500NameHelper.java
License:Apache License
/** * Appends the specified OID and value pair name component to the end of the * current name.// w ww. j a v a 2 s .c om * * @param oid the name component oid, e.g. {@link X500Name#CN * X500Name.CN} * @param value the value (e.g. "proxy") */ public X500NameHelper add(ASN1ObjectIdentifier oid, String value) { ASN1EncodableVector v = new ASN1EncodableVector(); v.add(oid); v.add(new DERPrintableString(value)); add(new DERSet(new DERSequence(v))); return this; }
From source file:org.globus.gsi.bc.X500NameHelper.java
License:Apache License
/** * Appends the specified name component entry to the current name. This can * be used to add handle multiple AVAs in one name component. * * @param entry the name component to add. */// w ww . ja v a 2 s .c om public X500NameHelper add(ASN1Set entry) { ASN1EncodableVector v = new ASN1EncodableVector(); int size = seq.size(); for (int i = 0; i < size; i++) { v.add(seq.getObjectAt(i)); } v.add(entry); seq = new DERSequence(v); return this; }
From source file:org.globus.gsi.bc.X509NameHelper.java
License:Apache License
/** * Appends the specified OID and value pair name component to the end of the * current name./*from www. jav a 2 s .c o m*/ * * @param oid the name component oid, e.g. {@link org.bouncycastle.asn1.x500.style.BCStyle#CN * BCStyle.CN} * @param value the value (e.g. "proxy") */ public void add(ASN1ObjectIdentifier oid, String value) { ASN1EncodableVector v = new ASN1EncodableVector(); v.add(oid); v.add(new DERPrintableString(value)); add(new DERSet(new DERSequence(v))); }