Top Inners Constructors Methods
org.bouncycastle.cert.jcajce

public Class JcaX509ExtensionUtils

extends X509ExtensionUtils
Class Inheritance
Imports
java.io.ByteArrayOutputStream, .IOException, .OutputStream, java.math.BigInteger, java.net.InetAddress, .UnknownHostException, java.security.MessageDigest, .NoSuchAlgorithmException, .PublicKey, java.security.cert.CertificateEncodingException, .CertificateParsingException, .X509Certificate, java.util.ArrayList, .Collection, .Collections, .Enumeration, .List, javax.security.auth.x500.X500Principal, org.bouncycastle.asn1.ASN1ObjectIdentifier, .ASN1OctetString, .ASN1Primitive, .ASN1String, .DEROctetString, .DERSequence, org.bouncycastle.asn1.oiw.OIWObjectIdentifiers, org.bouncycastle.asn1.x500.X500Name, org.bouncycastle.asn1.x500.style.RFC4519Style, org.bouncycastle.asn1.x509.AlgorithmIdentifier, .AuthorityKeyIdentifier, .Extension, .GeneralName, .GeneralNames, .SubjectKeyIdentifier, .SubjectPublicKeyInfo, org.bouncycastle.cert.X509ExtensionUtils, org.bouncycastle.operator.DigestCalculator, org.bouncycastle.util.Integers

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Constructor Summary

AccessConstructor and Description
public
JcaX509ExtensionUtils()

Create a utility class pre-configured with a SHA-1 digest calculator based on the default implementation.

public

Method Summary

Modifier and TypeMethod and Description
public AuthorityKeyIdentifier
public AuthorityKeyIdentifier
public AuthorityKeyIdentifier
public AuthorityKeyIdentifier
public SubjectKeyIdentifier

Returns:

the key identifier.
createSubjectKeyIdentifier
(PublicKey
the key object containing the key identifier is to be based on.
publicKey
)

Return a RFC 3280 type 1 key identifier.

public SubjectKeyIdentifier

Returns:

the key identifier.
createTruncatedSubjectKeyIdentifier
(PublicKey
the key object of interest.
publicKey
)

Return a RFC 3280 type 2 key identifier.

private static Collection<E>
getAlternativeNames(byte[] extVal)

public static Collection<E>
public static Collection<E>
public static ASN1Primitive

Returns:

an ASN.1 object
parseExtensionValue
(byte[]
DER encoded OCTET STRING containing the DER encoded extension object.
encExtValue
)

Return the ASN.1 object contained in a byte[] returned by a getExtensionValue() call.

Inherited from org.bouncycastle.cert.X509ExtensionUtils:
createAuthorityKeyIdentifiercreateAuthorityKeyIdentifiercreateAuthorityKeyIdentifiercreateSubjectKeyIdentifiercreateTruncatedSubjectKeyIdentifier

Constructor Detail

JcaX509ExtensionUtilsback to summary
public JcaX509ExtensionUtils() throws NoSuchAlgorithmException

Create a utility class pre-configured with a SHA-1 digest calculator based on the default implementation.

JcaX509ExtensionUtilsback to summary
public JcaX509ExtensionUtils(DigestCalculator calculator)

Method Detail

createAuthorityKeyIdentifierback to summary
public AuthorityKeyIdentifier createAuthorityKeyIdentifier(X509Certificate cert) throws CertificateEncodingException
createAuthorityKeyIdentifierback to summary
public AuthorityKeyIdentifier createAuthorityKeyIdentifier(PublicKey pubKey)
createAuthorityKeyIdentifierback to summary
public AuthorityKeyIdentifier createAuthorityKeyIdentifier(PublicKey pubKey, X500Principal name, BigInteger serial)
createAuthorityKeyIdentifierback to summary
public AuthorityKeyIdentifier createAuthorityKeyIdentifier(PublicKey pubKey, GeneralNames generalNames, BigInteger serial)
createSubjectKeyIdentifierback to summary
public SubjectKeyIdentifier createSubjectKeyIdentifier(PublicKey publicKey)

Return a RFC 3280 type 1 key identifier. As in:

