Package org.bouncycastle.bcpg
Class ECSecretBCPGKey
- java.lang.Object
-
- org.bouncycastle.bcpg.BCPGObject
-
- org.bouncycastle.bcpg.ECSecretBCPGKey
-
- All Implemented Interfaces:
BCPGKey,org.bouncycastle.util.Encodable
public class ECSecretBCPGKey extends BCPGObject implements BCPGKey
Base class for an EC Secret Key. This type is for use withPublicKeyAlgorithmTags.ECDHorPublicKeyAlgorithmTags.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 toX25519SecretBCPGKeywhich uses native encoding. Modern implementations use dedicated key typesX25519SecretBCPGKey,X448SecretBCPGKeyalong with dedicated algorithm tagsPublicKeyAlgorithmTags.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,X25519SecretBCPGKeyorX448SecretBCPGKeyMUST be used for X25519, X448.
-
-
Constructor Summary
Constructors Constructor Description ECSecretBCPGKey(java.math.BigInteger x)ECSecretBCPGKey(BCPGInputStream in)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidencode(BCPGOutputStream out)byte[]getEncoded()return the standard PGP encoding of the key.java.lang.StringgetFormat()return "PGP"java.math.BigIntegergetX()
-
-
-
Constructor Detail
-
ECSecretBCPGKey
public ECSecretBCPGKey(BCPGInputStream in) throws java.io.IOException
- Parameters:
in-- Throws:
java.io.IOException
-
ECSecretBCPGKey
public ECSecretBCPGKey(java.math.BigInteger x)
- Parameters:
x-
-
-
Method Detail
-
getFormat
public java.lang.String getFormat()
return "PGP"- Specified by:
getFormatin interfaceBCPGKey- Returns:
- "RAW" or "PGP"
- See Also:
BCPGKey.getFormat()
-
getEncoded
public byte[] getEncoded()
return the standard PGP encoding of the key.- Specified by:
getEncodedin interfaceBCPGKey- Specified by:
getEncodedin interfaceorg.bouncycastle.util.Encodable- Overrides:
getEncodedin classBCPGObject- Returns:
- byte[]
- See Also:
BCPGKey.getEncoded()
-
encode
public void encode(BCPGOutputStream out) throws java.io.IOException
- Specified by:
encodein classBCPGObject- Throws:
java.io.IOException
-
getX
public java.math.BigInteger getX()
- Returns:
- x
-
-