Class DefaultKemAlgorithmIdentifierFinder
- java.lang.Object
-
- org.bouncycastle.operator.DefaultKemAlgorithmIdentifierFinder
-
- All Implemented Interfaces:
AlgorithmIdentifierFinder,KemAlgorithmIdentifierFinder
public class DefaultKemAlgorithmIdentifierFinder extends java.lang.Object implements KemAlgorithmIdentifierFinder
Default implementation ofKemAlgorithmIdentifierFinder, returning theAlgorithmIdentifierused to name a key encapsulation mechanism.None of the KEMs named here take algorithm parameters - each parameter set has its own OID - so every identifier this returns has an absent
parametersfield, matching what the provider emits in a SubjectPublicKeyInfo for these algorithms. On the receiving side compare withAlgorithmIdentifier.areEquivalent(AlgorithmIdentifier, AlgorithmIdentifier)rather thanequals, so that a peer spelling the same algorithm with an explicit NULL still matches.Names are matched without regard to case and are the canonical ones the matching lightweight parameter class uses -
MLKEMParameters.getName(),FrodoKEMParameters.getName(),CMCEParameters.getName()- which are also the names the BouncyCastle provider registers the algorithms under. Coverage is restricted to the standardised assignments: BouncyCastle's own pre-standard arcs for FrodoKEM and Classic McEliece are deliberately absent, as those parameters are to be phased out.
-
-
Constructor Summary
Constructors Constructor Description DefaultKemAlgorithmIdentifierFinder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.bouncycastle.asn1.x509.AlgorithmIdentifierfind(java.lang.String kemAlgName)Find the KEM algorithm identifier that matches with the passed in KEM algorithm name.booleanhasAlgorithm(java.lang.String kemAlgName)Return true if a KEM algorithm of the passed in name is recognised, false otherwise.
-
-
-
Method Detail
-
hasAlgorithm
public boolean hasAlgorithm(java.lang.String kemAlgName)
Description copied from interface:KemAlgorithmIdentifierFinderReturn true if a KEM algorithm of the passed in name is recognised, false otherwise. Where this returns trueKemAlgorithmIdentifierFinder.find(String)returns an identifier; where it returns falsefindthrows, so this is the way to test for support without catching.- Specified by:
hasAlgorithmin interfaceKemAlgorithmIdentifierFinder- Parameters:
kemAlgName- the name of the KEM algorithm of interest.- Returns:
- true if the name is recognised, false otherwise.
-
find
public org.bouncycastle.asn1.x509.AlgorithmIdentifier find(java.lang.String kemAlgName)
Description copied from interface:KemAlgorithmIdentifierFinderFind the KEM algorithm identifier that matches with the passed in KEM algorithm name.- Specified by:
findin interfaceAlgorithmIdentifierFinder- Specified by:
findin interfaceKemAlgorithmIdentifierFinder- Parameters:
kemAlgName- the name of the KEM algorithm of interest.- Returns:
- an algorithm identifier for the corresponding KEM.
-
-