public class JCEEncryption extends Object implements AMEncryption, ConfigurableKey
This class provides encryption and decryption facility for the SDK based on
the existence of a JCE provider in the runtime. Unlike
JSSEncryption
, this class can only handle a fixed algorithm
for key generation and encryption which is PBEWithMD5AndDES
.
Since different JCE providers such as IAIK use slightly different names for
this algorithm, this class provides the facility to over-ride this hardcoded
value by setting the system properties for each of these algorithms. The
property name for specifying the key generation algorithm is
amKeyGenDescriptor
and that for specifying encryption
algorithm is amCryptoDescriptor
.
NOTE: The facility of overriding key generation and encryption
algorithms must be used very carefully. In particular, this facility is not
meant to force the use of an algorithm different from the specified default
algorithm PBEWithMD5AndDES
since that will result in
incompatibility between the JSSEncryption
if it is being used
by any peer entity such as agent or server. This would not be a problem if
all entities in the network were configured to use this encryption provider
and all had the same implementation of the specified algorithms available.
Constructor and Description |
---|
JCEEncryption() |
Modifier and Type | Method and Description |
---|---|
byte[] |
decrypt(byte[] encText)
Method declaration
|
byte[] |
encrypt(byte[] clearText)
Method declaration
|
void |
setPassword(String password)
Sets password-based key to use
|
public byte[] encrypt(byte[] clearText)
encrypt
in interface AMEncryption
clearText
- public byte[] decrypt(byte[] encText)
decrypt
in interface AMEncryption
encText
- public void setPassword(String password) throws Exception
setPassword
in interface ConfigurableKey
Exception
Copyright © 2010–2025 Open Identity Platform Community. All rights reserved.