Top Description Fields Constructors Methods
org.bouncycastle.cert

public Class X509ExtensionUtils

extends Object
Class Inheritance
Known Direct Subclasses
org.bouncycastle.cert.jcajce.JcaX509ExtensionUtils
Imports
java.io.IOException, .OutputStream, java.math.BigInteger, org.bouncycastle.asn1.ASN1OctetString, org.bouncycastle.asn1.x509.AuthorityKeyIdentifier, .Extension, .GeneralName, .GeneralNames, .SubjectKeyIdentifier, .SubjectPublicKeyInfo, org.bouncycastle.operator.DigestCalculator

General utility class for creating calculated extensions using the standard methods.

Note

This class is not thread safe!

Field Summary

Modifier and TypeField and Description
private DigestCalculator

Constructor Summary

AccessConstructor and Description
public
X509ExtensionUtils(DigestCalculator
a calculator for calculating subject key ids.
calculator
)

Base constructor - for conformance to RFC 5280 use a calculator based on SHA-1.

Method Summary

Modifier and TypeMethod and Description
private byte[]
public AuthorityKeyIdentifier

Returns:

an AuthorityKeyIdentifier.
createAuthorityKeyIdentifier
(X509CertificateHolder
the issuer certificate that the AuthorityKeyIdentifier should refer to.
certHolder
)

Create an AuthorityKeyIdentifier from the passed in arguments.

public AuthorityKeyIdentifier

Returns:

an AuthorityKeyIdentifier.
createAuthorityKeyIdentifier
(SubjectPublicKeyInfo
the SubjectPublicKeyInfo to base the key identifier on.
publicKeyInfo
)

Create an AuthorityKeyIdentifier from the passed in SubjectPublicKeyInfo.

public AuthorityKeyIdentifier

Returns:

an AuthorityKeyIdentifier.
createAuthorityKeyIdentifier
(SubjectPublicKeyInfo
the SubjectPublicKeyInfo to base the key identifier on.
publicKeyInfo
,
GeneralNames
the general names to associate with the issuer cert's issuer.
generalNames
,
BigInteger
the serial number of the issuer cert.
serial
)

Create an AuthorityKeyIdentifier from the passed in arguments.

public SubjectKeyIdentifier

Returns:

the key identifier.
createSubjectKeyIdentifier
(SubjectPublicKeyInfo
the key info object containing the subjectPublicKey field.
publicKeyInfo
)

Return a RFC 5280 type 1 key identifier.

public SubjectKeyIdentifier

Returns:

the key identifier.
createTruncatedSubjectKeyIdentifier
(SubjectPublicKeyInfo
the key info object containing the subjectPublicKey field.
publicKeyInfo
)

Return a RFC 5280 type 2 key identifier.

private byte[]
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

calculatorback to summary
private DigestCalculator calculator

Constructor Detail

X509ExtensionUtilsback to summary
public X509ExtensionUtils(DigestCalculator calculator)

Base constructor - for conformance to RFC 5280 use a calculator based on SHA-1.

Parameters
calculator:DigestCalculator

a calculator for calculating subject key ids.

Method Detail

calculateIdentifierback to summary
private byte[] calculateIdentifier(SubjectPublicKeyInfo publicKeyInfo)
createAuthorityKeyIdentifierback to summary
public AuthorityKeyIdentifier createAuthorityKeyIdentifier(X509CertificateHolder certHolder)

Create an AuthorityKeyIdentifier from the passed in arguments.

Parameters
certHolder:X509CertificateHolder

the issuer certificate that the AuthorityKeyIdentifier should refer to.

Returns:AuthorityKeyIdentifier

an AuthorityKeyIdentifier.

createAuthorityKeyIdentifierback to summary
public AuthorityKeyIdentifier createAuthorityKeyIdentifier(SubjectPublicKeyInfo publicKeyInfo)

Create an AuthorityKeyIdentifier from the passed in SubjectPublicKeyInfo.

Parameters
publicKeyInfo:SubjectPublicKeyInfo

the SubjectPublicKeyInfo to base the key identifier on.

Returns:AuthorityKeyIdentifier

an AuthorityKeyIdentifier.

createAuthorityKeyIdentifierback to summary
public AuthorityKeyIdentifier createAuthorityKeyIdentifier(SubjectPublicKeyInfo publicKeyInfo, GeneralNames generalNames, BigInteger serial)

Create an AuthorityKeyIdentifier from the passed in arguments.

Parameters
publicKeyInfo:SubjectPublicKeyInfo

the SubjectPublicKeyInfo to base the key identifier on.

generalNames:GeneralNames

the general names to associate with the issuer cert's issuer.

serial:BigInteger

the serial number of the issuer cert.

Returns:AuthorityKeyIdentifier

an AuthorityKeyIdentifier.

createSubjectKeyIdentifierback to summary
public SubjectKeyIdentifier createSubjectKeyIdentifier(SubjectPublicKeyInfo publicKeyInfo)

Return a RFC 5280 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
publicKeyInfo:SubjectPublicKeyInfo

the key info object containing the subjectPublicKey field.

Returns:SubjectKeyIdentifier

the key identifier.

createTruncatedSubjectKeyIdentifierback to summary
public SubjectKeyIdentifier createTruncatedSubjectKeyIdentifier(SubjectPublicKeyInfo publicKeyInfo)

Return a RFC 5280 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
publicKeyInfo:SubjectPublicKeyInfo

the key info object containing the subjectPublicKey field.

Returns:SubjectKeyIdentifier

the key identifier.

getSubjectKeyIdentifierback to summary
private byte[] getSubjectKeyIdentifier(X509CertificateHolder certHolder)