Top Description Fields Constructors Methods
io.netty.handler.ssl

public final Class PemPrivateKey

extends AbstractReferenceCounted
implements PrivateKey, PemEncoded
Class Inheritance
All Implemented Interfaces
io.netty.handler.ssl.PemEncoded, io.netty.buffer.ByteBufHolder, io.netty.util.ReferenceCounted, java.security.PrivateKey, javax.security.auth.Destroyable, java.security.AsymmetricKey, java.security.Key, java.io.Serializable
Imports
java.security.PrivateKey, javax.security.auth.Destroyable, io.netty.buffer.ByteBuf, .ByteBufAllocator, .Unpooled, io.netty.util.AbstractReferenceCounted, .CharsetUtil, .IllegalReferenceCountException, io.netty.util.internal.ObjectUtil

This is a special purpose implementation of a PrivateKey which allows the user to pass PEM/PKCS#8 encoded key material straight into OpenSslContext without having to parse and re-encode bytes in Java land. All methods other than what's implemented in PemEncoded and Destroyable throw UnsupportedOperationExceptions.
See Also
PemEncoded, OpenSslContext, valueOf(byte[]), valueOf(ByteBuf)

Field Summary

Modifier and TypeField and Description
private static final byte[]
private final ByteBuf
private static final byte[]
private static final String
private static final long

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public ByteBuf
content()

Implements io.netty.buffer.ByteBufHolder.content.

Return the data which is held by this ByteBufHolder.
public PemPrivateKey
copy()

Implements io.netty.handler.ssl.PemEncoded.copy.

Creates a deep copy of this ByteBufHolder.
protected void
deallocate()

Implements abstract io.netty.util.AbstractReferenceCounted.deallocate.

Called once refCnt() is equals 0.
public void
destroy()

Overrides default javax.security.auth.Destroyable.destroy.

Note

This is a JDK8 interface/method.

public PemPrivateKey
public String
getAlgorithm()

Implements java.security.Key.getAlgorithm.

Returns the standard algorithm name for this key.
public byte[]
getEncoded()

Implements java.security.Key.getEncoded.

Returns the key in its primary encoding format, or null if this key does not support encoding.
public String
getFormat()

Implements java.security.Key.getFormat.

Returns the name of the primary encoding format of this key, or null if this key does not support encoding.
public boolean
isDestroyed()

Overrides default javax.security.auth.Destroyable.isDestroyed.

Note

This is a JDK8 interface/method.

public boolean
isSensitive()

Implements io.netty.handler.ssl.PemEncoded.isSensitive.

Returns true if the PEM encoded value is considered sensitive information such as a private key.
public PemPrivateKey
replace(ByteBuf content)

Implements io.netty.handler.ssl.PemEncoded.replace.

Returns a new ByteBufHolder which contains the specified content.
public PemPrivateKey
public PemPrivateKey
retain(int increment)

Overrides io.netty.util.AbstractReferenceCounted.retain.

Implements io.netty.handler.ssl.PemEncoded.retain, io.netty.util.ReferenceCounted.retain.

Increases the reference count by the specified increment.
public PemPrivateKey
pack-priv static PemEncoded
toPEM(ByteBufAllocator allocator, boolean useDirect, PrivateKey key)

Creates a PemEncoded value from the PrivateKey.

pack-priv static PemEncoded
toPEM(ByteBufAllocator allocator, boolean useDirect, byte[] bytes)

public PemPrivateKey
touch()

Overrides io.netty.util.AbstractReferenceCounted.touch.

Implements io.netty.handler.ssl.PemEncoded.touch, io.netty.util.ReferenceCounted.touch.

Records the current access location of this object for debugging purposes.
public PemPrivateKey
touch(Object hint)

Implements io.netty.handler.ssl.PemEncoded.touch, io.netty.util.ReferenceCounted.touch.

Records the current access location of this object with an additional arbitrary information for debugging purposes.
public static PemPrivateKey
valueOf(byte[] key)

Creates a PemPrivateKey from raw byte[].

public static PemPrivateKey
valueOf(ByteBuf key)

Creates a PemPrivateKey from raw ByteBuf.

Inherited from io.netty.util.AbstractReferenceCounted:
refCntreleasereleasesetRefCnt

Field Detail

BEGIN_PRIVATE_KEYback to summary
private static final byte[] BEGIN_PRIVATE_KEY
contentback to summary
private final ByteBuf content
END_PRIVATE_KEYback to summary
private static final byte[] END_PRIVATE_KEY
PKCS8_FORMATback to summary
private static final String PKCS8_FORMAT
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.security.PrivateKey.serialVersionUID.

Constructor Detail

PemPrivateKeyback to summary
private PemPrivateKey(ByteBuf content)

Method Detail

contentback to summary
public ByteBuf content()

Implements io.netty.buffer.ByteBufHolder.content.

Doc from io.netty.buffer.ByteBufHolder.content.

Return the data which is held by this ByteBufHolder.

Annotations
@Override
copyback to summary
public PemPrivateKey copy()

Implements io.netty.handler.ssl.PemEncoded.copy.

Doc from io.netty.buffer.ByteBufHolder.copy.

Creates a deep copy of this ByteBufHolder.

Annotations
@Override
deallocateback to summary
protected void deallocate()

Implements abstract io.netty.util.AbstractReferenceCounted.deallocate.

Doc from io.netty.util.AbstractReferenceCounted.deallocate.

Called once refCnt() is equals 0.

