use of com.github.zhenwei.core.asn1.x509.Extensions in project LinLong-Java by zhenwei1108.
the class TBSRequest method toASN1Primitive.
/**
* Produce an object suitable for an ASN1OutputStream.
* <pre>
* TBSRequest ::= SEQUENCE {
* version [0] EXPLICIT Version DEFAULT v1,
* requestorName [1] EXPLICIT GeneralName OPTIONAL,
* requestList SEQUENCE OF Request,
* requestExtensions [2] EXPLICIT Extensions OPTIONAL }
* </pre>
*/
public ASN1Primitive toASN1Primitive() {
ASN1EncodableVector v = new ASN1EncodableVector(4);
//
if (!version.equals(V1) || versionSet) {
v.add(new DERTaggedObject(true, 0, version));
}
if (requestorName != null) {
v.add(new DERTaggedObject(true, 1, requestorName));
}
v.add(requestList);
if (requestExtensions != null) {
v.add(new DERTaggedObject(true, 2, requestExtensions));
}
return new DERSequence(v);
}
use of com.github.zhenwei.core.asn1.x509.Extensions in project LinLong-Java by zhenwei1108.
the class Request method toASN1Primitive.
/**
* Produce an object suitable for an ASN1OutputStream.
* <pre>
* Request ::= SEQUENCE {
* reqCert CertID,
* singleRequestExtensions [0] EXPLICIT Extensions OPTIONAL }
* </pre>
*/
public ASN1Primitive toASN1Primitive() {
ASN1EncodableVector v = new ASN1EncodableVector(2);
v.add(reqCert);
if (singleRequestExtensions != null) {
v.add(new DERTaggedObject(true, 0, singleRequestExtensions));
}
return new DERSequence(v);
}
use of com.github.zhenwei.core.asn1.x509.Extensions in project LinLong-Java by zhenwei1108.
the class ExtensionsGenerator method reset.
/**
* Reset the generator
*/
public void reset() {
extensions = new Hashtable();
extOrdering = new Vector();
}
use of com.github.zhenwei.core.asn1.x509.Extensions in project LinLong-Java by zhenwei1108.
the class ExtensionsGenerator method addExtension.
public void addExtension(Extensions extensions) {
ASN1ObjectIdentifier[] oids = extensions.getExtensionOIDs();
for (int i = 0; i != oids.length; i++) {
ASN1ObjectIdentifier ident = oids[i];
Extension ext = extensions.getExtension(ident);
addExtension(ASN1ObjectIdentifier.getInstance(ident), ext.isCritical(), ext.getExtnValue().getOctets());
}
}
use of com.github.zhenwei.core.asn1.x509.Extensions in project LinLong-Java by zhenwei1108.
the class AttributeCertificateInfo method toASN1Primitive.
/**
* 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 ASN1Primitive toASN1Primitive() {
ASN1EncodableVector v = new ASN1EncodableVector(9);
if (!version.hasValue(0)) {
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);
}
Aggregations