|
jPOS 1.6.7 API Documentation | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jpos.security.jceadapter.JCEHandler
public class JCEHandler
Provides some higher level methods that are needed by the JCE Security Module, yet they are generic and can be used elsewhere.
It depends on the JavaTM Cryptography Extension (JCE).
| Constructor Summary | |
|---|---|
JCEHandler(java.security.Provider provider)
Uses the JCE provider specified |
|
JCEHandler(java.lang.String jceProviderClassName)
Registers the JCE provider whose name is providerName and sets it to be the only provider to be used in this instance of the JCEHandler class. |
|
| Method Summary | |
|---|---|
byte[] |
decryptData(byte[] encryptedData,
java.security.Key key)
Decrypts data |
java.security.Key |
decryptDESKey(short keyLength,
byte[] encryptedDESKey,
java.security.Key encryptingKey,
boolean checkParity)
Decrypts an encrypted DES/Triple-DES key |
byte[] |
encryptData(byte[] data,
java.security.Key key)
Encrypts data |
byte[] |
encryptDESKey(short keyLength,
java.security.Key clearDESKey,
java.security.Key encryptingKey)
Encrypts (wraps) a clear DES Key, it also sets odd parity before encryption |
java.security.Key |
generateDESKey(short keyLength)
Generates a clear DES (DESede) key |
byte[] |
generateMAC(byte[] data,
java.security.Key kd,
java.lang.String macAlgorithm)
Generates MAC (Message Message Authentication Code) for some data. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public JCEHandler(java.lang.String jceProviderClassName)
throws JCEHandlerException
jceProviderClassName - Name of the JCE provider
(e.g. "com.sun.crypto.provider.SunJCE" for Sun's implementation,
or "org.bouncycastle.jce.provider.BouncyCastleProvider" for bouncycastle.org
implementation)
JCEHandlerExceptionpublic JCEHandler(java.security.Provider provider)
provider - | Method Detail |
|---|
public java.security.Key generateDESKey(short keyLength)
throws JCEHandlerException
keyLength - the bit length (key size) of the generated key (LENGTH_DES, LENGTH_DES3_2KEY or LENGTH_DES3_3KEY)
JCEHandlerException
public byte[] encryptDESKey(short keyLength,
java.security.Key clearDESKey,
java.security.Key encryptingKey)
throws JCEHandlerException
keyLength - bit length (key size) of the clear DES key (LENGTH_DES, LENGTH_DES3_2KEY or LENGTH_DES3_3KEY)clearDESKey - DES/Triple-DES key whose format is "RAW"
(for a DESede with 2 Keys, keyLength = 128 bits, while DESede key with 3 keys keyLength = 192 bits)encryptingKey - can be a key of any type (RSA, DES, DESede...)
JCEHandlerException
public java.security.Key decryptDESKey(short keyLength,
byte[] encryptedDESKey,
java.security.Key encryptingKey,
boolean checkParity)
throws JCEHandlerException
keyLength - bit length (key size) of the DES key to be decrypted. (LENGTH_DES, LENGTH_DES3_2KEY or LENGTH_DES3_3KEY)encryptedDESKey - the byte[] representing the encrypted keyencryptingKey - can be of any algorithm (RSA, DES, DESede...)checkParity - if true, the parity of the key is checked
JCEHandlerException - if checkParity==true and the key does not have correct parity
public byte[] encryptData(byte[] data,
java.security.Key key)
throws JCEHandlerException
data - key -
JCEHandlerException
public byte[] decryptData(byte[] encryptedData,
java.security.Key key)
throws JCEHandlerException
encryptedData - key -
JCEHandlerException
public byte[] generateMAC(byte[] data,
java.security.Key kd,
java.lang.String macAlgorithm)
throws JCEHandlerException
data - the data to be MACedkd - the key used for MACingmacAlgorithm - MAC algorithm name suitable for Mac.getInstance(java.lang.String)
JCEHandlerException
|
jPOS.org | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||