|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--hcrypto.provider.Provider
This class represents a provider for the Historical Cipher API. A provider keeps a list of available cipher algorithms and their keys. Each provider has a name. The default provider, DefaultProvider, is a subclass of this class that implements a number of example algorithms. To use the DefaultProvider in an application, use the following code:
public static void main (String args[]) throws Exception { Provider.addProvider(new DefaultProvider("Default")); Provider.addProvider(new MyProvider("Myname")); ... }In this case both the default provider and a user-defined provider are added to the list of providers that can be searched for implementations of cipher algorithms.
See also:
DefaultProvider
To implement and use your own version of an algorithm, take the following steps:
Field Summary | |
static java.lang.String |
DELIMITER
The delimiter used to return a list of algorithm names. |
protected java.util.Hashtable |
keyTable
|
protected java.lang.String |
name
Stores the name of the provider. |
protected java.util.Hashtable |
spiTable
|
Constructor Summary | |
Provider()
default constructor. |
|
Provider(java.lang.String s)
|
Method Summary | |
static void |
addCipher(java.lang.String cipher,
java.lang.String provider,
java.lang.String spiName)
|
static void |
addCipher(java.lang.String cipher,
java.lang.String provider,
java.lang.String spiName,
java.lang.String keyName)
|
static void |
addProvider(Provider p)
Adds the designated provider to the list of available providers. |
java.lang.String |
getCipherEngine(java.lang.String algorithm)
Searches the main provider's internal lists for an instance of a provider that implements the desired algorithm. |
java.lang.String |
getCipherEngine(java.lang.String algorithm,
java.lang.String provider)
Searches the main provider's internal lists for an instance of the provider named in the second parameter that implements the desired algorithm. |
java.lang.String |
getCipherKeyName(java.lang.String algorithm)
Searches the main provider's internal lists for an instance of a provider that implements the desired key. |
java.lang.String |
getCipherKeyName(java.lang.String algorithm,
java.lang.String provider)
Searches the main provider's internal lists for an instance of the provider named in the second parameter that implements the desired algorithm. |
static java.lang.String |
getCipherNames()
Returns a comma-delimited string of the names of the cipher algorithms. |
java.lang.String |
getName()
Returns the name of this provider object. |
void |
put(java.lang.String cipherName,
java.lang.String engineClass,
java.lang.String keyClass)
Inserts the names of the engineClass and keyClass into the appropriate tables thereby associating them with the named cipher. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String DELIMITER
protected java.lang.String name
protected java.util.Hashtable spiTable
protected java.util.Hashtable keyTable
Constructor Detail |
public Provider()
public Provider(java.lang.String s)
Method Detail |
public java.lang.String getName()
public void put(java.lang.String cipherName, java.lang.String engineClass, java.lang.String keyClass)
cipherName
- a String giving the name of the cipher.engineClass
- a String giving the name of the associated engine.keyClass
- a String giving the name of the associated key.public java.lang.String getCipherEngine(java.lang.String algorithm) throws java.lang.Exception
algorithm
- a String giving the name of the desired algorithm.public java.lang.String getCipherKeyName(java.lang.String algorithm) throws java.lang.Exception
algorithm
- a String giving the name of the desired algorithm.public java.lang.String getCipherEngine(java.lang.String algorithm, java.lang.String provider) throws java.lang.Exception
algorithm
- a String giving the name of the desired algorithm.provider
- a String giving the name of the desired provider.public java.lang.String getCipherKeyName(java.lang.String algorithm, java.lang.String provider) throws java.lang.Exception
algorithm
- a String giving the name of the desired algorithm.provider
- a String giving the name of the desired provider.public static void addProvider(Provider p)
p
- a reference to the provider object.public static void addCipher(java.lang.String cipher, java.lang.String provider, java.lang.String spiName)
public static void addCipher(java.lang.String cipher, java.lang.String provider, java.lang.String spiName, java.lang.String keyName)
public static java.lang.String getCipherNames()
p
- a reference to the provider object.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |