List of usage examples for org.bouncycastle.asn1 ASN1EncodableVector add
public void add(ASN1Encodable element)
From source file:org.jboss.as.test.integration.security.common.negotiation.KerberosTestUtils.java
License:Open Source License
/** * Generates SPNEGO response (to a "select mechanism challenge") with given bytes as the ticket for selected mechanism. * * @param ticket/* ww w . java 2s . c o m*/ * @return ASN.1 encoded SPNEGO response */ public static byte[] generateSpnegoTokenResp(byte[] ticket) throws IOException { DEROctetString ourKerberosTicket = new DEROctetString(ticket); DERTaggedObject taggedNegState = new DERTaggedObject(0, new ASN1Enumerated(1)); // accept-incomplete DERTaggedObject taggedResponseToken = new DERTaggedObject(2, ourKerberosTicket); ASN1EncodableVector v = new ASN1EncodableVector(); v.add(taggedNegState); v.add(taggedResponseToken); DERSequence seqNegTokenResp = new DERSequence(v); DERTaggedObject taggedSpnego = new DERTaggedObject(1, seqNegTokenResp); return taggedSpnego.getEncoded(); }
From source file:org.jmrtd.lds.ActiveAuthenticationInfo.java
License:Open Source License
@Deprecated public ASN1Primitive getDERObject() { ASN1EncodableVector v = new ASN1EncodableVector(); v.add(new ASN1ObjectIdentifier(oid)); v.add(new ASN1Integer(version)); if (signatureAlgorithmOID != null) { v.add(new ASN1ObjectIdentifier(signatureAlgorithmOID)); }//from w w w . j a v a 2 s.c o m return new DLSequence(v); }
From source file:org.jmrtd.lds.CardAccessFile.java
License:Open Source License
protected void writeContent(OutputStream outputStream) throws IOException { ASN1EncodableVector vector = new ASN1EncodableVector(); for (SecurityInfo si : securityInfos) { vector.add(si.getDERObject()); }//from w w w . ja va 2 s. c o m ASN1Set derSet = new DLSet(vector); outputStream.write(derSet.getEncoded(ASN1Encoding.DER)); }
From source file:org.jmrtd.lds.CardSecurityFile.java
License:Open Source License
private static ContentInfo toContentInfo(String contentTypeOID, Collection<SecurityInfo> securityInfos) { try {/*ww w.java2 s . co m*/ ASN1EncodableVector vector = new ASN1EncodableVector(); for (SecurityInfo si : securityInfos) { vector.add(si.getDERObject()); } ASN1Set derSet = new DLSet(vector); return new ContentInfo(new ASN1ObjectIdentifier(contentTypeOID), new DEROctetString(derSet)); } catch (IOException ioe) { LOGGER.log(Level.SEVERE, "Error creating signedData: " + ioe.getMessage()); throw new IllegalArgumentException("Error DER encoding the security infos"); } }
From source file:org.jmrtd.lds.ChipAuthenticationInfo.java
License:Open Source License
@Deprecated public ASN1Primitive getDERObject() { ASN1EncodableVector v = new ASN1EncodableVector(); v.add(new ASN1ObjectIdentifier(oid)); v.add(new ASN1Integer(version)); if (keyId.compareTo(BigInteger.ZERO) >= 0) { v.add(new ASN1Integer(keyId)); }/*from www. j a va 2 s. co m*/ return new DLSequence(v); }
From source file:org.jmrtd.lds.ChipAuthenticationPublicKeyInfo.java
License:Open Source License
@Deprecated public ASN1Primitive getDERObject() { ASN1EncodableVector vector = new ASN1EncodableVector(); vector.add(new ASN1ObjectIdentifier(oid)); vector.add((ASN1Sequence) subjectPublicKeyInfo.toASN1Primitive()); if (keyId.compareTo(BigInteger.ZERO) >= 0) { vector.add(new ASN1Integer(keyId)); }//from w ww . j a v a 2 s. c o m return new DLSequence(vector); }
From source file:org.jmrtd.lds.DG14File.java
License:Open Source License
protected void writeContent(OutputStream outputStream) throws IOException { ASN1EncodableVector vector = new ASN1EncodableVector(); for (SecurityInfo securityInfo : securityInfos) { ASN1Primitive derObject = securityInfo.getDERObject(); vector.add(derObject); }/* w w w . j a va2 s . c om*/ ASN1Set derSet = new DLSet(vector); outputStream.write(derSet.getEncoded(ASN1Encoding.DER)); }
From source file:org.jmrtd.lds.PACEDomainParameterInfo.java
License:Open Source License
@Deprecated @Override//www . j a v a2 s .c om public ASN1Primitive getDERObject() { ASN1EncodableVector vector = new ASN1EncodableVector(); /* Protocol */ vector.add(new ASN1ObjectIdentifier(protocolOID)); /* Required data */ vector.add(domainParameter); /* Optional data */ if (parameterId >= 0) { vector.add(new ASN1Integer(parameterId)); } return new DLSequence(vector); }
From source file:org.jmrtd.lds.PACEInfo.java
License:Open Source License
@Deprecated @Override/*from ww w .j ava2 s.c o m*/ public ASN1Primitive getDERObject() { ASN1EncodableVector vector = new ASN1EncodableVector(); /* Protocol */ vector.add(new ASN1ObjectIdentifier(protocolOID)); /* Required data */ vector.add(new ASN1Integer(version)); /* Optional data */ if (parameterId >= 0) { vector.add(new ASN1Integer(parameterId)); } return new DLSequence(vector); }