Package org.drools.core.util
Class KeyStoreHelper
java.lang.Object
org.drools.core.util.KeyStoreHelper
A helper class to deal with the key store and signing process during
Serialisation
This class will read and use the following system properties:
drools.serialization.sign = <false|true>
drools.serialization.private.keyStoreURL =
-
Method Summary
Modifier and TypeMethodDescriptionbooleancheckDataWithPublicKey(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 KeyStoreHelperget()getPasswordKey(String pwdKeyAlias, char[] pwdKeyPassword) char[]char[]char[]booleanisSigned()static voidreInit()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 Details
-
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:
UnrecoverableKeyExceptionKeyStoreExceptionNoSuchAlgorithmExceptionInvalidKeyExceptionSignatureException
-
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:
KeyStoreExceptionNoSuchAlgorithmExceptionInvalidKeyExceptionSignatureException
-
getPasswordKey
-
isSigned
public boolean isSigned() -
getPvtKeyStoreURL
-
getPvtKeyStorePwd
public char[] getPvtKeyStorePwd() -
getPvtKeyAlias
-
getPvtKeyPassword
public char[] getPvtKeyPassword() -
getPubKeyStoreURL
-
getPubKeyStorePwd
public char[] getPubKeyStorePwd() -
getPvtKeyStore
-
getPubKeyStore
-