public class ECSecretBCPGKey extends BCPGObject implements BCPGKey
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.Constructor and Description |
---|
ECSecretBCPGKey(BCPGInputStream in) |
ECSecretBCPGKey(java.math.BigInteger x) |
Modifier and Type | Method and Description |
---|---|
void |
encode(BCPGOutputStream out) |
byte[] |
getEncoded()
return the standard PGP encoding of the key.
|
java.lang.String |
getFormat()
return "PGP"
|
java.math.BigInteger |
getX() |
public ECSecretBCPGKey(BCPGInputStream in) throws java.io.IOException
in
- java.io.IOException
public ECSecretBCPGKey(java.math.BigInteger x)
x
- public java.lang.String getFormat()
getFormat
in interface BCPGKey
BCPGKey.getFormat()
public byte[] getEncoded()
getEncoded
in interface BCPGKey
getEncoded
in interface org.bouncycastle.util.Encodable
getEncoded
in class BCPGObject
BCPGKey.getEncoded()
public void encode(BCPGOutputStream out) throws java.io.IOException
encode
in class BCPGObject
java.io.IOException
public java.math.BigInteger getX()