public class BCECPrivateKey extends java.lang.Object implements java.security.interfaces.ECPrivateKey, ECPrivateKey, javax.security.auth.Destroyable, PKCS12BagAttributeCarrier, ECPointEncoder, BCKey
| Modifier | Constructor and Description |
|---|---|
protected |
BCECPrivateKey() |
|
BCECPrivateKey(java.security.interfaces.ECPrivateKey key,
ProviderConfiguration configuration) |
|
BCECPrivateKey(java.lang.String algorithm,
BCECPrivateKey key) |
|
BCECPrivateKey(java.lang.String algorithm,
ECPrivateKeyParameters params,
BCECPublicKey pubKey,
java.security.spec.ECParameterSpec spec,
ProviderConfiguration configuration) |
|
BCECPrivateKey(java.lang.String algorithm,
ECPrivateKeyParameters params,
BCECPublicKey pubKey,
ECParameterSpec spec,
ProviderConfiguration configuration) |
|
BCECPrivateKey(java.lang.String algorithm,
ECPrivateKeyParameters params,
ProviderConfiguration configuration) |
|
BCECPrivateKey(java.lang.String algorithm,
ECPrivateKeySpec spec,
ProviderConfiguration configuration) |
|
BCECPrivateKey(java.lang.String algorithm,
java.security.spec.ECPrivateKeySpec spec,
ProviderConfiguration configuration) |
| Modifier and Type | Method and Description |
|---|---|
void |
destroy()
Destroy this key, clearing the key material it holds.
|
ECPrivateKeyParameters |
engineGetKeyParameters() |
boolean |
equals(java.lang.Object o) |
java.lang.String |
getAlgorithm() |
ASN1Encodable |
getBagAttribute(ASN1ObjectIdentifier oid) |
java.util.Enumeration |
getBagAttributeKeys() |
java.math.BigInteger |
getD()
return the private value D.
|
byte[] |
getEncoded()
Return a PKCS8 representation of the key.
|
java.lang.String |
getFormat()
return the encoding format we produce in getEncoded().
|
ECParameterSpec |
getParameters()
return a parameter specification representing the EC domain parameters
for the key.
|
java.security.spec.ECParameterSpec |
getParams() |
java.math.BigInteger |
getS() |
boolean |
hasFriendlyName() |
int |
hashCode() |
boolean |
isDestroyed() |
void |
setBagAttribute(ASN1ObjectIdentifier oid,
ASN1Encodable attribute) |
void |
setFriendlyName(java.lang.String friendlyName) |
void |
setPointFormat(java.lang.String style)
Set the formatting for encoding of points.
|
java.lang.String |
toString() |
protected BCECPrivateKey()
public BCECPrivateKey(java.security.interfaces.ECPrivateKey key,
ProviderConfiguration configuration)
public BCECPrivateKey(java.lang.String algorithm,
ECPrivateKeySpec spec,
ProviderConfiguration configuration)
public BCECPrivateKey(java.lang.String algorithm,
java.security.spec.ECPrivateKeySpec spec,
ProviderConfiguration configuration)
public BCECPrivateKey(java.lang.String algorithm,
BCECPrivateKey key)
public BCECPrivateKey(java.lang.String algorithm,
ECPrivateKeyParameters params,
BCECPublicKey pubKey,
java.security.spec.ECParameterSpec spec,
ProviderConfiguration configuration)
public BCECPrivateKey(java.lang.String algorithm,
ECPrivateKeyParameters params,
BCECPublicKey pubKey,
ECParameterSpec spec,
ProviderConfiguration configuration)
public BCECPrivateKey(java.lang.String algorithm,
ECPrivateKeyParameters params,
ProviderConfiguration configuration)
public java.lang.String getAlgorithm()
getAlgorithm in interface java.security.Keypublic java.lang.String getFormat()
getFormat in interface java.security.Keypublic byte[] getEncoded()
getEncoded in interface java.security.Keypublic ECPrivateKeyParameters engineGetKeyParameters()
public java.security.spec.ECParameterSpec getParams()
public ECParameterSpec getParameters()
ECKeygetParameters in interface ECKeypublic java.math.BigInteger getS()
public java.math.BigInteger getD()
ECPrivateKeygetD in interface ECPrivateKeypublic void setBagAttribute(ASN1ObjectIdentifier oid, ASN1Encodable attribute)
setBagAttribute in interface PKCS12BagAttributeCarrierpublic ASN1Encodable getBagAttribute(ASN1ObjectIdentifier oid)
getBagAttribute in interface PKCS12BagAttributeCarrierpublic java.util.Enumeration getBagAttributeKeys()
getBagAttributeKeys in interface PKCS12BagAttributeCarrierpublic boolean hasFriendlyName()
hasFriendlyName in interface PKCS12BagAttributeCarrierpublic void setFriendlyName(java.lang.String friendlyName)
setFriendlyName in interface PKCS12BagAttributeCarrierpublic void setPointFormat(java.lang.String style)
ECPointEncodersetPointFormat in interface ECPointEncoderstyle - the style to use.public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic void destroy()
The private value is held as a BigInteger, which is immutable and so cannot be
zeroized in place - destruction drops the internal references so the values become
unreachable (cleared on garbage collection); the cached PKCS#8 encoding is zeroized. The
underlying ECPrivateKeyParameters object is destroyed as well, so keys sharing it
are invalidated too. After destruction isDestroyed() returns true, the
secret-bearing accessors (getEncoded(), getS() and getD())
throw IllegalStateException, and the key can no longer be serialized;
hashCode() retains its pre-destruction value.
destroy in interface javax.security.auth.Destroyablepublic boolean isDestroyed()
isDestroyed in interface javax.security.auth.Destroyable