Package io.anyline.nfc.bouncycastle.cert
Class X509ExtensionUtils
-
- All Implemented Interfaces:
public class X509ExtensionUtilsGeneral utility class for creating calculated extensions using the standard methods.
Note: This class is not thread safe!
-
-
Constructor Summary
Constructors Constructor Description X509ExtensionUtils(DigestCalculator calculator)Base constructor - for conformance to RFC 5280 use a calculator based on SHA-1.
-
Method Summary
Modifier and Type Method Description AuthorityKeyIdentifiercreateAuthorityKeyIdentifier(X509CertificateHolder certHolder)Create an AuthorityKeyIdentifier from the passed in arguments. AuthorityKeyIdentifiercreateAuthorityKeyIdentifier(SubjectPublicKeyInfo publicKeyInfo)Create an AuthorityKeyIdentifier from the passed in SubjectPublicKeyInfo. AuthorityKeyIdentifiercreateAuthorityKeyIdentifier(SubjectPublicKeyInfo publicKeyInfo, GeneralNames generalNames, BigInteger serial)Create an AuthorityKeyIdentifier from the passed in arguments. SubjectKeyIdentifiercreateSubjectKeyIdentifier(SubjectPublicKeyInfo publicKeyInfo)Return a RFC 5280 type 1 key identifier. SubjectKeyIdentifiercreateTruncatedSubjectKeyIdentifier(SubjectPublicKeyInfo publicKeyInfo)Return a RFC 5280 type 2 key identifier. -
-
Constructor Detail
-
X509ExtensionUtils
X509ExtensionUtils(DigestCalculator calculator)
Base constructor - for conformance to RFC 5280 use a calculator based on SHA-1.- Parameters:
calculator- a calculator for calculating subject key ids.
-
-
Method Detail
-
createAuthorityKeyIdentifier
AuthorityKeyIdentifier createAuthorityKeyIdentifier(X509CertificateHolder certHolder)
Create an AuthorityKeyIdentifier from the passed in arguments.
- Parameters:
certHolder- the issuer certificate that the AuthorityKeyIdentifier should refer to.- Returns:
an AuthorityKeyIdentifier.
-
createAuthorityKeyIdentifier
AuthorityKeyIdentifier createAuthorityKeyIdentifier(SubjectPublicKeyInfo publicKeyInfo)
Create an AuthorityKeyIdentifier from the passed in SubjectPublicKeyInfo.
- Parameters:
publicKeyInfo- the SubjectPublicKeyInfo to base the key identifier on.- Returns:
an AuthorityKeyIdentifier.
-
createAuthorityKeyIdentifier
AuthorityKeyIdentifier createAuthorityKeyIdentifier(SubjectPublicKeyInfo publicKeyInfo, GeneralNames generalNames, BigInteger serial)
Create an AuthorityKeyIdentifier from the passed in arguments.
- Parameters:
publicKeyInfo- the SubjectPublicKeyInfo to base the key identifier on.generalNames- the general names to associate with the issuer cert's issuer.serial- the serial number of the issuer cert.- Returns:
an AuthorityKeyIdentifier.
-
createSubjectKeyIdentifier
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- the key info object containing the subjectPublicKey field.- Returns:
the key identifier.
-
createTruncatedSubjectKeyIdentifier
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- the key info object containing the subjectPublicKey field.- Returns:
the key identifier.
-
-
-
-