Class BCECGOST3410_2012PrivateKey
java.lang.Object
org.bouncycastle.jcajce.provider.asymmetric.ecgost12.BCECGOST3410_2012PrivateKey
- All Implemented Interfaces:
Serializable, AsymmetricKey, DEREncodablePREVIEW, ECKey, ECPrivateKey, Key, PrivateKey, Destroyable, ECKey, ECPointEncoder, ECPrivateKey, PKCS12BagAttributeCarrier
public class BCECGOST3410_2012PrivateKey
extends Object
implements ECPrivateKey, ECPrivateKey, Destroyable, PKCS12BagAttributeCarrier, ECPointEncoder
Represent two kind of GOST34.10 2012 PrivateKeys: with 256 and 512 size
- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBCECGOST3410_2012PrivateKey(String algorithm, ECPrivateKeyParameters params) BCECGOST3410_2012PrivateKey(String algorithm, ECPrivateKeyParameters params, BCECGOST3410_2012PublicKey pubKey, ECParameterSpec spec) BCECGOST3410_2012PrivateKey(String algorithm, ECPrivateKeyParameters params, BCECGOST3410_2012PublicKey pubKey, ECParameterSpec spec) -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()Destroy this key, clearing the key material it holds.booleangetD()return the private value D.byte[]Return a PKCS8 representation of the key.return the encoding format we produce in getEncoded().return a parameter specification representing the EC domain parameters for the key.getS()booleaninthashCode()booleanvoidsetBagAttribute(ASN1ObjectIdentifier oid, ASN1Encodable attribute) voidsetFriendlyName(String friendlyName) voidsetPointFormat(String style) Set the formatting for encoding of points.toString()
-
Constructor Details
-
BCECGOST3410_2012PrivateKey
protected BCECGOST3410_2012PrivateKey() -
BCECGOST3410_2012PrivateKey
-
BCECGOST3410_2012PrivateKey
-
BCECGOST3410_2012PrivateKey
-
BCECGOST3410_2012PrivateKey
-
BCECGOST3410_2012PrivateKey
public BCECGOST3410_2012PrivateKey(String algorithm, ECPrivateKeyParameters params, BCECGOST3410_2012PublicKey pubKey, ECParameterSpec spec) -
BCECGOST3410_2012PrivateKey
public BCECGOST3410_2012PrivateKey(String algorithm, ECPrivateKeyParameters params, BCECGOST3410_2012PublicKey pubKey, ECParameterSpec spec) -
BCECGOST3410_2012PrivateKey
-
-
Method Details
-
getAlgorithm
- Specified by:
getAlgorithmin interfaceKey
-
getFormat
-
getEncoded
public byte[] getEncoded()Return a PKCS8 representation of the key. The sequence returned represents a full PrivateKeyInfo object.- Specified by:
getEncodedin interfaceKey- Returns:
- a PKCS8 representation of the key.
-
getParams
- Specified by:
getParamsin interfaceAsymmetricKey- Specified by:
getParamsin interfaceECKey- Specified by:
getParamsin interfaceECPrivateKey
-
getParameters
Description copied from interface:ECKeyreturn a parameter specification representing the EC domain parameters for the key.- Specified by:
getParametersin interfaceECKey
-
getS
- Specified by:
getSin interfaceECPrivateKey
-
getD
Description copied from interface:ECPrivateKeyreturn the private value D.- Specified by:
getDin interfaceECPrivateKey
-
setBagAttribute
- Specified by:
setBagAttributein interfacePKCS12BagAttributeCarrier
-
getBagAttribute
- Specified by:
getBagAttributein interfacePKCS12BagAttributeCarrier
-
getBagAttributeKeys
- Specified by:
getBagAttributeKeysin interfacePKCS12BagAttributeCarrier
-
hasFriendlyName
public boolean hasFriendlyName()- Specified by:
hasFriendlyNamein interfacePKCS12BagAttributeCarrier
-
setFriendlyName
- Specified by:
setFriendlyNamein interfacePKCS12BagAttributeCarrier
-
setPointFormat
Description copied from interface:ECPointEncoderSet the formatting for encoding of points. If the String "UNCOMPRESSED" is passed in point compression will not be used. If the String "COMPRESSED" is passed point compression will be used. The default is "UNCOMPRESSED".- Specified by:
setPointFormatin interfaceECPointEncoder- Parameters:
style- the style to use.
-
equals
-
hashCode
-
toString
-
destroy
public void destroy()Destroy this key, clearing the key material it holds.The private value is held as a
BigInteger, which is immutable and so cannot be zeroized in place - destruction drops the internal reference so the value becomes unreachable (cleared on garbage collection). The (public) domain parameters and public key details are retained. After destructionisDestroyed()returns true, the secret-bearing accessors (getEncoded(),getS()andgetD()) throwIllegalStateException, the key can no longer be serialized, and it is equal only to itself;hashCode()retains its pre-destruction value.- Specified by:
destroyin interfaceDestroyable
-
isDestroyed
public boolean isDestroyed()- Specified by:
isDestroyedin interfaceDestroyable
-