use of org.bouncycastle.asn1.ASN1OutputStream in project robovm by robovm.
the class AttributeCertificate method toASN1Primitive.
/**
* Produce an object suitable for an ASN1OutputStream.
* <pre>
* 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);
}
use of org.bouncycastle.asn1.ASN1OutputStream in project robovm by robovm.
the class X9Curve method toASN1Primitive.
/**
* Produce an object suitable for an ASN1OutputStream.
* <pre>
* Curve ::= SEQUENCE {
* a FieldElement,
* b FieldElement,
* seed BIT STRING OPTIONAL
* }
* </pre>
*/
public ASN1Primitive toASN1Primitive() {
ASN1EncodableVector v = new ASN1EncodableVector();
if (fieldIdentifier.equals(prime_field)) {
v.add(new X9FieldElement(curve.getA()).toASN1Primitive());
v.add(new X9FieldElement(curve.getB()).toASN1Primitive());
} else if (fieldIdentifier.equals(characteristic_two_field)) {
v.add(new X9FieldElement(curve.getA()).toASN1Primitive());
v.add(new X9FieldElement(curve.getB()).toASN1Primitive());
}
if (seed != null) {
v.add(new DERBitString(seed));
}
return new DERSequence(v);
}
use of org.bouncycastle.asn1.ASN1OutputStream in project robovm by robovm.
the class EncryptedPrivateKeyInfo method toASN1Primitive.
/**
* Produce an object suitable for an ASN1OutputStream.
* <pre>
* EncryptedPrivateKeyInfo ::= SEQUENCE {
* encryptionAlgorithm AlgorithmIdentifier {{KeyEncryptionAlgorithms}},
* encryptedData EncryptedData
* }
*
* EncryptedData ::= OCTET STRING
*
* KeyEncryptionAlgorithms ALGORITHM-IDENTIFIER ::= {
* ... -- For local profiles
* }
* </pre>
*/
public ASN1Primitive toASN1Primitive() {
ASN1EncodableVector v = new ASN1EncodableVector();
v.add(algId);
v.add(data);
return new DERSequence(v);
}
use of org.bouncycastle.asn1.ASN1OutputStream in project robovm by robovm.
the class X9ECParameters method toASN1Primitive.
/**
* Produce an object suitable for an ASN1OutputStream.
* <pre>
* ECParameters ::= SEQUENCE {
* version INTEGER { ecpVer1(1) } (ecpVer1),
* fieldID FieldID {{FieldTypes}},
* curve X9Curve,
* base X9ECPoint,
* order INTEGER,
* cofactor INTEGER OPTIONAL
* }
* </pre>
*/
public ASN1Primitive toASN1Primitive() {
ASN1EncodableVector v = new ASN1EncodableVector();
v.add(new ASN1Integer(1));
v.add(fieldID);
v.add(new X9Curve(curve, seed));
v.add(new X9ECPoint(g));
v.add(new ASN1Integer(n));
if (h != null) {
v.add(new ASN1Integer(h));
}
return new DERSequence(v);
}
use of org.bouncycastle.asn1.ASN1OutputStream in project robovm by robovm.
the class GeneralSubtree method toASN1Primitive.
/**
* Produce an object suitable for an ASN1OutputStream.
*
* Returns:
*
* <pre>
* GeneralSubtree ::= SEQUENCE
* {
* base GeneralName,
* minimum [0] BaseDistance DEFAULT 0,
* maximum [1] BaseDistance OPTIONAL
* }
* </pre>
*
* @return a ASN1Primitive
*/
public ASN1Primitive toASN1Primitive() {
ASN1EncodableVector v = new ASN1EncodableVector();
v.add(base);
if (minimum != null && !minimum.getValue().equals(ZERO)) {
v.add(new DERTaggedObject(false, 0, minimum));
}
if (maximum != null) {
v.add(new DERTaggedObject(false, 1, maximum));
}
return new DERSequence(v);
}
Aggregations