Bouncy Castle Cryptography Library 1.87

org.bouncycastle.operator
Class DefaultKemAlgorithmIdentifierFinder

java.lang.Object
  extended byorg.bouncycastle.operator.DefaultKemAlgorithmIdentifierFinder
All Implemented Interfaces:
AlgorithmIdentifierFinder, KemAlgorithmIdentifierFinder

public class DefaultKemAlgorithmIdentifierFinder
extends java.lang.Object
implements KemAlgorithmIdentifierFinder

Default implementation of KemAlgorithmIdentifierFinder, returning the used 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 field, matching what the provider emits in a SubjectPublicKeyInfo for these algorithms. On the receiving side compare with AlgorithmIdentifier.areEquivalent(AlgorithmIdentifier, AlgorithmIdentifier) rather than , 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 - , , - which are also the names the BouncyCastle provider registers the algorithms under. The composite ML-KEM sets of draft-ietf-lamps-pq-composite-kem are named as the provider's composite KEM services name them (for example "MLKEM768-X25519-SHA3-256"), with the "BP256"/"BP384" spellings of the two brainpool sets accepted as aliases. 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
DefaultKemAlgorithmIdentifierFinder()
           
 
Method Summary
 org.bouncycastle.asn1.x509.AlgorithmIdentifier find(java.lang.String kemAlgName)
          Find the KEM algorithm identifier that matches with the passed in KEM algorithm name.
 boolean hasAlgorithm(java.lang.String kemAlgName)
          Return true if a KEM algorithm of the passed in name is recognised, false otherwise.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultKemAlgorithmIdentifierFinder

public DefaultKemAlgorithmIdentifierFinder()
Method Detail

hasAlgorithm

public boolean hasAlgorithm(java.lang.String kemAlgName)
Description copied from interface: KemAlgorithmIdentifierFinder
Return true if a KEM algorithm of the passed in name is recognised, false otherwise. Where this returns true KemAlgorithmIdentifierFinder.find(String) returns an identifier; where it returns false throws, so this is the way to test for support without catching.

Specified by:
hasAlgorithm in interface KemAlgorithmIdentifierFinder
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: KemAlgorithmIdentifierFinder
Find the KEM algorithm identifier that matches with the passed in KEM algorithm name.

Specified by:
find in interface KemAlgorithmIdentifierFinder
Parameters:
kemAlgName - the name of the KEM algorithm of interest.
Returns:
an algorithm identifier for the corresponding KEM.

Bouncy Castle Cryptography Library 1.87