(1) The keyIdentifier is composed of the 160-bit SHA-1 hash of the
value of the BIT STRING subjectPublicKey (excluding the tag,
length, and number of unused bits).
Parameters
publicKey:PublicKey

the key object containing the key identifier is to be based on.

Returns:SubjectKeyIdentifier

the key identifier.

createTruncatedSubjectKeyIdentifierback to summary
public SubjectKeyIdentifier createTruncatedSubjectKeyIdentifier(PublicKey publicKey)

Return a RFC 3280 type 2 key identifier. As in:

(2) The keyIdentifier is composed of a four bit type field with
the value 0100 followed by the least significant 60 bits of the
SHA-1 hash of the value of the BIT STRING subjectPublicKey.
Parameters
publicKey:PublicKey

the key object of interest.

Returns:SubjectKeyIdentifier

the key identifier.

getAlternativeNamesback to summary
private static Collection<E> getAlternativeNames(byte[] extVal) throws CertificateParsingException
getIssuerAlternativeNamesback to summary
public static Collection<E> getIssuerAlternativeNames(X509Certificate cert) throws CertificateParsingException
getSubjectAlternativeNamesback to summary
public static Collection<E> getSubjectAlternativeNames(X509Certificate cert) throws CertificateParsingException
parseExtensionValueback to summary
public static ASN1Primitive parseExtensionValue(byte[] encExtValue) throws IOException

Return the ASN.1 object contained in a byte[] returned by a getExtensionValue() call.

Parameters
encExtValue:byte[]

DER encoded OCTET STRING containing the DER encoded extension object.

Returns:ASN1Primitive

an ASN.1 object

Exceptions
IOException:
on a parsing error.
org.bouncycastle.cert.jcajce back to summary

private Class JcaX509ExtensionUtils.SHA1DigestCalculator

extends Object
implements DigestCalculator
Class Inheritance
  • java.lang.Object
  • org.bouncycastle.cert.jcajce.JcaX509ExtensionUtils.SHA1DigestCalculator
All Implemented Interfaces
org.bouncycastle.operator.DigestCalculator

Field Summary

Modifier and TypeField and Description
private ByteArrayOutputStream
private MessageDigest

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public AlgorithmIdentifier
getAlgorithmIdentifier()

Implements org.bouncycastle.operator.DigestCalculator.getAlgorithmIdentifier.

Return the algorithm identifier representing the digest implemented by this calculator.
public byte[]
getDigest()

Implements org.bouncycastle.operator.DigestCalculator.getDigest.

Return the digest calculated on what has been written to the calculator's output stream.
public OutputStream
getOutputStream()

Implements org.bouncycastle.operator.DigestCalculator.getOutputStream.

Returns a stream that will accept data for the purpose of calculating a digest.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bOutback to summary
private ByteArrayOutputStream bOut
digestback to summary
private MessageDigest digest

Constructor Detail

SHA1DigestCalculatorback to summary
public SHA1DigestCalculator(MessageDigest digest)

Method Detail

getAlgorithmIdentifierback to summary
public AlgorithmIdentifier getAlgorithmIdentifier()

Implements org.bouncycastle.operator.DigestCalculator.getAlgorithmIdentifier.

Doc from org.bouncycastle.operator.DigestCalculator.getAlgorithmIdentifier.

Return the algorithm identifier representing the digest implemented by this calculator.

Returns:AlgorithmIdentifier

algorithm id and parameters.

getDigestback to summary
public byte[] getDigest()

Implements org.bouncycastle.operator.DigestCalculator.getDigest.

Doc from org.bouncycastle.operator.DigestCalculator.getDigest.

Return the digest calculated on what has been written to the calculator's output stream.

Returns:byte[]

a digest.

getOutputStreamback to summary
public OutputStream getOutputStream()

Implements org.bouncycastle.operator.DigestCalculator.getOutputStream.

Doc from org.bouncycastle.operator.DigestCalculator.getOutputStream.

Returns a stream that will accept data for the purpose of calculating a digest. Use org.bouncycastle.util.io.TeeOutputStream if you want to accumulate the data on the fly as well.

Returns:OutputStream

an OutputStream