use of org.bouncycastle.asn1.ASN1OutputStream in project XobotOS by xamarin.
the class AttributeCertificateInfo method toASN1Object.
/**
* Produce an object suitable for an ASN1OutputStream.
* <pre>
* AttributeCertificateInfo ::= SEQUENCE {
* version AttCertVersion -- version is v2,
* holder Holder,
* issuer AttCertIssuer,
* signature AlgorithmIdentifier,
* serialNumber CertificateSerialNumber,
* attrCertValidityPeriod AttCertValidityPeriod,
* attributes SEQUENCE OF Attribute,
* issuerUniqueID UniqueIdentifier OPTIONAL,
* extensions Extensions OPTIONAL
* }
*
* AttCertVersion ::= INTEGER { v2(1) }
* </pre>
*/
public DERObject toASN1Object() {
ASN1EncodableVector v = new ASN1EncodableVector();
v.add(version);
v.add(holder);
v.add(issuer);
v.add(signature);
v.add(serialNumber);
v.add(attrCertValidityPeriod);
v.add(attributes);
if (issuerUniqueID != null) {
v.add(issuerUniqueID);
}
if (extensions != null) {
v.add(extensions);
}
return new DERSequence(v);
}
use of org.bouncycastle.asn1.ASN1OutputStream in project XobotOS by xamarin.
the class PKCS12BagAttributeCarrierImpl method writeObject.
public void writeObject(ObjectOutputStream out) throws IOException {
if (pkcs12Ordering.size() == 0) {
out.writeObject(new Hashtable());
out.writeObject(new Vector());
} else {
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
ASN1OutputStream aOut = new ASN1OutputStream(bOut);
Enumeration e = this.getBagAttributeKeys();
while (e.hasMoreElements()) {
DERObjectIdentifier oid = (DERObjectIdentifier) e.nextElement();
aOut.writeObject(oid);
aOut.writeObject(pkcs12Attributes.get(oid));
}
out.writeObject(bOut.toByteArray());
}
}
use of org.bouncycastle.asn1.ASN1OutputStream in project XobotOS by xamarin.
the class X509CRLObject method getIssuerX500Principal.
public X500Principal getIssuerX500Principal() {
try {
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
ASN1OutputStream aOut = new ASN1OutputStream(bOut);
aOut.writeObject(c.getIssuer());
return new X500Principal(bOut.toByteArray());
} catch (IOException e) {
throw new IllegalStateException("can't encode issuer DN");
}
}
use of org.bouncycastle.asn1.ASN1OutputStream in project XobotOS by xamarin.
the class X509CertificateObject method getSubjectX500Principal.
public X500Principal getSubjectX500Principal() {
try {
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
ASN1OutputStream aOut = new ASN1OutputStream(bOut);
aOut.writeObject(c.getSubject());
return new X500Principal(bOut.toByteArray());
} catch (IOException e) {
throw new IllegalStateException("can't encode issuer DN");
}
}
use of org.bouncycastle.asn1.ASN1OutputStream in project XobotOS by xamarin.
the class X509CertificateObject method getIssuerX500Principal.
public X500Principal getIssuerX500Principal() {
try {
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
ASN1OutputStream aOut = new ASN1OutputStream(bOut);
aOut.writeObject(c.getIssuer());
return new X500Principal(bOut.toByteArray());
} catch (IOException e) {
throw new IllegalStateException("can't encode issuer DN");
}
}
Aggregations