Package com.microej.crypto.internal
Class AlgorithmNames
- java.lang.Object
-
- com.microej.crypto.internal.AlgorithmNames
-
public class AlgorithmNames extends java.lang.ObjectThe algorithm ids of one LLAPI, for a mock that accepts every algorithm name the host JDK supports.On a device an algorithm id is a constant that the LLAPI returns, and Managed Code never closes it. This registry gives the mock the same property: it assigns one id to each name, keeps that id for the lifetime of the Simulator, and allocates nothing for a name it already knows. A mock whose set of names is closed uses a constant id instead.
Every method is synchronized, because the Simulator can call a native from several threads at the same time.
-
-
Constructor Summary
Constructors Constructor Description AlgorithmNames()Creates a registry that knows no algorithm name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intidOf(java.lang.String name)Gets the id of the given algorithm name, and assigns one if the name is not known yet.java.lang.StringnameOf(int id)Gets the algorithm name that the given id is assigned to.
-
-
-
Method Detail
-
idOf
public int idOf(java.lang.String name)
Gets the id of the given algorithm name, and assigns one if the name is not known yet.- Parameters:
name- the algorithm name- Returns:
- the algorithm id
-
nameOf
public java.lang.String nameOf(int id)
Gets the algorithm name that the given id is assigned to.- Parameters:
id- the algorithm id- Returns:
- the algorithm name
- Throws:
java.lang.IndexOutOfBoundsException- if the given id is not assigned
-
-