List of usage examples for org.bouncycastle.asn1 ASN1EncodableVector add
public void add(ASN1Encodable element)
From source file:org.globus.gsi.proxy.ext.ProxyCertInfo.java
License:Apache License
/** * Returns the DER-encoded ASN.1 representation of the extension. * * @return <code>DERObject</code> the encoded representation of the extension. */// w ww . j a va 2 s .co m public ASN1Primitive toASN1Primitive() { ASN1EncodableVector vec = new ASN1EncodableVector(); if (this.pathLenConstraint != null) { vec.add(this.pathLenConstraint); } vec.add(this.proxyPolicy.toASN1Primitive()); return new DERSequence(vec); }
From source file:org.globus.gsi.proxy.ext.ProxyPolicy.java
License:Apache License
/** * Returns the DER-encoded ASN.1 representation of proxy policy. * * @return <code>DERObject</code> the encoded representation of the proxy * policy.//from w w w. ja va2 s .c o m */ public ASN1Primitive toASN1Primitive() { ASN1EncodableVector vec = new ASN1EncodableVector(); vec.add(this.policyLanguage); if (this.policy != null) { vec.add(this.policy); } return new DERSequence(vec); }
From source file:org.globus.security.proxyExtension.ProxyPolicy.java
License:Apache License
/** * Returns the DER-encoded ASN.1 representation of proxy policy. * * @return <code>DERObject</code> the encoded representation of the proxy * policy./*from w w w . j a v a2s.c om*/ */ public DERObject getDERObject() { ASN1EncodableVector vec = new ASN1EncodableVector(); vec.add(this.policyLanguage); if (this.policy != null) { vec.add(this.policy); } return new DERSequence(vec); }
From source file:org.italiangrid.voms.asn1.VOMSACGenerator.java
License:Apache License
private ASN1Encodable buildACCertsExtensionContent(EnumSet<ACGenerationProperties> properties) { ASN1EncodableVector issuerCertsContainer = new ASN1EncodableVector(); if (properties.contains(ACGenerationProperties.INCLUDE_EMPTY_AC_CERTS_EXTENSION)) issuerCertsContainer.add(new DERSequence()); else/* w w w . jav a2 s . com*/ issuerCertsContainer.add(new DERSequence(getCertAsDEREncodable(aaCredential.getCertificate()))); return new DERSequence(issuerCertsContainer); }
From source file:org.italiangrid.voms.asn1.VOMSACGenerator.java
License:Apache License
private ASN1Encodable buildFQANsAttributeContent(List<String> fqans, GeneralName policyAuthorityInfo) { ASN1EncodableVector container = new ASN1EncodableVector(); ASN1EncodableVector encodedFQANs = new ASN1EncodableVector(); // Policy authority info DERTaggedObject pai = new DERTaggedObject(0, policyAuthorityInfo); container.add(pai); for (String s : fqans) encodedFQANs.add(new DEROctetString(s.getBytes())); container.add(new DERSequence(encodedFQANs)); return new DERSequence(container); }
From source file:org.italiangrid.voms.asn1.VOMSACGenerator.java
License:Apache License
private ASN1Encodable buildGAExtensionContent(EnumSet<ACGenerationProperties> properties, List<VOMSGenericAttribute> gas, GeneralName policyAuthorityInfo) { ASN1EncodableVector tagContainer = new ASN1EncodableVector(); ASN1EncodableVector tagSequences = new ASN1EncodableVector(); for (VOMSGenericAttribute a : gas) tagSequences.add(buildTagSequence(a)); tagContainer.add(new GeneralNames(policyAuthorityInfo)); tagContainer.add(new DERSequence(tagSequences)); DERSequence finalSequence;//w w w . java 2s.co m // We wrap this three times as VOMS core does, even if I think this // is a bug finalSequence = new DERSequence(new DERSequence(new DERSequence(tagContainer))); return finalSequence; }
From source file:org.italiangrid.voms.asn1.VOMSACGenerator.java
License:Apache License
private DERSequence buildTagSequence(VOMSGenericAttribute ga) { ASN1EncodableVector tagSequence = new ASN1EncodableVector(); tagSequence.add(getDEROctetString(ga.getName())); tagSequence.add(getDEROctetString(ga.getValue())); tagSequence.add(getDEROctetString(ga.getContext())); return new DERSequence(tagSequence); }
From source file:org.italiangrid.voms.asn1.VOMSACGenerator.java
License:Apache License
private ASN1Encodable buildTargetsExtensionContent(EnumSet<ACGenerationProperties> properties, List<String> targets) { ASN1EncodableVector targetSeq = new ASN1EncodableVector(); for (String s : targets) { DERTaggedObject encodedTarget = new DERTaggedObject(0, new GeneralName(GeneralName.uniformResourceIdentifier, s)); // We wrap the target in another sequence as the old VOMS does targetSeq.add(new DERSequence(encodedTarget)); }/*from ww w. jav a2s. com*/ DERSequence targetExtensionContent = new DERSequence(new DERSequence(targetSeq)); return targetExtensionContent; }
From source file:org.italiangrid.voms.asn1.VOMSACGenerator.java
License:Apache License
public CertificateExtension generateVOMSExtension(List<X509AttributeCertificateHolder> acs) { ASN1EncodableVector vomsACs = new ASN1EncodableVector(); for (X509AttributeCertificateHolder ac : acs) vomsACs.add(ac.toASN1Structure()); DERSequence acSeq = new DERSequence(vomsACs); CertificateExtension ext = new CertificateExtension(VOMS_EXTENSION_OID.getId(), acSeq.toASN1Object(), false);// ww w.j av a 2s . co m return ext; }
From source file:org.jboss.as.test.integration.security.common.negotiation.KerberosTestUtils.java
License:Open Source License
/** * Generates SPNEGO init token with given initial ticket and supported mechanisms. * * @param ticket initial ticket for the preferred (the first) mechanism. * @param supMechOids object identifiers (OIDs) of supported mechanisms for the SPNEGO. * @return ASN.1 encoded SPNEGO init token *//*from w w w . ja va 2 s .co m*/ public static byte[] generateSpnegoTokenInit(byte[] ticket, String... supMechOids) throws IOException { DEROctetString ticketForPreferredMech = new DEROctetString(ticket); ASN1EncodableVector mechSeq = new ASN1EncodableVector(); for (String mech : supMechOids) { mechSeq.add(new ASN1ObjectIdentifier(mech)); } DERTaggedObject taggedMechTypes = new DERTaggedObject(0, new DERSequence(mechSeq)); DERTaggedObject taggedMechToken = new DERTaggedObject(2, ticketForPreferredMech); ASN1EncodableVector v = new ASN1EncodableVector(); v.add(taggedMechTypes); v.add(taggedMechToken); DERSequence seqNegTokenInit = new DERSequence(v); DERTaggedObject taggedSpnego = new DERTaggedObject(0, seqNegTokenInit); ASN1EncodableVector appVec = new ASN1EncodableVector(); appVec.add(new ASN1ObjectIdentifier(OID_SPNEGO)); appVec.add(taggedSpnego); DERApplicationSpecific app = new DERApplicationSpecific(0, appVec); return app.getEncoded(); }