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 aX509Certificatewhich allows the user to pass PEM/PKCS#8 encoded data straight intoOpenSslContextwithout having to parse and re-encode bytes in Java land. All methods other than what's implemented inPemEncoded's throwUnsupportedOperationExceptions.- 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 voidcheckValidity()voidcheckValidity(Date date)ByteBufcontent()Return the data which is held by thisByteBufHolder.PemX509Certificatecopy()Creates a deep copy of thisByteBufHolder.PemX509Certificateduplicate()Duplicates thisByteBufHolder.booleanequals(Object o)intgetBasicConstraints()Set<String>getCriticalExtensionOIDs()byte[]getEncoded()byte[]getExtensionValue(String oid)PrincipalgetIssuerDN()boolean[]getIssuerUniqueID()boolean[]getKeyUsage()Set<String>getNonCriticalExtensionOIDs()DategetNotAfter()DategetNotBefore()PublicKeygetPublicKey()BigIntegergetSerialNumber()StringgetSigAlgName()StringgetSigAlgOID()byte[]getSigAlgParams()byte[]getSignature()PrincipalgetSubjectDN()boolean[]getSubjectUniqueID()byte[]getTBSCertificate()intgetVersion()inthashCode()booleanhasUnsupportedCriticalExtension()booleanisSensitive()intrefCnt()Returns the reference count of this object.booleanrelease()Decreases the reference count by1and deallocates this object if the reference count reaches at0.booleanrelease(int decrement)Decreases the reference count by the specifieddecrementand deallocates this object if the reference count reaches at0.PemX509Certificatereplace(ByteBuf content)Returns a newByteBufHolderwhich contains the specifiedcontent.PemX509Certificateretain()Increases the reference count by1.PemX509Certificateretain(int increment)Increases the reference count by the specifiedincrement.PemX509CertificateretainedDuplicate()Duplicates thisByteBufHolder.StringtoString()PemX509Certificatetouch()Records the current access location of this object for debugging purposes.PemX509Certificatetouch(Object hint)Records the current access location of this object with an additional arbitrary information for debugging purposes.static PemX509CertificatevalueOf(byte[] key)Creates aPemX509Certificatefrom rawbyte[].static PemX509CertificatevalueOf(ByteBuf key)Creates aPemX509Certificatefrom rawByteBuf.voidverify(PublicKey key)voidverify(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 aPemX509Certificatefrom 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 aPemX509Certificatefrom 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:ReferenceCountedReturns the reference count of this object. If0, it means this object has been deallocated.- Specified by:
refCntin interfaceReferenceCounted
-
content
public ByteBuf content()
Description copied from interface:ByteBufHolderReturn the data which is held by thisByteBufHolder.- Specified by:
contentin interfaceByteBufHolder
-
copy
public PemX509Certificate copy()
Description copied from interface:ByteBufHolderCreates a deep copy of thisByteBufHolder.- Specified by:
copyin interfaceByteBufHolder
-
duplicate
public PemX509Certificate duplicate()
Description copied from interface:ByteBufHolderDuplicates thisByteBufHolder. Be aware that this will not automatically callByteBufHolder.retain().- Specified by:
duplicatein interfaceByteBufHolder
-
retainedDuplicate
public PemX509Certificate retainedDuplicate()
Description copied from interface:ByteBufHolderDuplicates thisByteBufHolder. This method returns a retained duplicate unlikeByteBufHolder.duplicate().- Specified by:
retainedDuplicatein interfaceByteBufHolder- See Also:
ByteBuf.retainedDuplicate()
-
replace
public PemX509Certificate replace(ByteBuf content)
Description copied from interface:ByteBufHolderReturns a newByteBufHolderwhich contains the specifiedcontent.- Specified by:
replacein interfaceByteBufHolder
-
retain
public PemX509Certificate retain()
Description copied from interface:ReferenceCountedIncreases the reference count by1.- Specified by:
retainin interfaceByteBufHolder- Specified by:
retainin interfaceReferenceCounted
-
retain
public PemX509Certificate retain(int increment)
Description copied from interface:ReferenceCountedIncreases the reference count by the specifiedincrement.- Specified by:
retainin interfaceByteBufHolder- Specified by:
retainin interfaceReferenceCounted
-
touch
public PemX509Certificate touch()
Description copied from interface:ReferenceCountedRecords 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:
touchin interfaceByteBufHolder- Specified by:
touchin interfaceReferenceCounted
-
touch
public PemX509Certificate touch(Object hint)
Description copied from interface:ReferenceCountedRecords 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:
touchin interfaceByteBufHolder- Specified by:
touchin interfaceReferenceCounted
-
release
public boolean release()
Description copied from interface:ReferenceCountedDecreases the reference count by1and deallocates this object if the reference count reaches at0.- Specified by:
releasein interfaceReferenceCounted- Returns:
trueif and only if the reference count became0and this object has been deallocated
-
release
public boolean release(int decrement)
Description copied from interface:ReferenceCountedDecreases the reference count by the specifieddecrementand deallocates this object if the reference count reaches at0.- Specified by:
releasein interfaceReferenceCounted- Returns:
trueif and only if the reference count became0and this object has been deallocated
-
getEncoded
public byte[] getEncoded()
- Specified by:
getEncodedin classCertificate
-
hasUnsupportedCriticalExtension
public boolean hasUnsupportedCriticalExtension()
- Specified by:
hasUnsupportedCriticalExtensionin interfaceX509Extension
-
getCriticalExtensionOIDs
public Set<String> getCriticalExtensionOIDs()
- Specified by:
getCriticalExtensionOIDsin interfaceX509Extension
-
getNonCriticalExtensionOIDs
public Set<String> getNonCriticalExtensionOIDs()
- Specified by:
getNonCriticalExtensionOIDsin interfaceX509Extension
-
getExtensionValue
public byte[] getExtensionValue(String oid)
- Specified by:
getExtensionValuein interfaceX509Extension
-
checkValidity
public void checkValidity()
- Specified by:
checkValidityin classX509Certificate
-
checkValidity
public void checkValidity(Date date)
- Specified by:
checkValidityin classX509Certificate
-
getVersion
public int getVersion()
- Specified by:
getVersionin classX509Certificate
-
getSerialNumber
public BigInteger getSerialNumber()
- Specified by:
getSerialNumberin classX509Certificate
-
getIssuerDN
public Principal getIssuerDN()
- Specified by:
getIssuerDNin classX509Certificate
-
getSubjectDN
public Principal getSubjectDN()
- Specified by:
getSubjectDNin classX509Certificate
-
getNotBefore
public Date getNotBefore()
- Specified by:
getNotBeforein classX509Certificate
-
getNotAfter
public Date getNotAfter()
- Specified by:
getNotAfterin classX509Certificate
-
getTBSCertificate
public byte[] getTBSCertificate()
- Specified by:
getTBSCertificatein classX509Certificate
-
getSignature
public byte[] getSignature()
- Specified by:
getSignaturein classX509Certificate
-
getSigAlgName
public String getSigAlgName()
- Specified by:
getSigAlgNamein classX509Certificate
-
getSigAlgOID
public String getSigAlgOID()
- Specified by:
getSigAlgOIDin classX509Certificate
-
getSigAlgParams
public byte[] getSigAlgParams()
- Specified by:
getSigAlgParamsin classX509Certificate
-
getIssuerUniqueID
public boolean[] getIssuerUniqueID()
- Specified by:
getIssuerUniqueIDin classX509Certificate
-
getSubjectUniqueID
public boolean[] getSubjectUniqueID()
- Specified by:
getSubjectUniqueIDin classX509Certificate
-
getKeyUsage
public boolean[] getKeyUsage()
- Specified by:
getKeyUsagein classX509Certificate
-
getBasicConstraints
public int getBasicConstraints()
- Specified by:
getBasicConstraintsin classX509Certificate
-
verify
public void verify(PublicKey key)
- Specified by:
verifyin classCertificate
-
verify
public void verify(PublicKey key, String sigProvider)
- Specified by:
verifyin classCertificate
-
getPublicKey
public PublicKey getPublicKey()
- Specified by:
getPublicKeyin classCertificate
-
equals
public boolean equals(Object o)
- Overrides:
equalsin classCertificate
-
hashCode
public int hashCode()
- Overrides:
hashCodein classCertificate
-
toString
public String toString()
- Specified by:
toStringin classCertificate
-
-