Top Description Fields Constructors Methods
org.bouncycastle.bcpg

public Class ECSecretBCPGKey

extends BCPGObject
implements BCPGKey
Class Inheritance
All Implemented Interfaces
org.bouncycastle.bcpg.BCPGKey, org.bouncycastle.util.Encodable
Imports
java.io.IOException, java.math.BigInteger

Base class for an EC Secret Key. This type is for use with PublicKeyAlgorithmTags#ECDH or PublicKeyAlgorithmTags#ECDSA. The specific curve is identified by providing an OID. Regarding X25519, X448, consider the following: ECDH keys using curve448 are unspecified. ECDH secret keys using curve25519 use big-endian MPI encoding, contrary to X25519SecretBCPGKey which uses native encoding. Modern implementations use dedicated key types X25519SecretBCPGKey, X448SecretBCPGKey along with dedicated algorithm tags PublicKeyAlgorithmTags#X25519, PublicKeyAlgorithmTags#X448. If you want to be compatible with legacy applications however, you should use this class instead. Note though, that for v6 keys, X25519SecretBCPGKey or X448SecretBCPGKey MUST be used for X25519, X448.
See Also
OpenPGP - Algorithm-Specific Parts for ECDH Keys, OpenPGP - Algorithm-Specific Parts for ECDSA Keys, OpenPGP - Curve25519Legacy ECDH Secret Key Material (deprecated)

Field Summary

Modifier and TypeField and Description
pack-priv MPInteger
x

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
public void
public byte[]
public String
public BigInteger

Returns:

x
getX
()

Field Detail

xback to summary
pack-priv MPInteger x

Constructor Detail

ECSecretBCPGKeyback to summary
public ECSecretBCPGKey(BCPGInputStream in) throws IOException
ECSecretBCPGKeyback to summary
public ECSecretBCPGKey(BigInteger x)

Method Detail

encodeback to summary
public void encode(BCPGOutputStream out) throws IOException

Implements abstract org.bouncycastle.bcpg.BCPGObject.encode.

getEncodedback to summary
public byte[] getEncoded()

Overrides org.bouncycastle.bcpg.BCPGObject.getEncoded.

Implements org.bouncycastle.bcpg.BCPGKey.getEncoded, org.bouncycastle.util.Encodable.getEncoded.

return the standard PGP encoding of the key.

Returns:byte[]

Doc from org.bouncycastle.bcpg.BCPGKey.getEncoded.

byte[]

See Also
org.bouncycastle.bcpg.BCPGKey#getEncoded()
getFormatback to summary
public String getFormat()

Implements org.bouncycastle.bcpg.BCPGKey.getFormat.

return "PGP"

Returns:String

Doc from org.bouncycastle.bcpg.BCPGKey.getFormat.

"RAW" or "PGP"

See Also
org.bouncycastle.bcpg.BCPGKey#getFormat()
getXback to summary
public BigInteger getX()
Returns:BigInteger

x