APIdia Launch Partner
Top Description Fields Constructors Methods
sun.security.ec

public final Class ECPrivateKeyImpl

extends PKCS8Key
implements ECPrivateKey
Class Inheritance
All Implemented Interfaces
java.security.interfaces.ECPrivateKey, java.security.interfaces.ECKey, java.security.PrivateKey, javax.security.auth.Destroyable, java.security.AsymmetricKey, java.security.BinaryEncodable, java.security.Key, java.io.Serializable
Imports
java.io.IOException, .InvalidObjectException, .ObjectInputStream, java.math.BigInteger, java.security.*, java.security.interfaces.*, java.security.spec.*, java.util.Arrays, sun.security.ec.point.AffinePoint, .MutablePoint, sun.security.util.*, sun.security.x509.AlgorithmId, .X509Key, sun.security.pkcs.PKCS8Key

Key implementation for EC private keys.

ASN.1 syntax for EC private keys from SEC 1 v1.5 (draft):

EXPLICIT TAGS

ECPrivateKey ::= SEQUENCE {
  version INTEGER { ecPrivkeyVer1(1) } (ecPrivkeyVer1),
  privateKey OCTET STRING,
  parameters [0] ECDomainParameters {{ SECGCurveNames }} OPTIONAL,
  publicKey [1] BIT STRING OPTIONAL
}
We currently ignore the optional parameters and publicKey fields. We require that the parameters are encoded as part of the AlgorithmIdentifier, not in the private key structure.
Author
Andreas Sterbenz
Since
1.6

Field Summary

Modifier and TypeField and Description
private byte[]
private byte[]
private ECParameterSpec
private BigInteger
s

private final byte
private static final long
Inherited from sun.security.pkcs.PKCS8Key:
algidencodedKeyprivKeyMaterialpubKeyEncodedV1V2

Constructor Summary

AccessConstructor and Description
pack-priv
ECPrivateKeyImpl(byte[] encoded)

Construct a key from its encoding.

pack-priv
ECPrivateKeyImpl(BigInteger s, ECParameterSpec params)

Construct a key from its components.

pack-priv

Method Summary

Modifier and TypeMethod and Description
public PublicKey
calculatePublicKey()

Overrides default sun.security.util.InternalPrivateKey.calculatePublicKey.

Calculates a matching public key.

public String
getAlgorithm()

Overrides sun.security.pkcs.PKCS8Key.getAlgorithm.

Implements java.security.Key.getAlgorithm.

Returns the standard algorithm name for this key.

public byte[]
public ECParameterSpec
getParams()

Overrides default java.security.interfaces.ECPrivateKey.getParams, java.security.AsymmetricKey.getParams.

Returns the parameters associated with this key.

public BigInteger
getS()

Implements java.security.interfaces.ECPrivateKey.getS.

Returns the private value S.

private void
makeEncoding(byte[] privBytes)

private void
parseKeyBits()

Parse the ASN.1 of the privateKey Octet

public static BitArray
parsePublicBits(byte[] privateBytes)

private void
readObject(ObjectInputStream
the ObjectInputStream from which data is read
stream
)

Hides sun.security.pkcs.PKCS8Key.readObject.

Restores the state of this object from the stream.

Inherited from sun.security.pkcs.PKCS8Key:
clearequalsgetAlgorithmIdgetEncodedgetEncodedgetFormatgetPubKeyEncodedgetVersionhashCodehasPublicKeyparseKeyparseKeywriteReplace

Field Detail

arraySback to summary
private byte[] arrayS
domainParamsback to summary
private byte[] domainParams
paramsback to summary
private ECParameterSpec params
Annotations
@SuppressWarnings:serial
sback to summary
private BigInteger s
SEC1v2back to summary
private final byte SEC1v2
serialVersionUIDback to summary
private static final long serialVersionUID

Hides sun.security.pkcs.PKCS8Key.serialVersionUID, java.security.interfaces.ECPrivateKey.serialVersionUID, java.security.PrivateKey.serialVersionUID.

Annotations
@Serial

Constructor Detail

ECPrivateKeyImplback to summary
pack-priv ECPrivateKeyImpl(byte[] encoded) throws InvalidKeyException

Construct a key from its encoding. Called by the ECKeyFactory.

ECPrivateKeyImplback to summary
pack-priv ECPrivateKeyImpl(BigInteger s, ECParameterSpec params) throws InvalidKeyException

Construct a key from its components. Used by the KeyFactory.

ECPrivateKeyImplback to summary
pack-priv ECPrivateKeyImpl(byte[] s, ECParameterSpec params) throws InvalidKeyException

Method Detail

calculatePublicKeyback to summary
public PublicKey calculatePublicKey()

Overrides default sun.security.util.InternalPrivateKey.calculatePublicKey.

Doc from sun.security.util.InternalPrivateKey.calculatePublicKey.

Calculates a matching public key.

getAlgorithmback to summary
public String getAlgorithm()

Overrides sun.security.pkcs.PKCS8Key.getAlgorithm.

Implements java.security.Key.getAlgorithm.

Doc from java.security.Key.getAlgorithm.

Returns the standard algorithm name for this key. For example, "RSA" would indicate that this key is an RSA key. See the Key Algorithms section in the Java Security Standard Algorithm Names Specification for information about standard key algorithm names.

getArraySback to summary
public byte[] getArrayS()
getParamsback to summary
public ECParameterSpec getParams()

Overrides default java.security.interfaces.ECPrivateKey.getParams, java.security.AsymmetricKey.getParams.

Doc from java.security.interfaces.ECPrivateKey.getParams.

Returns the parameters associated with this key. The parameters are optional and may be either explicitly specified or implicitly created during key pair generation.

getSback to summary
public BigInteger getS()

Implements java.security.interfaces.ECPrivateKey.getS.

Doc from java.security.interfaces.ECPrivateKey.getS.

Returns the private value S.

makeEncodingback to summary
private void makeEncoding(byte[] privBytes) throws InvalidKeyException
parseKeyBitsback to summary
private void parseKeyBits() throws InvalidKeyException

Parse the ASN.1 of the privateKey Octet

parsePublicBitsback to summary
public static BitArray parsePublicBits(byte[] privateBytes)
readObjectback to summary
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException

Hides sun.security.pkcs.PKCS8Key.readObject.

Restores the state of this object from the stream.

Deserialization of this object is not supported.

Parameters
stream:ObjectInputStream

the ObjectInputStream from which data is read

Annotations
@Serial
Exceptions
IOException:
if an I/O error occurs
ClassNotFoundException:
if a serialized class cannot be loaded