Package org.bouncycastle.jcajce
Class CompositePrivateKey
- java.lang.Object
-
- org.bouncycastle.jcajce.CompositePrivateKey
-
- All Implemented Interfaces:
java.io.Serializable,java.security.Key,java.security.PrivateKey,javax.security.auth.Destroyable
public class CompositePrivateKey extends java.lang.Object implements java.security.PrivateKeyA composite private key class for Composite ML-KEM.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCompositePrivateKey.Builder
-
Constructor Summary
Constructors Constructor Description CompositePrivateKey(java.security.PrivateKey... keys)Create a composite private key from an array of PrivateKeys.CompositePrivateKey(ASN1ObjectIdentifier algorithm, java.security.PrivateKey... keys)CompositePrivateKey(PrivateKeyInfo keyInfo)Create a composite private key from a PrivateKeyInfo.CompositePrivateKey(AlgorithmIdentifier algorithmIdentifier, java.security.PrivateKey... keys)Create a composite private key which corresponds to a composite KEM algorithm in algorithmIdentifier.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CompositePrivateKey.Builderbuilder(java.lang.String algorithmName)static CompositePrivateKey.Builderbuilder(ASN1ObjectIdentifier compAlgOid)booleanequals(java.lang.Object o)java.lang.StringgetAlgorithm()Return the name the composite algorithm this key belongs to is registered under, or null if the key's algorithm is not one of the composite signature or composite KEM parameter sets (the legacy generic composite key OIDs have no registered name of their own).AlgorithmIdentifiergetAlgorithmIdentifier()byte[]getEncoded()Returns the encoding of the composite private key as per Section 4.2.java.lang.StringgetFormat()java.util.List<java.security.PrivateKey>getPrivateKeys()Return a list of the component private keys making up this composite.java.util.List<java.security.Provider>getProviders()Return a list of the providers supporting the component private keys.inthashCode()
-
-
-
Constructor Detail
-
CompositePrivateKey
public CompositePrivateKey(java.security.PrivateKey... keys)
Create a composite private key from an array of PrivateKeys.- Parameters:
keys- The component private keys.
-
CompositePrivateKey
public CompositePrivateKey(ASN1ObjectIdentifier algorithm, java.security.PrivateKey... keys)
-
CompositePrivateKey
public CompositePrivateKey(AlgorithmIdentifier algorithmIdentifier, java.security.PrivateKey... keys)
Create a composite private key which corresponds to a composite KEM algorithm in algorithmIdentifier.- Parameters:
algorithmIdentifier-keys-
-
CompositePrivateKey
public CompositePrivateKey(PrivateKeyInfo keyInfo)
Create a composite private key from a PrivateKeyInfo.- Parameters:
keyInfo- PrivateKeyInfo object containing a composite private key.
-
-
Method Detail
-
builder
public static CompositePrivateKey.Builder builder(ASN1ObjectIdentifier compAlgOid)
-
builder
public static CompositePrivateKey.Builder builder(java.lang.String algorithmName)
-
getPrivateKeys
public java.util.List<java.security.PrivateKey> getPrivateKeys()
Return a list of the component private keys making up this composite.- Returns:
- an immutable list of private keys.
-
getProviders
public java.util.List<java.security.Provider> getProviders()
Return a list of the providers supporting the component private keys.- Returns:
- an immutable list of Provider objects.
-
getAlgorithm
public java.lang.String getAlgorithm()
Return the name the composite algorithm this key belongs to is registered under, or null if the key's algorithm is not one of the composite signature or composite KEM parameter sets (the legacy generic composite key OIDs have no registered name of their own).- Specified by:
getAlgorithmin interfacejava.security.Key- Returns:
- the composite algorithm name, e.g. "MLDSA44-Ed25519-SHA512" or "MLKEM768-X25519-SHA3-256".
-
getAlgorithmIdentifier
public AlgorithmIdentifier getAlgorithmIdentifier()
-
getFormat
public java.lang.String getFormat()
- Specified by:
getFormatin interfacejava.security.Key
-
getEncoded
public byte[] getEncoded()
Returns the encoding of the composite private key as per Section 4.2. Format: ML-KEM seed (64 bytes) || Traditional private key encoding- Specified by:
getEncodedin interfacejava.security.Key
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
-