Package org.drools.core.util
Class KeyStoreHelper
- java.lang.Object
-
- org.drools.core.util.KeyStoreHelper
-
public class KeyStoreHelper extends Object
A helper class to deal with the key store and signing process during SerialisationThis class will read and use the following system properties:
drools.serialization.sign =
drools.serialization.private.keyStoreURL = drools.serialization.private.keyStorePwd = drools.serialization.private.keyAlias = drools.serialization.private.keyPwd = drools.serialization.public.keyStoreURL = drools.serialization.public.keyStorePwd =
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
checkDataWithPublicKey(String publicKeyAlias, byte[] data, byte[] signature)
Checks the given byte[] data against the signature, using the public key with which this helper was initialised and the algorithm MD5 with RSA.static KeyStoreHelper
get()
String
getPasswordKey(String pwdKeyAlias, char[] pwdKeyPassword)
KeyStore
getPubKeyStore()
char[]
getPubKeyStorePwd()
URL
getPubKeyStoreURL()
String
getPvtKeyAlias()
char[]
getPvtKeyPassword()
KeyStore
getPvtKeyStore()
char[]
getPvtKeyStorePwd()
URL
getPvtKeyStoreURL()
boolean
isSigned()
static void
reInit()
byte[]
signDataWithPrivateKey(byte[] data)
Generates the signature for the given byte[] using MD5 with RSA algorithm and the private key with which this helper was initialised.
-
-
-
Method Detail
-
get
public static KeyStoreHelper get()
-
reInit
public static void reInit()
-
signDataWithPrivateKey
public byte[] signDataWithPrivateKey(byte[] data) throws UnrecoverableKeyException, KeyStoreException, NoSuchAlgorithmException, InvalidKeyException, SignatureException
Generates the signature for the given byte[] using MD5 with RSA algorithm and the private key with which this helper was initialised.- Parameters:
data
- the byte[] of data to be signed- Returns:
- the signature, encrypted with the private key
- Throws:
UnrecoverableKeyException
KeyStoreException
NoSuchAlgorithmException
InvalidKeyException
SignatureException
-
checkDataWithPublicKey
public boolean checkDataWithPublicKey(String publicKeyAlias, byte[] data, byte[] signature) throws KeyStoreException, NoSuchAlgorithmException, InvalidKeyException, SignatureException
Checks the given byte[] data against the signature, using the public key with which this helper was initialised and the algorithm MD5 with RSA.- Parameters:
data
- the original data that was signedsignature
- the provided signature- Returns:
- true in case the signature matches, false otherwise.
- Throws:
KeyStoreException
NoSuchAlgorithmException
InvalidKeyException
SignatureException
-
isSigned
public boolean isSigned()
-
getPvtKeyStoreURL
public URL getPvtKeyStoreURL()
-
getPvtKeyStorePwd
public char[] getPvtKeyStorePwd()
-
getPvtKeyAlias
public String getPvtKeyAlias()
-
getPvtKeyPassword
public char[] getPvtKeyPassword()
-
getPubKeyStoreURL
public URL getPubKeyStoreURL()
-
getPubKeyStorePwd
public char[] getPubKeyStorePwd()
-
getPvtKeyStore
public KeyStore getPvtKeyStore()
-
getPubKeyStore
public KeyStore getPubKeyStore()
-
-