public final class PemX509Certificate extends java.security.cert.X509Certificate implements PemEncoded
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),
Serialized Form| Modifier and Type | Field and Description |
|---|---|
private static byte[] |
BEGIN_CERT |
private ByteBuf |
content |
private static byte[] |
END_CERT |
| Modifier | Constructor and Description |
|---|---|
private |
PemX509Certificate(ByteBuf content) |
| Modifier and Type | Method and Description |
|---|---|
private static ByteBuf |
append(ByteBufAllocator allocator,
boolean useDirect,
PemEncoded encoded,
int count,
ByteBuf pem)
Appends the
PemEncoded value to the ByteBuf (last arg) and returns it. |
private static ByteBuf |
append(ByteBufAllocator allocator,
boolean useDirect,
java.security.cert.X509Certificate cert,
int count,
ByteBuf pem)
Appends the
X509Certificate value to the ByteBuf (last arg) and returns it. |
void |
checkValidity() |
void |
checkValidity(java.util.Date date) |
ByteBuf |
content()
Return the data which is held by this
ByteBufHolder. |
PemX509Certificate |
copy()
Creates a deep copy of this
ByteBufHolder. |
PemX509Certificate |
duplicate()
Duplicates this
ByteBufHolder. |
boolean |
equals(java.lang.Object o) |
int |
getBasicConstraints() |
java.util.Set<java.lang.String> |
getCriticalExtensionOIDs() |
byte[] |
getEncoded() |
byte[] |
getExtensionValue(java.lang.String oid) |
java.security.Principal |
getIssuerDN() |
boolean[] |
getIssuerUniqueID() |
boolean[] |
getKeyUsage() |
java.util.Set<java.lang.String> |
getNonCriticalExtensionOIDs() |
java.util.Date |
getNotAfter() |
java.util.Date |
getNotBefore() |
java.security.PublicKey |
getPublicKey() |
java.math.BigInteger |
getSerialNumber() |
java.lang.String |
getSigAlgName() |
java.lang.String |
getSigAlgOID() |
byte[] |
getSigAlgParams() |
byte[] |
getSignature() |
java.security.Principal |
getSubjectDN() |
boolean[] |
getSubjectUniqueID() |
byte[] |
getTBSCertificate() |
int |
getVersion() |
int |
hashCode() |
boolean |
hasUnsupportedCriticalExtension() |
boolean |
isSensitive()
Returns
true if the PEM encoded value is considered
sensitive information such as a private key. |
private static ByteBuf |
newBuffer(ByteBufAllocator allocator,
boolean useDirect,
int initialCapacity) |
int |
refCnt()
Returns the reference count of this object.
|
boolean |
release()
Decreases the reference count by
1 and deallocates this object if the reference count reaches at
0. |
boolean |
release(int decrement)
Decreases the reference count by the specified
decrement and deallocates this object if the reference
count reaches at 0. |
PemX509Certificate |
replace(ByteBuf content)
Returns a new
ByteBufHolder which contains the specified content. |
PemX509Certificate |
retain()
Increases the reference count by
1. |
PemX509Certificate |
retain(int increment)
Increases the reference count by the specified
increment. |
PemX509Certificate |
retainedDuplicate()
Duplicates this
ByteBufHolder. |
(package private) static PemEncoded |
toPEM(ByteBufAllocator allocator,
boolean useDirect,
java.security.cert.X509Certificate... chain)
Creates a
PemEncoded value from the X509Certificates. |
java.lang.String |
toString() |
PemX509Certificate |
touch()
Records the current access location of this object for debugging purposes.
|
PemX509Certificate |
touch(java.lang.Object hint)
Records the current access location of this object with an additional arbitrary information for debugging
purposes.
|
static PemX509Certificate |
valueOf(byte[] key)
Creates a
PemX509Certificate from raw byte[]. |
static PemX509Certificate |
valueOf(ByteBuf key)
Creates a
PemX509Certificate from raw ByteBuf. |
void |
verify(java.security.PublicKey key) |
void |
verify(java.security.PublicKey key,
java.lang.String sigProvider) |
private static final byte[] BEGIN_CERT
private static final byte[] END_CERT
private final ByteBuf content
private PemX509Certificate(ByteBuf content)
static PemEncoded toPEM(ByteBufAllocator allocator, boolean useDirect, java.security.cert.X509Certificate... chain) throws java.security.cert.CertificateEncodingException
PemEncoded value from the X509Certificates.java.security.cert.CertificateEncodingExceptionprivate static ByteBuf append(ByteBufAllocator allocator, boolean useDirect, PemEncoded encoded, int count, ByteBuf pem)
PemEncoded value to the ByteBuf (last arg) and returns it.
If the ByteBuf didn't exist yet it'll create it using the ByteBufAllocator.private static ByteBuf append(ByteBufAllocator allocator, boolean useDirect, java.security.cert.X509Certificate cert, int count, ByteBuf pem) throws java.security.cert.CertificateEncodingException
X509Certificate value to the ByteBuf (last arg) and returns it.
If the ByteBuf didn't exist yet it'll create it using the ByteBufAllocator.java.security.cert.CertificateEncodingExceptionprivate static ByteBuf newBuffer(ByteBufAllocator allocator, boolean useDirect, int initialCapacity)
public static PemX509Certificate valueOf(byte[] key)
PemX509Certificate from raw byte[].
ATTENTION: It's assumed that the given argument is a PEM/PKCS#8 encoded value.
No input validation is performed to validate it.public static PemX509Certificate valueOf(ByteBuf key)
PemX509Certificate from raw ByteBuf.
ATTENTION: It's assumed that the given argument is a PEM/PKCS#8 encoded value.
No input validation is performed to validate it.public boolean isSensitive()
PemEncodedtrue if the PEM encoded value is considered
sensitive information such as a private key.isSensitive in interface PemEncodedpublic int refCnt()
ReferenceCounted0, it means this object has been deallocated.refCnt in interface ReferenceCountedpublic ByteBuf content()
ByteBufHolderByteBufHolder.content in interface ByteBufHolderpublic PemX509Certificate copy()
ByteBufHolderByteBufHolder.copy in interface ByteBufHoldercopy in interface PemEncodedpublic PemX509Certificate duplicate()
ByteBufHolderByteBufHolder. Be aware that this will not automatically call ByteBufHolder.retain().duplicate in interface ByteBufHolderduplicate in interface PemEncodedpublic PemX509Certificate retainedDuplicate()
ByteBufHolderByteBufHolder. This method returns a retained duplicate unlike ByteBufHolder.duplicate().retainedDuplicate in interface ByteBufHolderretainedDuplicate in interface PemEncodedByteBuf.retainedDuplicate()public PemX509Certificate replace(ByteBuf content)
ByteBufHolderByteBufHolder which contains the specified content.replace in interface ByteBufHolderreplace in interface PemEncodedpublic PemX509Certificate retain()
ReferenceCounted1.retain in interface ByteBufHolderretain in interface PemEncodedretain in interface ReferenceCountedpublic PemX509Certificate retain(int increment)
ReferenceCountedincrement.retain in interface ByteBufHolderretain in interface PemEncodedretain in interface ReferenceCountedpublic PemX509Certificate touch()
ReferenceCountedResourceLeakDetector. This method is a shortcut to touch(null).touch in interface ByteBufHoldertouch in interface PemEncodedtouch in interface ReferenceCountedpublic PemX509Certificate touch(java.lang.Object hint)
ReferenceCountedResourceLeakDetector.touch in interface ByteBufHoldertouch in interface PemEncodedtouch in interface ReferenceCountedpublic boolean release()
ReferenceCounted1 and deallocates this object if the reference count reaches at
0.release in interface ReferenceCountedtrue if and only if the reference count became 0 and this object has been deallocatedpublic boolean release(int decrement)
ReferenceCounteddecrement and deallocates this object if the reference
count reaches at 0.release in interface ReferenceCountedtrue if and only if the reference count became 0 and this object has been deallocatedpublic byte[] getEncoded()
getEncoded in class java.security.cert.Certificatepublic boolean hasUnsupportedCriticalExtension()
hasUnsupportedCriticalExtension in interface java.security.cert.X509Extensionpublic java.util.Set<java.lang.String> getCriticalExtensionOIDs()
getCriticalExtensionOIDs in interface java.security.cert.X509Extensionpublic java.util.Set<java.lang.String> getNonCriticalExtensionOIDs()
getNonCriticalExtensionOIDs in interface java.security.cert.X509Extensionpublic byte[] getExtensionValue(java.lang.String oid)
getExtensionValue in interface java.security.cert.X509Extensionpublic void checkValidity()
checkValidity in class java.security.cert.X509Certificatepublic void checkValidity(java.util.Date date)
checkValidity in class java.security.cert.X509Certificatepublic int getVersion()
getVersion in class java.security.cert.X509Certificatepublic java.math.BigInteger getSerialNumber()
getSerialNumber in class java.security.cert.X509Certificatepublic java.security.Principal getIssuerDN()
getIssuerDN in class java.security.cert.X509Certificatepublic java.security.Principal getSubjectDN()
getSubjectDN in class java.security.cert.X509Certificatepublic java.util.Date getNotBefore()
getNotBefore in class java.security.cert.X509Certificatepublic java.util.Date getNotAfter()
getNotAfter in class java.security.cert.X509Certificatepublic byte[] getTBSCertificate()
getTBSCertificate in class java.security.cert.X509Certificatepublic byte[] getSignature()
getSignature in class java.security.cert.X509Certificatepublic java.lang.String getSigAlgName()
getSigAlgName in class java.security.cert.X509Certificatepublic java.lang.String getSigAlgOID()
getSigAlgOID in class java.security.cert.X509Certificatepublic byte[] getSigAlgParams()
getSigAlgParams in class java.security.cert.X509Certificatepublic boolean[] getIssuerUniqueID()
getIssuerUniqueID in class java.security.cert.X509Certificatepublic boolean[] getSubjectUniqueID()
getSubjectUniqueID in class java.security.cert.X509Certificatepublic boolean[] getKeyUsage()
getKeyUsage in class java.security.cert.X509Certificatepublic int getBasicConstraints()
getBasicConstraints in class java.security.cert.X509Certificatepublic void verify(java.security.PublicKey key)
verify in class java.security.cert.Certificatepublic void verify(java.security.PublicKey key,
java.lang.String sigProvider)
verify in class java.security.cert.Certificatepublic java.security.PublicKey getPublicKey()
getPublicKey in class java.security.cert.Certificatepublic boolean equals(java.lang.Object o)
equals in class java.security.cert.Certificatepublic int hashCode()
hashCode in class java.security.cert.Certificatepublic java.lang.String toString()
toString in class java.security.cert.Certificate