Annotations
@Override
destroyback to summary
public void destroy()

Overrides default javax.security.auth.Destroyable.destroy.

Note

This is a JDK8 interface/method. Due to backwards compatibility reasons it's not possible to slap the @Override annotation onto this method.

Annotations
@Override
See Also
Destroyable#destroy()
duplicateback to summary
public PemPrivateKey duplicate()

Implements io.netty.handler.ssl.PemEncoded.duplicate.

Doc from io.netty.buffer.ByteBufHolder.duplicate.

Duplicates this ByteBufHolder. Be aware that this will not automatically call retain().

Annotations
@Override
getAlgorithmback to summary
public String getAlgorithm()

Implements java.security.Key.getAlgorithm.

Doc from java.security.Key.getAlgorithm.

Returns the standard algorithm name for this key. For example, "DSA" would indicate that this key is a DSA key. See the key related sections (KeyFactory, KeyGenerator, KeyPairGenerator, and SecretKeyFactory) in the Java Security Standard Algorithm Names Specification for information about standard key algorithm names.

Returns:String

the name of the algorithm associated with this key.

Annotations
@Override
getEncodedback to summary
public byte[] getEncoded()

Implements java.security.Key.getEncoded.

Doc from java.security.Key.getEncoded.

Returns the key in its primary encoding format, or null if this key does not support encoding.

Returns:byte[]

the encoded key, or null if the key does not support encoding.

Annotations
@Override
getFormatback to summary
public String getFormat()

Implements java.security.Key.getFormat.

Doc from java.security.Key.getFormat.

Returns the name of the primary encoding format of this key, or null if this key does not support encoding. The primary encoding format is named in terms of the appropriate ASN.1 data format, if an ASN.1 specification for this key exists. For example, the name of the ASN.1 data format for public keys is SubjectPublicKeyInfo, as defined by the X.509 standard; in this case, the returned format is "X.509". Similarly, the name of the ASN.1 data format for private keys is PrivateKeyInfo, as defined by the PKCS #8 standard; in this case, the returned format is "PKCS#8".

Returns:String

the primary encoding format of the key.

Annotations
@Override
isDestroyedback to summary
public boolean isDestroyed()

Overrides default javax.security.auth.Destroyable.isDestroyed.

Note

This is a JDK8 interface/method. Due to backwards compatibility reasons it's not possible to slap the @Override annotation onto this method.

Returns:boolean

Doc from javax.security.auth.Destroyable.isDestroyed.

true if this Object has been destroyed, false otherwise.

Annotations
@Override
See Also
Destroyable#isDestroyed()
isSensitiveback to summary
public boolean isSensitive()

Implements io.netty.handler.ssl.PemEncoded.isSensitive.

Doc from io.netty.handler.ssl.PemEncoded.isSensitive.

Returns true if the PEM encoded value is considered sensitive information such as a private key.

Annotations
@Override
replaceback to summary
public PemPrivateKey replace(ByteBuf content)

Implements io.netty.handler.ssl.PemEncoded.replace.

Doc from io.netty.buffer.ByteBufHolder.replace.

Returns a new ByteBufHolder which contains the specified content.

Annotations
@Override
retainback to summary
public PemPrivateKey retain()

Overrides io.netty.util.AbstractReferenceCounted.retain.

Implements io.netty.handler.ssl.PemEncoded.retain, io.netty.util.ReferenceCounted.retain.

Doc from io.netty.util.ReferenceCounted.retain.

Increases the reference count by 1.

Annotations
@Override
retainback to summary
public PemPrivateKey retain(int increment)

Overrides io.netty.util.AbstractReferenceCounted.retain.

Implements io.netty.handler.ssl.PemEncoded.retain, io.netty.util.ReferenceCounted.retain.

Doc from io.netty.util.ReferenceCounted.retain.

Increases the reference count by the specified increment.

Annotations
@Override
retainedDuplicateback to summary
public PemPrivateKey retainedDuplicate()

Implements io.netty.handler.ssl.PemEncoded.retainedDuplicate.

Doc from io.netty.buffer.ByteBufHolder.retainedDuplicate.

Duplicates this ByteBufHolder. This method returns a retained duplicate unlike duplicate().

Annotations
@Override
toPEMback to summary
pack-priv static PemEncoded toPEM(ByteBufAllocator allocator, boolean useDirect, PrivateKey key)

Creates a PemEncoded value from the PrivateKey.

toPEMback to summary
pack-priv static PemEncoded toPEM(ByteBufAllocator allocator, boolean useDirect, byte[] bytes)
touchback to summary
public PemPrivateKey touch()

Overrides io.netty.util.AbstractReferenceCounted.touch.

Implements io.netty.handler.ssl.PemEncoded.touch, io.netty.util.ReferenceCounted.touch.

Doc from io.netty.util.ReferenceCounted.touch.

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 ResourceLeakDetector. This method is a shortcut to touch(null).

Annotations
@Override
touchback to summary
public PemPrivateKey touch(Object hint)

Implements io.netty.handler.ssl.PemEncoded.touch, io.netty.util.ReferenceCounted.touch.

Doc from io.netty.util.ReferenceCounted.touch.

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 ResourceLeakDetector.

Annotations
@Override
valueOfback to summary
public static PemPrivateKey valueOf(byte[] key)

Creates a PemPrivateKey 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.

valueOfback to summary
public static PemPrivateKey valueOf(ByteBuf key)

Creates a PemPrivateKey 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.