/** * Constructs a target information from a single targets element. * According to RFC 3281 only one targets element must be produced. * * @param targets A Targets instance. */ public TargetInformation(Targets targets) { this.targets = new DERSequence(targets); }
private byte[] derEncode( BigInteger r, BigInteger s) throws IOException { ASN1Integer[] rs = new ASN1Integer[]{ new ASN1Integer(r), new ASN1Integer(s) }; return new DERSequence(rs).getEncoded(ASN1Encoding.DER); }
void encode( ASN1OutputStream out) throws IOException { ASN1OutputStream dOut = out.getDERSubStream(); int length = getBodyLength(); out.write(BERTags.SEQUENCE | BERTags.CONSTRUCTED); out.writeLength(length); for (Enumeration e = this.getObjects(); e.hasMoreElements();) { Object obj = e.nextElement(); dOut.writeObject((ASN1Encodable)obj); } } }
protected static PKIXPolicyNode processCertE( CertPath certPath, int index, PKIXPolicyNode validPolicyTree) throws CertPathValidatorException { List certs = certPath.getCertificates(); X509Certificate cert = (X509Certificate)certs.get(index); // // (e) // ASN1Sequence certPolicies = null; try { certPolicies = DERSequence.getInstance(CertPathValidatorUtilities.getExtensionValue(cert, RFC3280CertPathUtilities.CERTIFICATE_POLICIES)); } catch (AnnotatedException e) { throw new ExtCertPathValidatorException("Could not read certificate policies extension from certificate.", e, certPath, index); } if (certPolicies == null) { validPolicyTree = null; } return validPolicyTree; }
public byte[] getEncoded() throws IOException { return sequence.getEncoded(); } }
int encodedLength() throws IOException { int length = getBodyLength(); return 1 + StreamUtil.calculateBodyLength(length) + length; }
private int getBodyLength() throws IOException { if (bodyLength < 0) { int length = 0; for (Enumeration e = this.getObjects(); e.hasMoreElements();) { Object obj = e.nextElement(); length += ((ASN1Encodable)obj).toASN1Primitive().toDERObject().encodedLength(); } bodyLength = length; } return bodyLength; }
protected static PKIXPolicyNode processCertE( CertPath certPath, int index, PKIXPolicyNode validPolicyTree) throws CertPathValidatorException { List certs = certPath.getCertificates(); X509Certificate cert = (X509Certificate)certs.get(index); // // (e) // ASN1Sequence certPolicies = null; try { certPolicies = DERSequence.getInstance(CertPathValidatorUtilities.getExtensionValue(cert, RFC3280CertPathUtilities.CERTIFICATE_POLICIES)); } catch (AnnotatedException e) { throw new ExtCertPathValidatorException("Could not read certificate policies extension from certificate.", e, certPath, index); } if (certPolicies == null) { validPolicyTree = null; } return validPolicyTree; }
int encodedLength() throws IOException { int length = getBodyLength(); return 1 + StreamUtil.calculateBodyLength(length) + length; }
private int getBodyLength() throws IOException { if (bodyLength < 0) { int length = 0; for (Enumeration e = this.getObjects(); e.hasMoreElements();) { Object obj = e.nextElement(); length += ((ASN1Encodable)obj).toASN1Primitive().toDERObject().encodedLength(); } bodyLength = length; } return bodyLength; }
private CertificationRequestInfo(X500Name subject, AlgorithmIdentifier algorithm, DERBitString subjectPublicKey, ASN1Set attributes) { this.version = ZERO; this.subject = subject; this.subjectPublicKeyInfo = new DERSequence(new ASN1Encodable[] { algorithm, subjectPublicKey }); this.attributes = attributes; }
private byte[] derEncode( BigInteger r, BigInteger s) throws IOException { ASN1Integer[] rs = new ASN1Integer[]{ new ASN1Integer(r), new ASN1Integer(s) }; return new DERSequence(rs).getEncoded(ASN1Encoding.DER); }
contentsOfAdmissions = DERSequence.getInstance(seq.getObjectAt(0)); break; case 2: admissionAuthority = GeneralName.getInstance(seq.getObjectAt(0)); contentsOfAdmissions = DERSequence.getInstance(seq.getObjectAt(1)); break; default:
void encode( ASN1OutputStream out) throws IOException { ASN1OutputStream dOut = out.getDERSubStream(); int length = getBodyLength(); out.write(BERTags.SEQUENCE | BERTags.CONSTRUCTED); out.writeLength(length); for (Enumeration e = this.getObjects(); e.hasMoreElements();) { Object obj = e.nextElement(); dOut.writeObject((ASN1Encodable)obj); } } }
public ASN1Primitive toASN1Primitive() { return new DERSequence(bodyPartIDs); } }
private static byte[] derEncode(byte[] rawSign) throws IOException { int len = rawSign.length / 2; byte[] r = new byte[len]; byte[] s = new byte[len]; System.arraycopy(rawSign, 0, r, 0, len); System.arraycopy(rawSign, len, s, 0, len); ASN1EncodableVector v = new ASN1EncodableVector(); v.add(new ASN1Integer(new BigInteger(1, r))); v.add(new ASN1Integer(new BigInteger(1, s))); DERSequence seq = new DERSequence(v); return seq.getEncoded(); }
contentsOfAdmissions = DERSequence.getInstance(seq.getObjectAt(0)); break; case 2: admissionAuthority = GeneralName.getInstance(seq.getObjectAt(0)); contentsOfAdmissions = DERSequence.getInstance(seq.getObjectAt(1)); break; default:
public ASN1Primitive toASN1Primitive() { return new DERSequence(attrOrOIDs); } }
private X509Certificate generateJcaObject(TBSCertificate tbsCert, byte[] signature) throws Exception { ASN1EncodableVector v = new ASN1EncodableVector(); v.add(tbsCert); v.add(sigAlgId); v.add(new DERBitString(signature)); return (X509Certificate)certificateFactory.engineGenerateCertificate( new ByteArrayInputStream(new DERSequence(v).getEncoded(ASN1Encoding.DER))); }
try policies = DERSequence.getInstance(getExtensionValue(cert, CERTIFICATE_POLICIES));