本文整理匯總了Java中org.bouncycastle.asn1.ASN1EncodableVector類的典型用法代碼示例。如果您正苦於以下問題:Java ASN1EncodableVector類的具體用法?Java ASN1EncodableVector怎麽用?Java ASN1EncodableVector使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ASN1EncodableVector類屬於org.bouncycastle.asn1包,在下文中一共展示了ASN1EncodableVector類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: toASN1Primitive
import org.bouncycastle.asn1.ASN1EncodableVector; //導入依賴的package包/類
/**
* Produce an object suitable for an ASN1OutputStream.
* <pre>
* BasicConstraints := SEQUENCE {
* cA BOOLEAN DEFAULT FALSE,
* pathLenConstraint INTEGER (0..MAX) OPTIONAL
* }
* </pre>
*/
public ASN1Primitive toASN1Primitive()
{
ASN1EncodableVector v = new ASN1EncodableVector();
if (cA != null)
{
v.add(cA);
}
if (pathLenConstraint != null) // yes some people actually do this when cA is false...
{
v.add(pathLenConstraint);
}
return new DERSequence(v);
}
示例2: toASN1Primitive
import org.bouncycastle.asn1.ASN1EncodableVector; //導入依賴的package包/類
/**
* Produce an object suitable for an ASN1OutputStream.
* <p/>
* Returns:
* <p/>
* <pre>
* NamingAuthority ::= SEQUENCE
* {
* namingAuthorityId OBJECT IDENTIFIER OPTIONAL,
* namingAuthorityUrl IA5String OPTIONAL,
* namingAuthorityText DirectoryString(SIZE(1..128)) OPTIONAL
* }
* </pre>
*
* @return a DERObject
*/
public ASN1Primitive toASN1Primitive()
{
ASN1EncodableVector vec = new ASN1EncodableVector();
if (namingAuthorityId != null)
{
vec.add(namingAuthorityId);
}
if (namingAuthorityUrl != null)
{
vec.add(new DERIA5String(namingAuthorityUrl, true));
}
if (namingAuthorityText != null)
{
vec.add(namingAuthorityText);
}
return new DERSequence(vec);
}
示例3: toASN1Primitive
import org.bouncycastle.asn1.ASN1EncodableVector; //導入依賴的package包/類
/**
* 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);
}
示例4: toASN1Primitive
import org.bouncycastle.asn1.ASN1EncodableVector; //導入依賴的package包/類
/**
* Produce an object suitable for an ASN1OutputStream.
* <p/>
* Returns:
* <p/>
* <pre>
* ProcurationSyntax ::= SEQUENCE {
* country [1] EXPLICIT PrintableString(SIZE(2)) OPTIONAL,
* typeOfSubstitution [2] EXPLICIT DirectoryString (SIZE(1..128)) OPTIONAL,
* signingFor [3] EXPLICIT SigningFor
* }
* <p/>
* SigningFor ::= CHOICE
* {
* thirdPerson GeneralName,
* certRef IssuerSerial
* }
* </pre>
*
* @return a DERObject
*/
public ASN1Primitive toASN1Primitive()
{
ASN1EncodableVector vec = new ASN1EncodableVector();
if (country != null)
{
vec.add(new DERTaggedObject(true, 1, new DERPrintableString(country, true)));
}
if (typeOfSubstitution != null)
{
vec.add(new DERTaggedObject(true, 2, typeOfSubstitution));
}
if (thirdPerson != null)
{
vec.add(new DERTaggedObject(true, 3, thirdPerson));
}
else
{
vec.add(new DERTaggedObject(true, 3, certRef));
}
return new DERSequence(vec);
}
示例5: toASN1Primitive
import org.bouncycastle.asn1.ASN1EncodableVector; //導入依賴的package包/類
public ASN1Primitive toASN1Primitive()
{
ASN1EncodableVector v = new ASN1EncodableVector();
if (namedCurve != null)
{
v.add(namedCurve);
}
else
{
v.add(ecbinary);
}
if (!org.bouncycastle.util.Arrays.areEqual(dke, DEFAULT_DKE))
{
v.add(new DEROctetString(dke));
}
return new DERSequence(v);
}
示例6: toASN1Primitive
import org.bouncycastle.asn1.ASN1EncodableVector; //導入依賴的package包/類
/**
* Produce an object suitable for an ASN1OutputStream.
* <pre>
* OriginatorInfo ::= SEQUENCE {
* certs [0] IMPLICIT CertificateSet OPTIONAL,
* crls [1] IMPLICIT CertificateRevocationLists OPTIONAL
* }
* </pre>
*/
public ASN1Primitive toASN1Primitive()
{
ASN1EncodableVector v = new ASN1EncodableVector();
if (certs != null)
{
v.add(new DERTaggedObject(false, 0, certs));
}
if (crls != null)
{
v.add(new DERTaggedObject(false, 1, crls));
}
return new DERSequence(v);
}
示例7: NetscapeCertRequest
import org.bouncycastle.asn1.ASN1EncodableVector; //導入依賴的package包/類
public NetscapeCertRequest(
String challenge,
AlgorithmIdentifier signing_alg,
PublicKey pub_key) throws NoSuchAlgorithmException,
InvalidKeySpecException, NoSuchProviderException
{
this.challenge = challenge;
sigAlg = signing_alg;
pubkey = pub_key;
ASN1EncodableVector content_der = new ASN1EncodableVector();
content_der.add(getKeySpec());
//content_der.add(new SubjectPublicKeyInfo(sigAlg, new RSAPublicKeyStructure(pubkey.getModulus(), pubkey.getPublicExponent()).getDERObject()));
content_der.add(new DERIA5String(challenge));
try
{
content = new DERBitString(new DERSequence(content_der));
}
catch (IOException e)
{
throw new InvalidKeySpecException("exception encoding key: " + e.toString());
}
}
示例8: toASN1Primitive
import org.bouncycastle.asn1.ASN1EncodableVector; //導入依賴的package包/類
public ASN1Primitive toASN1Primitive()
{
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);
}
示例9: toASN1Primitive
import org.bouncycastle.asn1.ASN1EncodableVector; //導入依賴的package包/類
/**
* @see org.bouncycastle.asn1.ASN1Object#toASN1Primitive()
*/
public ASN1Primitive toASN1Primitive()
{
ASN1EncodableVector v = new ASN1EncodableVector();
if (valid != (signValid | bodyValid))
{
return null;
}
v.add(certificateBody);
try
{
v.add(new DERApplicationSpecific(false, EACTags.STATIC_INTERNAL_AUTHENTIFICATION_ONE_STEP, new DEROctetString(signature)));
}
catch (IOException e)
{
throw new IllegalStateException("unable to convert signature!");
}
return new DERApplicationSpecific(EACTags.CARDHOLDER_CERTIFICATE, v);
}
示例10: toASN1Primitive
import org.bouncycastle.asn1.ASN1EncodableVector; //導入依賴的package包/類
/**
* Produce an object suitable for an ASN1OutputStream.
* <pre>
* EnvelopedData ::= SEQUENCE {
* version CMSVersion,
* originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL,
* recipientInfos RecipientInfos,
* encryptedContentInfo EncryptedContentInfo,
* unprotectedAttrs [1] IMPLICIT UnprotectedAttributes OPTIONAL
* }
* </pre>
*/
public ASN1Primitive toASN1Primitive()
{
ASN1EncodableVector v = new ASN1EncodableVector();
v.add(version);
if (originatorInfo != null)
{
v.add(new DERTaggedObject(false, 0, originatorInfo));
}
v.add(recipientInfos);
v.add(encryptedContentInfo);
if (unprotectedAttrs != null)
{
v.add(new DERTaggedObject(false, 1, unprotectedAttrs));
}
return new BERSequence(v);
}
示例11: toASN1Primitive
import org.bouncycastle.asn1.ASN1EncodableVector; //導入依賴的package包/類
public ASN1Primitive toASN1Primitive()
{
ASN1EncodableVector v = new ASN1EncodableVector();
v.add(certificateBody);
try
{
v.add(new DERApplicationSpecific(false, EACTags.STATIC_INTERNAL_AUTHENTIFICATION_ONE_STEP, new DEROctetString(innerSignature)));
}
catch (IOException e)
{
throw new IllegalStateException("unable to convert signature!");
}
return new DERApplicationSpecific(EACTags.CARDHOLDER_CERTIFICATE, v);
}
示例12: generateBytes
import org.bouncycastle.asn1.ASN1EncodableVector; //導入依賴的package包/類
public int generateBytes(byte[] out, int outOff, int len)
throws DataLengthException, IllegalArgumentException
{
// TODO Create an ASN.1 class for this (RFC3278)
// ECC-CMS-SharedInfo
ASN1EncodableVector v = new ASN1EncodableVector();
v.add(new AlgorithmIdentifier(algorithm, DERNull.INSTANCE));
v.add(new DERTaggedObject(true, 2, new DEROctetString(Pack.intToBigEndian(keySize))));
try
{
kdf.init(new KDFParameters(z, new DERSequence(v).getEncoded(ASN1Encoding.DER)));
}
catch (IOException e)
{
throw new IllegalArgumentException("unable to initialise kdf: " + e.getMessage());
}
return kdf.generateBytes(out, outOff, len);
}
示例13: toASN1Primitive
import org.bouncycastle.asn1.ASN1EncodableVector; //導入依賴的package包/類
/**
* Produce an object suitable for an ASN1OutputStream.
* <pre>
* ContentInfo ::= SEQUENCE {
* contentType ContentType,
* content
* [0] EXPLICIT ANY DEFINED BY contentType OPTIONAL }
* </pre>
*/
public ASN1Primitive toASN1Primitive()
{
ASN1EncodableVector v = new ASN1EncodableVector();
v.add(contentType);
if (content != null)
{
v.add(new BERTaggedObject(true, 0, content));
}
if (isBer)
{
return new BERSequence(v);
}
else
{
return new DLSequence(v);
}
}
示例14: toASN1Primitive
import org.bouncycastle.asn1.ASN1EncodableVector; //導入依賴的package包/類
/**
* Produce an object suitable for an ASN1OutputStream.
* <pre>
* PasswordRecipientInfo ::= SEQUENCE {
* version CMSVersion, -- Always set to 0
* keyDerivationAlgorithm [0] KeyDerivationAlgorithmIdentifier
* OPTIONAL,
* keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
* encryptedKey EncryptedKey }
* </pre>
*/
public ASN1Primitive toASN1Primitive()
{
ASN1EncodableVector v = new ASN1EncodableVector();
v.add(version);
if (keyDerivationAlgorithm != null)
{
v.add(new DERTaggedObject(false, 0, keyDerivationAlgorithm));
}
v.add(keyEncryptionAlgorithm);
v.add(encryptedKey);
return new DERSequence(v);
}
示例15: toASN1Primitive
import org.bouncycastle.asn1.ASN1EncodableVector; //導入依賴的package包/類
/**
* <pre>
* RevAnnContent ::= SEQUENCE {
* status PKIStatus,
* certId CertId,
* willBeRevokedAt GeneralizedTime,
* badSinceDate GeneralizedTime,
* crlDetails Extensions OPTIONAL
* -- extra CRL details (e.g., crl number, reason, location, etc.)
* }
* </pre>
* @return a basic ASN.1 object representation.
*/
public ASN1Primitive toASN1Primitive()
{
ASN1EncodableVector v = new ASN1EncodableVector();
v.add(status);
v.add(certId);
v.add(willBeRevokedAt);
v.add(badSinceDate);
if (crlDetails != null)
{
v.add(crlDetails);
}
return new DERSequence(v);
}