use of org.openecard.bouncycastle.asn1.DERSequence in project nhin-d by DirectProject.
the class AbstractX509Field method getDERObject.
/**
* Converts an encoded internal sequence object to a DERObject
* @param ext The encoded sequence as a byte array
* @return The converted DERObject
* @throws PolicyProcessException
*/
protected DERObject getDERObject(byte[] ext) throws PolicyProcessException {
ASN1InputStream aIn = null;
try {
aIn = new ASN1InputStream(ext);
DERSequence seq = (DERSequence) aIn.readObject();
IOUtils.closeQuietly(aIn);
aIn = new ASN1InputStream(seq.getDEREncoded());
return aIn.readObject();
} catch (Exception e) {
throw new PolicyProcessException("Exception processing data ", e);
} finally {
IOUtils.closeQuietly(aIn);
}
}
use of org.openecard.bouncycastle.asn1.DERSequence in project XobotOS by xamarin.
the class NetscapeCertRequest method toASN1Object.
public DERObject toASN1Object() {
ASN1EncodableVector spkac = new ASN1EncodableVector();
ASN1EncodableVector pkac = new ASN1EncodableVector();
try {
pkac.add(getKeySpec());
} catch (Exception e) {
//ignore
}
pkac.add(new DERIA5String(challenge));
spkac.add(new DERSequence(pkac));
spkac.add(sigAlg);
spkac.add(new DERBitString(sigBits));
return new DERSequence(spkac);
}
use of org.openecard.bouncycastle.asn1.DERSequence in project XobotOS by xamarin.
the class DHDomainParameters method toASN1Object.
public DERObject toASN1Object() {
ASN1EncodableVector v = new ASN1EncodableVector();
v.add(this.p);
v.add(this.g);
v.add(this.q);
if (this.j != null) {
v.add(this.j);
}
if (this.validationParms != null) {
v.add(this.validationParms);
}
return new DERSequence(v);
}
use of org.openecard.bouncycastle.asn1.DERSequence in project XobotOS by xamarin.
the class X9Curve method toASN1Object.
/**
* Produce an object suitable for an ASN1OutputStream.
* <pre>
* Curve ::= SEQUENCE {
* a FieldElement,
* b FieldElement,
* seed BIT STRING OPTIONAL
* }
* </pre>
*/
public DERObject toASN1Object() {
ASN1EncodableVector v = new ASN1EncodableVector();
if (fieldIdentifier.equals(prime_field)) {
v.add(new X9FieldElement(curve.getA()).getDERObject());
v.add(new X9FieldElement(curve.getB()).getDERObject());
} else if (fieldIdentifier.equals(characteristic_two_field)) {
v.add(new X9FieldElement(curve.getA()).getDERObject());
v.add(new X9FieldElement(curve.getB()).getDERObject());
}
if (seed != null) {
v.add(new DERBitString(seed));
}
return new DERSequence(v);
}
use of org.openecard.bouncycastle.asn1.DERSequence in project XobotOS by xamarin.
the class X9FieldID method toASN1Object.
/**
* Produce a DER encoding of the following structure.
* <pre>
* FieldID ::= SEQUENCE {
* fieldType FIELD-ID.&id({IOSet}),
* parameters FIELD-ID.&Type({IOSet}{@fieldType})
* }
* </pre>
*/
public DERObject toASN1Object() {
ASN1EncodableVector v = new ASN1EncodableVector();
v.add(this.id);
v.add(this.parameters);
return new DERSequence(v);
}
Aggregations