Class BCMLKEMPrivateKey
- java.lang.Object
-
- org.bouncycastle.jcajce.provider.asymmetric.mlkem.BCMLKEMPrivateKey
-
- All Implemented Interfaces:
java.io.Serializable,java.security.Key,java.security.PrivateKey,javax.security.auth.Destroyable,BCKey,MLKEMKey,MLKEMPrivateKey
public class BCMLKEMPrivateKey extends java.lang.Object implements MLKEMPrivateKey, BCKey
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description BCMLKEMPrivateKey(PrivateKeyInfo keyInfo)BCMLKEMPrivateKey(MLKEMPrivateKeyParameters params)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)Compare this ML-KEM private key with another object.java.lang.StringgetAlgorithm()byte[]getEncoded()java.lang.StringgetFormat()MLKEMParameterSpecgetParameterSpec()Return the parameters for this key.byte[]getPrivateData()Return the long form private data for the ML-KEM private key.MLKEMPrivateKeygetPrivateKey(boolean preferSeedOnly)Return a privateKey which will encode as seed-only or as an expanded-key.MLKEMPublicKeygetPublicKey()Return the public key corresponding to this private key.byte[]getSeed()Return the seed the private key was generated from (if available).inthashCode()java.lang.StringtoString()
-
-
-
Constructor Detail
-
BCMLKEMPrivateKey
public BCMLKEMPrivateKey(MLKEMPrivateKeyParameters params)
-
BCMLKEMPrivateKey
public BCMLKEMPrivateKey(PrivateKeyInfo keyInfo) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object o)
Compare this ML-KEM private key with another object.- Overrides:
equalsin classjava.lang.Object- Parameters:
o- the other object- Returns:
- the result of the comparison
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
getAlgorithm
public final java.lang.String getAlgorithm()
- Specified by:
getAlgorithmin interfacejava.security.Key- Returns:
- name of the algorithm - "ML-KEM"
-
getEncoded
public byte[] getEncoded()
- Specified by:
getEncodedin interfacejava.security.Key
-
getPublicKey
public MLKEMPublicKey getPublicKey()
Description copied from interface:MLKEMPrivateKeyReturn the public key corresponding to this private key.- Specified by:
getPublicKeyin interfaceMLKEMPrivateKey- Returns:
- a ML-KEM Public Key
-
getPrivateData
public byte[] getPrivateData()
Description copied from interface:MLKEMPrivateKeyReturn the long form private data for the ML-KEM private key.- Specified by:
getPrivateDatain interfaceMLKEMPrivateKey- Returns:
- long form private data for private key.
-
getSeed
public byte[] getSeed()
Description copied from interface:MLKEMPrivateKeyReturn the seed the private key was generated from (if available).- Specified by:
getSeedin interfaceMLKEMPrivateKey- Returns:
- the seed for the private key, null if not available.
-
getPrivateKey
public MLKEMPrivateKey getPrivateKey(boolean preferSeedOnly)
Description copied from interface:MLKEMPrivateKeyReturn a privateKey which will encode as seed-only or as an expanded-key.- Specified by:
getPrivateKeyin interfaceMLKEMPrivateKey- Parameters:
preferSeedOnly- if true, return a privateKey which will encode to seed-only if possible.- Returns:
- a new MLKEMPrivateKey which encodes to either seed-only or expanded-key.
-
getParameterSpec
public MLKEMParameterSpec getParameterSpec()
Description copied from interface:MLKEMKeyReturn the parameters for this key.- Specified by:
getParameterSpecin interfaceMLKEMKey- Returns:
- a MLKEMParameterSpec
-
getFormat
public java.lang.String getFormat()
- Specified by:
getFormatin interfacejava.security.Key
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-