X509Certificate which allows
the user to pass PEM/PKCS#8 encoded data straight into OpenSslContext without
having to parse and re-encode bytes in Java land.
All methods other than what's implemented in PemEncoded's throw
UnsupportedOperationExceptions.
PemEncoded, OpenSslContext, valueOf(byte[]), valueOf(ByteBuf)
| Modifier and Type | Field and Description |
|---|---|
| private static final byte[] | |
| private final ByteBuf | |
| private static final byte[] |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| private static ByteBuf | append(ByteBufAllocator allocator, boolean useDirect, PemEncoded encoded, int count, ByteBuf pem)
Appends the |
| private static ByteBuf | append(ByteBufAllocator allocator, boolean useDirect, X509Certificate cert, int count, ByteBuf pem)
Appends the |
| public void | checkValidity()
Implements abstract java. |
| public void | checkValidity(Date
the Date to check against to see if this certificate
is valid at that date/time. date)Implements abstract java. |
| public ByteBuf | content()
Implements io. ByteBufHolder.
|
| public PemX509Certificate | |
| public PemX509Certificate | |
| public boolean | equals(Object
the object to test for equality with this certificate. o)Overrides java. |
| public int | getBasicConstraints()
Implements abstract java. BasicConstraints extension, (OID = 2.5.29.19).
|
| public Set | getCriticalExtensionOIDs()
Implements java. |
| public byte[] | getEncoded()
Implements abstract java. |
| public byte[] | getExtensionValue(String
the Object Identifier value for the extension. oid)Implements java. oid
String.
|
| public Principal | getIssuerDN()
Implements abstract java. issuer (issuer distinguished name) value from
the certificate.
|
| public boolean[] | getIssuerUniqueID()
Implements abstract java. issuerUniqueID value from the certificate.
|
| public boolean[] | getKeyUsage()
Implements abstract java. KeyUsage extension, (OID = 2.5.29.15).
|
| public Set | getNonCriticalExtensionOIDs()
Implements java. |
| public Date | getNotAfter()
Implements abstract java. notAfter date from the validity period of
the certificate.
|
| public Date | getNotBefore()
Implements abstract java. notBefore date from the validity period of
the certificate.
|
| public PublicKey | getPublicKey()
Implements abstract java. |
| public BigInteger | getSerialNumber()
Implements abstract java. serialNumber value from the certificate.
|
| public String | getSigAlgName()
Implements abstract java. |
| public String | getSigAlgOID()
Implements abstract java. |
| public byte[] | getSigAlgParams()
Implements abstract java. |
| public byte[] | getSignature()
Implements abstract java. signature value (the raw signature bits) from
the certificate.
|
| public Principal | getSubjectDN()
Implements abstract java. subject (subject distinguished name) value
from the certificate.
|
| public boolean[] | getSubjectUniqueID()
Implements abstract java. subjectUniqueID value from the certificate.
|
| public byte[] | getTBSCertificate()
Implements abstract java. tbsCertificate from this certificate.
|
| public int | getVersion()
Implements abstract java. version (version number) value from the
certificate.
|
| public int | hashCode()
Overrides java. |
| public boolean | hasUnsupportedCriticalExtension()
Implements java. |
| public boolean | isSensitive()
Implements io. true if the PEM encoded value is considered
sensitive information such as a private key.
|
| private static ByteBuf | |
| public int | refCnt()
Implements io. |
| public boolean | release()
Implements io. 1 and deallocates this object if the reference count reaches at
0.
|
| public boolean | release(int decrement)
Implements io. decrement and deallocates this object if the reference
count reaches at 0.
|
| public PemX509Certificate | replace(ByteBuf content)
Implements io. ByteBufHolder which contains the specified content.
|
| public PemX509Certificate | |
| public PemX509Certificate | retain(int increment)
Implements io. increment.
|
| public PemX509Certificate | retainedDuplicate()
Implements io. ByteBufHolder.
|
| pack-priv static PemEncoded | toPEM(ByteBufAllocator allocator, boolean useDirect, X509Certificate... chain)
Creates a |
| public String | toString()
Implements abstract java. |
| public PemX509Certificate | touch()
Implements io. |
| public PemX509Certificate | touch(Object hint)
Implements io. |
| public static PemX509Certificate | |
| public static PemX509Certificate | |
| public void | verify(PublicKey
the PublicKey used to carry out the verification. key)Implements abstract java. |
| public void | verify(PublicKey
the PublicKey used to carry out the verification. key, String the name of the signature provider. sigProvider)Implements abstract java. |
| BEGIN_CERT | back to summary |
|---|---|
| private static final byte[] BEGIN_CERT | |
| content | back to summary |
|---|---|
| private final ByteBuf content | |
| END_CERT | back to summary |
|---|---|
| private static final byte[] END_CERT | |
| PemX509Certificate | back to summary |
|---|---|
| private PemX509Certificate(ByteBuf content) | |
| append | back to summary |
|---|---|
| private static ByteBuf append(ByteBufAllocator allocator, boolean useDirect, PemEncoded encoded, int count, ByteBuf pem) Appends the | |
| append | back to summary |
|---|---|
| private static ByteBuf append(ByteBufAllocator allocator, boolean useDirect, X509Certificate cert, int count, ByteBuf pem) throws CertificateEncodingException Appends the | |
| checkValidity | back to summary |
|---|---|
| public void checkValidity() Implements abstract java. Doc from java. Checks that the certificate is currently valid. It is if the current date and time are within the validity period given in the certificate. The validity period consists of two date/time values: the first and last dates (and times) on which the certificate is valid. It is defined in ASN.1 as:
validity Validity
Validity ::= SEQUENCE {
notBefore CertificateValidityDate,
notAfter CertificateValidityDate }
CertificateValidityDate ::= CHOICE {
utcTime UTCTime,
generalTime GeneralizedTime }
| |
| checkValidity | back to summary |
|---|---|
| public void checkValidity(Date date) Implements abstract java. Doc from java. Checks that the given date is within the certificate's validity period. In other words, this determines whether the certificate would be valid at the given date/time. | |
| content | back to summary |
|---|---|
| public ByteBuf content() Implements io. Doc from io. Return the data which is held by this
| |
| copy | back to summary |
|---|---|
| public PemX509Certificate copy() Implements io. Doc from io. Creates a deep copy of this
| |
| duplicate | back to summary |
|---|---|
| public PemX509Certificate duplicate() Implements io. Doc from io. Duplicates this
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object o) Overrides java. Doc from java. Compares this certificate for equality with the specified
object. If the | |
| getBasicConstraints | back to summary |
|---|---|
| public int getBasicConstraints() Implements abstract java. Doc from java. Gets the certificate constraints path length from the
critical
The basic constraints extension identifies whether the subject
of the certificate is a Certificate Authority (CA) and
how deep a certification path may exist through that CA. The
The ASN.1 definition for this is:
BasicConstraints ::= SEQUENCE {
cA BOOLEAN DEFAULT FALSE,
pathLenConstraint INTEGER (0..MAX) OPTIONAL }
| |
| getCriticalExtensionOIDs | back to summary |
|---|---|
| public Set Implements java. Doc from java. Gets a Set of the OID strings for the extension(s) marked CRITICAL in the certificate/CRL managed by the object implementing this interface. Here is sample code to get a Set of critical extensions from an X509Certificate and print the OIDs:
| |
| getEncoded | back to summary |
|---|---|
| public byte[] getEncoded() Implements abstract java. Doc from java. Returns the encoded form of this certificate. It is assumed that each certificate type would have only a single form of encoding; for example, X.509 certificates would be encoded as ASN.1 DER.
| |
| getExtensionValue | back to summary | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| public byte[] getExtensionValue(String oid) Implements java. Doc from java. Gets the DER-encoded OCTET string for the extension value
(extnValue) identified by the passed-in For example:
| |||||||||||||||||||||||
| getIssuerDN | back to summary |
|---|---|
| public Principal getIssuerDN() Implements abstract java. Doc from java. Gets the The issuer name field contains an X.500 distinguished name (DN). The ASN.1 definition for this is:
issuer Name
Name ::= CHOICE { RDNSequence }
RDNSequence ::= SEQUENCE OF RelativeDistinguishedName
RelativeDistinguishedName ::=
SET OF AttributeValueAssertion
AttributeValueAssertion ::= SEQUENCE {
AttributeType,
AttributeValue }
AttributeType ::= OBJECT IDENTIFIER
AttributeValue ::= ANY
The Name describes a hierarchical name composed of
attributes,
such as country name, and corresponding values, such as US.
The type of the AttributeValue component is determined by
the AttributeType; in general it will be a
directoryString. A directoryString is usually
one of PrintableString,
TeletexString or UniversalString.
| |
| getIssuerUniqueID | back to summary |
|---|---|
| public boolean[] getIssuerUniqueID() Implements abstract java. Doc from java. Gets the The ASN.1 definition for this is: issuerUniqueID [1] IMPLICIT UniqueIdentifier OPTIONAL UniqueIdentifier ::= BIT STRING
| |
| getKeyUsage | back to summary |
|---|---|
| public boolean[] getKeyUsage() Implements abstract java. Doc from java. Gets a boolean array representing bits of
the
KeyUsage ::= BIT STRING {
digitalSignature (0),
nonRepudiation (1),
keyEncipherment (2),
dataEncipherment (3),
keyAgreement (4),
keyCertSign (5),
cRLSign (6),
encipherOnly (7),
decipherOnly (8) }
RFC 5280 recommends that when used, this be marked
as a critical extension.
| |
| getNonCriticalExtensionOIDs | back to summary |
|---|---|
| public Set Implements java. Doc from java. Gets a Set of the OID strings for the extension(s) marked NON-CRITICAL in the certificate/CRL managed by the object implementing this interface. Here is sample code to get a Set of non-critical extensions from an X509CRL revoked certificate entry and print the OIDs:
| |
| getNotAfter | back to summary |
|---|---|
| public Date getNotAfter() Implements abstract java. Doc from java. Gets the | |
| getNotBefore | back to summary |
|---|---|
| public Date getNotBefore() Implements abstract java. Doc from java. Gets the
validity Validity
Validity ::= SEQUENCE {
notBefore CertificateValidityDate,
notAfter CertificateValidityDate }
CertificateValidityDate ::= CHOICE {
utcTime UTCTime,
generalTime GeneralizedTime }
| |
| getPublicKey | back to summary |
|---|---|
| public PublicKey getPublicKey() Implements abstract java. Doc from java. Gets the public key from this certificate. | |
| getSerialNumber | back to summary |
|---|---|
| public BigInteger getSerialNumber() Implements abstract java. Doc from java. Gets the serialNumber CertificateSerialNumber CertificateSerialNumber ::= INTEGER
| |
| getSigAlgName | back to summary |
|---|---|
| public String getSigAlgName() Implements abstract java. Doc from java. Gets the signature algorithm name for the certificate signature algorithm. An example is the string "SHA256withRSA". The ASN.1 definition for this is:
signatureAlgorithm AlgorithmIdentifier
AlgorithmIdentifier ::= SEQUENCE {
algorithm OBJECT IDENTIFIER,
parameters ANY DEFINED BY algorithm OPTIONAL }
-- contains a value of the type
-- registered for use with the
-- algorithm object identifier value
The algorithm name is determined from the | |
| getSigAlgOID | back to summary |
|---|---|
| public String getSigAlgOID() Implements abstract java. Doc from java. Gets the signature algorithm OID string from the certificate. An OID is represented by a set of nonnegative whole numbers separated by periods. For example, the string "1.2.840.10040.4.3" identifies the SHA-1 with DSA signature algorithm defined in RFC 3279: Algorithms and Identifiers for the Internet X.509 Public Key Infrastructure Certificate and CRL Profile. See | |
| getSigAlgParams | back to summary |
|---|---|
| public byte[] getSigAlgParams() Implements abstract java. Doc from java. Gets the DER-encoded signature algorithm parameters from this
certificate's signature algorithm. In most cases, the signature
algorithm parameters are null; the parameters are usually
supplied with the certificate's public key.
If access to individual parameter values is needed then use
See
| |
| getSignature | back to summary |
|---|---|
| public byte[] getSignature() Implements abstract java. Doc from java. Gets the signature BIT STRING
| |
| getSubjectDN | back to summary |
|---|---|
| public Principal getSubjectDN() Implements abstract java. Doc from java. Gets the The ASN.1 definition for this is: subject Name See | |
| getSubjectUniqueID | back to summary |
|---|---|
| public boolean[] getSubjectUniqueID() Implements abstract java. Doc from java. Gets the The ASN.1 definition for this is: subjectUniqueID [2] IMPLICIT UniqueIdentifier OPTIONAL UniqueIdentifier ::= BIT STRING
| |
| getTBSCertificate | back to summary |
|---|---|
| public byte[] getTBSCertificate() Implements abstract java. Doc from java. Gets the DER-encoded certificate information, the
| |
| getVersion | back to summary |
|---|---|
| public int getVersion() Implements abstract java. Doc from java. Gets the
version [0] EXPLICIT Version DEFAULT v1
Version ::= INTEGER { v1(0), v2(1), v3(2) }
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns the hashcode value for this certificate from its encoded form.
| |
| hasUnsupportedCriticalExtension | back to summary |
|---|---|
| public boolean hasUnsupportedCriticalExtension() Implements java. Doc from java. Check if there is a critical extension that is not supported.
| |
| isSensitive | back to summary |
|---|---|
| public boolean isSensitive() Implements io. Doc from io. Returns
| |
| newBuffer | back to summary |
|---|---|
| private static ByteBuf newBuffer(ByteBufAllocator allocator, boolean useDirect, int initialCapacity) | |
| refCnt | back to summary |
|---|---|
| public int refCnt() Implements io. Doc from io. Returns the reference count of this object. If
| |
| release | back to summary |
|---|---|
| public boolean release() Implements io. Doc from io. Decreases the reference count by
| |
| release | back to summary |
|---|---|
| public boolean release(int decrement) Implements io. Doc from io. Decreases the reference count by the specified
| |
| replace | back to summary |
|---|---|
| public PemX509Certificate replace(ByteBuf content) Implements io. Doc from io. Returns a new
| |
| retain | back to summary |
|---|---|
| public PemX509Certificate retain() Implements io. Doc from io. Increases the reference count by
| |
| retain | back to summary |
|---|---|
| public PemX509Certificate retain(int increment) Implements io. Doc from io. Increases the reference count by the specified
| |
| retainedDuplicate | back to summary |
|---|---|
| public PemX509Certificate retainedDuplicate() Implements io. Doc from io. Duplicates this
| |
| toPEM | back to summary |
|---|---|
| pack-priv static PemEncoded toPEM(ByteBufAllocator allocator, boolean useDirect, X509Certificate... chain) throws CertificateEncodingException Creates a | |
| toString | back to summary |
|---|---|
| public String toString() Implements abstract java. Doc from java. Returns a string representation of this certificate. | |
| touch | back to summary |
|---|---|
| public PemX509Certificate touch() Implements io. Doc from io. Records the current access location of this object for debugging purposes.
If this object is determined to be leaked, the information recorded by this operation will be provided to you
via
| |
| touch | back to summary |
|---|---|
| public PemX509Certificate touch(Object hint) Implements io. Doc from io. Records the current access location of this object with an additional arbitrary information for debugging
purposes. If this object is determined to be leaked, the information recorded by this operation will be
provided to you via
| |
| valueOf | back to summary |
|---|---|
| public static PemX509Certificate valueOf(byte[] key) Creates a | |
| valueOf | back to summary |
|---|---|
| public static PemX509Certificate valueOf(ByteBuf key) Creates a | |
| verify | back to summary |
|---|---|
| public void verify(PublicKey key) Implements abstract java. Doc from java. Verifies that this certificate was signed using the private key that corresponds to the specified public key. | |
| verify | back to summary |
|---|---|
| public void verify(PublicKey key, String sigProvider) Implements abstract java. Doc from java. Verifies that this certificate was signed using the private key that corresponds to the specified public key. This method uses the signature verification engine supplied by the specified provider. | |