Package io.netty.handler.ssl
Class PemX509Certificate
- java.lang.Object
-
- java.security.cert.Certificate
-
- java.security.cert.X509Certificate
-
- io.netty.handler.ssl.PemX509Certificate
-
- All Implemented Interfaces:
ByteBufHolder
,ReferenceCounted
,Serializable
,X509Extension
public final class PemX509Certificate extends X509Certificate
This is a special purpose implementation of aX509Certificate
which allows the user to pass PEM/PKCS#8 encoded data straight intoOpenSslContext
without having to parse and re-encode bytes in Java land. All methods other than what's implemented inPemEncoded
's throwUnsupportedOperationException
s.- See Also:
PemEncoded
,OpenSslContext
,valueOf(byte[])
,valueOf(ByteBuf)
, Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.security.cert.Certificate
Certificate.CertificateRep
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkValidity()
void
checkValidity(Date date)
ByteBuf
content()
Return the data which is held by thisByteBufHolder
.PemX509Certificate
copy()
Creates a deep copy of thisByteBufHolder
.PemX509Certificate
duplicate()
Duplicates thisByteBufHolder
.boolean
equals(Object o)
int
getBasicConstraints()
Set<String>
getCriticalExtensionOIDs()
byte[]
getEncoded()
byte[]
getExtensionValue(String oid)
Principal
getIssuerDN()
boolean[]
getIssuerUniqueID()
boolean[]
getKeyUsage()
Set<String>
getNonCriticalExtensionOIDs()
Date
getNotAfter()
Date
getNotBefore()
PublicKey
getPublicKey()
BigInteger
getSerialNumber()
String
getSigAlgName()
String
getSigAlgOID()
byte[]
getSigAlgParams()
byte[]
getSignature()
Principal
getSubjectDN()
boolean[]
getSubjectUniqueID()
byte[]
getTBSCertificate()
int
getVersion()
int
hashCode()
boolean
hasUnsupportedCriticalExtension()
boolean
isSensitive()
int
refCnt()
Returns the reference count of this object.boolean
release()
Decreases the reference count by1
and deallocates this object if the reference count reaches at0
.boolean
release(int decrement)
Decreases the reference count by the specifieddecrement
and deallocates this object if the reference count reaches at0
.PemX509Certificate
replace(ByteBuf content)
Returns a newByteBufHolder
which contains the specifiedcontent
.PemX509Certificate
retain()
Increases the reference count by1
.PemX509Certificate
retain(int increment)
Increases the reference count by the specifiedincrement
.PemX509Certificate
retainedDuplicate()
Duplicates thisByteBufHolder
.String
toString()
PemX509Certificate
touch()
Records the current access location of this object for debugging purposes.PemX509Certificate
touch(Object hint)
Records the current access location of this object with an additional arbitrary information for debugging purposes.static PemX509Certificate
valueOf(byte[] key)
Creates aPemX509Certificate
from rawbyte[]
.static PemX509Certificate
valueOf(ByteBuf key)
Creates aPemX509Certificate
from rawByteBuf
.void
verify(PublicKey key)
void
verify(PublicKey key, String sigProvider)
-
Methods inherited from class java.security.cert.X509Certificate
getExtendedKeyUsage, getIssuerAlternativeNames, getIssuerX500Principal, getSubjectAlternativeNames, getSubjectX500Principal, verify
-
Methods inherited from class java.security.cert.Certificate
getType, writeReplace
-
-
-
-
Method Detail
-
valueOf
public static PemX509Certificate valueOf(byte[] key)
Creates aPemX509Certificate
from rawbyte[]
. ATTENTION: It's assumed that the given argument is a PEM/PKCS#8 encoded value. No input validation is performed to validate it.
-
valueOf
public static PemX509Certificate valueOf(ByteBuf key)
Creates aPemX509Certificate
from rawByteBuf
. ATTENTION: It's assumed that the given argument is a PEM/PKCS#8 encoded value. No input validation is performed to validate it.
-
isSensitive
public boolean isSensitive()
-
refCnt
public int refCnt()
Description copied from interface:ReferenceCounted
Returns the reference count of this object. If0
, it means this object has been deallocated.- Specified by:
refCnt
in interfaceReferenceCounted
-
content
public ByteBuf content()
Description copied from interface:ByteBufHolder
Return the data which is held by thisByteBufHolder
.- Specified by:
content
in interfaceByteBufHolder
-
copy
public PemX509Certificate copy()
Description copied from interface:ByteBufHolder
Creates a deep copy of thisByteBufHolder
.- Specified by:
copy
in interfaceByteBufHolder
-
duplicate
public PemX509Certificate duplicate()
Description copied from interface:ByteBufHolder
Duplicates thisByteBufHolder
. Be aware that this will not automatically callByteBufHolder.retain()
.- Specified by:
duplicate
in interfaceByteBufHolder
-
retainedDuplicate
public PemX509Certificate retainedDuplicate()
Description copied from interface:ByteBufHolder
Duplicates thisByteBufHolder
. This method returns a retained duplicate unlikeByteBufHolder.duplicate()
.- Specified by:
retainedDuplicate
in interfaceByteBufHolder
- See Also:
ByteBuf.retainedDuplicate()
-
replace
public PemX509Certificate replace(ByteBuf content)
Description copied from interface:ByteBufHolder
Returns a newByteBufHolder
which contains the specifiedcontent
.- Specified by:
replace
in interfaceByteBufHolder
-
retain
public PemX509Certificate retain()
Description copied from interface:ReferenceCounted
Increases the reference count by1
.- Specified by:
retain
in interfaceByteBufHolder
- Specified by:
retain
in interfaceReferenceCounted
-
retain
public PemX509Certificate retain(int increment)
Description copied from interface:ReferenceCounted
Increases the reference count by the specifiedincrement
.- Specified by:
retain
in interfaceByteBufHolder
- Specified by:
retain
in interfaceReferenceCounted
-
touch
public PemX509Certificate touch()
Description copied from interface:ReferenceCounted
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 viaResourceLeakDetector
. This method is a shortcut totouch(null)
.- Specified by:
touch
in interfaceByteBufHolder
- Specified by:
touch
in interfaceReferenceCounted
-
touch
public PemX509Certificate touch(Object hint)
Description copied from interface:ReferenceCounted
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 viaResourceLeakDetector
.- Specified by:
touch
in interfaceByteBufHolder
- Specified by:
touch
in interfaceReferenceCounted
-
release
public boolean release()
Description copied from interface:ReferenceCounted
Decreases the reference count by1
and deallocates this object if the reference count reaches at0
.- Specified by:
release
in interfaceReferenceCounted
- Returns:
true
if and only if the reference count became0
and this object has been deallocated
-
release
public boolean release(int decrement)
Description copied from interface:ReferenceCounted
Decreases the reference count by the specifieddecrement
and deallocates this object if the reference count reaches at0
.- Specified by:
release
in interfaceReferenceCounted
- Returns:
true
if and only if the reference count became0
and this object has been deallocated
-
getEncoded
public byte[] getEncoded()
- Specified by:
getEncoded
in classCertificate
-
hasUnsupportedCriticalExtension
public boolean hasUnsupportedCriticalExtension()
- Specified by:
hasUnsupportedCriticalExtension
in interfaceX509Extension
-
getCriticalExtensionOIDs
public Set<String> getCriticalExtensionOIDs()
- Specified by:
getCriticalExtensionOIDs
in interfaceX509Extension
-
getNonCriticalExtensionOIDs
public Set<String> getNonCriticalExtensionOIDs()
- Specified by:
getNonCriticalExtensionOIDs
in interfaceX509Extension
-
getExtensionValue
public byte[] getExtensionValue(String oid)
- Specified by:
getExtensionValue
in interfaceX509Extension
-
checkValidity
public void checkValidity()
- Specified by:
checkValidity
in classX509Certificate
-
checkValidity
public void checkValidity(Date date)
- Specified by:
checkValidity
in classX509Certificate
-
getVersion
public int getVersion()
- Specified by:
getVersion
in classX509Certificate
-
getSerialNumber
public BigInteger getSerialNumber()
- Specified by:
getSerialNumber
in classX509Certificate
-
getIssuerDN
public Principal getIssuerDN()
- Specified by:
getIssuerDN
in classX509Certificate
-
getSubjectDN
public Principal getSubjectDN()
- Specified by:
getSubjectDN
in classX509Certificate
-
getNotBefore
public Date getNotBefore()
- Specified by:
getNotBefore
in classX509Certificate
-
getNotAfter
public Date getNotAfter()
- Specified by:
getNotAfter
in classX509Certificate
-
getTBSCertificate
public byte[] getTBSCertificate()
- Specified by:
getTBSCertificate
in classX509Certificate
-
getSignature
public byte[] getSignature()
- Specified by:
getSignature
in classX509Certificate
-
getSigAlgName
public String getSigAlgName()
- Specified by:
getSigAlgName
in classX509Certificate
-
getSigAlgOID
public String getSigAlgOID()
- Specified by:
getSigAlgOID
in classX509Certificate
-
getSigAlgParams
public byte[] getSigAlgParams()
- Specified by:
getSigAlgParams
in classX509Certificate
-
getIssuerUniqueID
public boolean[] getIssuerUniqueID()
- Specified by:
getIssuerUniqueID
in classX509Certificate
-
getSubjectUniqueID
public boolean[] getSubjectUniqueID()
- Specified by:
getSubjectUniqueID
in classX509Certificate
-
getKeyUsage
public boolean[] getKeyUsage()
- Specified by:
getKeyUsage
in classX509Certificate
-
getBasicConstraints
public int getBasicConstraints()
- Specified by:
getBasicConstraints
in classX509Certificate
-
verify
public void verify(PublicKey key)
- Specified by:
verify
in classCertificate
-
verify
public void verify(PublicKey key, String sigProvider)
- Specified by:
verify
in classCertificate
-
getPublicKey
public PublicKey getPublicKey()
- Specified by:
getPublicKey
in classCertificate
-
equals
public boolean equals(Object o)
- Overrides:
equals
in classCertificate
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classCertificate
-
toString
public String toString()
- Specified by:
toString
in classCertificate
-
-