use of com.github.zhenwei.core.asn1.ASN1Primitive in project LinLong-Java by zhenwei1108.
the class PBES2Parameters method toASN1Primitive.
public ASN1Primitive toASN1Primitive() {
ASN1EncodableVector v = new ASN1EncodableVector(2);
v.add(func);
v.add(scheme);
return new DERSequence(v);
}
use of com.github.zhenwei.core.asn1.ASN1Primitive in project LinLong-Java by zhenwei1108.
the class PKCS12PBEParams method toASN1Primitive.
public ASN1Primitive toASN1Primitive() {
ASN1EncodableVector v = new ASN1EncodableVector(2);
v.add(iv);
v.add(iterations);
return new DERSequence(v);
}
use of com.github.zhenwei.core.asn1.ASN1Primitive in project LinLong-Java by zhenwei1108.
the class Pfx method toASN1Primitive.
public ASN1Primitive toASN1Primitive() {
ASN1EncodableVector v = new ASN1EncodableVector(3);
v.add(new ASN1Integer(3));
v.add(contentInfo);
if (macData != null) {
v.add(macData);
}
return new BERSequence(v);
}
use of com.github.zhenwei.core.asn1.ASN1Primitive in project LinLong-Java by zhenwei1108.
the class PrivateKeyInfo method toASN1Primitive.
public ASN1Primitive toASN1Primitive() {
ASN1EncodableVector v = new ASN1EncodableVector(5);
v.add(version);
v.add(privateKeyAlgorithm);
v.add(privateKey);
if (attributes != null) {
v.add(new DERTaggedObject(false, 0, attributes));
}
if (publicKey != null) {
v.add(new DERTaggedObject(false, 1, publicKey));
}
return new DERSequence(v);
}
use of com.github.zhenwei.core.asn1.ASN1Primitive in project LinLong-Java by zhenwei1108.
the class RSAPrivateKey method toASN1Primitive.
/**
* This outputs the key in PKCS1v2 format.
* <pre>
* RSAPrivateKey ::= SEQUENCE {
* version Version,
* modulus INTEGER, -- n
* publicExponent INTEGER, -- e
* privateExponent INTEGER, -- d
* prime1 INTEGER, -- p
* prime2 INTEGER, -- q
* exponent1 INTEGER, -- d mod (p-1)
* exponent2 INTEGER, -- d mod (q-1)
* coefficient INTEGER, -- (inverse of q) mod p
* otherPrimeInfos OtherPrimeInfos OPTIONAL
* }
*
* Version ::= INTEGER { two-prime(0), multi(1) }
* (CONSTRAINED BY {-- version must be multi if otherPrimeInfos present --})
* </pre>
* <p>
* This routine is written to output PKCS1 version 2.1, private keys.
*/
public ASN1Primitive toASN1Primitive() {
ASN1EncodableVector v = new ASN1EncodableVector(10);
// version
v.add(new ASN1Integer(version));
v.add(new ASN1Integer(getModulus()));
v.add(new ASN1Integer(getPublicExponent()));
v.add(new ASN1Integer(getPrivateExponent()));
v.add(new ASN1Integer(getPrime1()));
v.add(new ASN1Integer(getPrime2()));
v.add(new ASN1Integer(getExponent1()));
v.add(new ASN1Integer(getExponent2()));
v.add(new ASN1Integer(getCoefficient()));
if (otherPrimeInfos != null) {
v.add(otherPrimeInfos);
}
return new DERSequence(v);
}
Aggregations