Package org.drools.core.util
Class KeyStoreHelper
- java.lang.Object
-
- org.drools.core.util.KeyStoreHelper
-
public class KeyStoreHelper extends java.lang.ObjectA 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 booleancheckDataWithPublicKey(java.lang.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()java.lang.StringgetPasswordKey(java.lang.String pwdKeyAlias, char[] pwdKeyPassword)java.security.KeyStoregetPubKeyStore()char[]getPubKeyStorePwd()java.net.URLgetPubKeyStoreURL()java.lang.StringgetPvtKeyAlias()char[]getPvtKeyPassword()java.security.KeyStoregetPvtKeyStore()char[]getPvtKeyStorePwd()java.net.URLgetPvtKeyStoreURL()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 Detail
-
get
public static KeyStoreHelper get()
-
reInit
public static void reInit()
-
signDataWithPrivateKey
public byte[] signDataWithPrivateKey(byte[] data) throws java.security.UnrecoverableKeyException, java.security.KeyStoreException, java.security.NoSuchAlgorithmException, java.security.InvalidKeyException, java.security.SignatureExceptionGenerates 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:
java.security.UnrecoverableKeyExceptionjava.security.KeyStoreExceptionjava.security.NoSuchAlgorithmExceptionjava.security.InvalidKeyExceptionjava.security.SignatureException
-
checkDataWithPublicKey
public boolean checkDataWithPublicKey(java.lang.String publicKeyAlias, byte[] data, byte[] signature) throws java.security.KeyStoreException, java.security.NoSuchAlgorithmException, java.security.InvalidKeyException, java.security.SignatureExceptionChecks 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:
java.security.KeyStoreExceptionjava.security.NoSuchAlgorithmExceptionjava.security.InvalidKeyExceptionjava.security.SignatureException
-
getPasswordKey
public java.lang.String getPasswordKey(java.lang.String pwdKeyAlias, char[] pwdKeyPassword)
-
isSigned
public boolean isSigned()
-
getPvtKeyStoreURL
public java.net.URL getPvtKeyStoreURL()
-
getPvtKeyStorePwd
public char[] getPvtKeyStorePwd()
-
getPvtKeyAlias
public java.lang.String getPvtKeyAlias()
-
getPvtKeyPassword
public char[] getPvtKeyPassword()
-
getPubKeyStoreURL
public java.net.URL getPubKeyStoreURL()
-
getPubKeyStorePwd
public char[] getPubKeyStorePwd()
-
getPvtKeyStore
public java.security.KeyStore getPvtKeyStore()
-
getPubKeyStore
public java.security.KeyStore getPubKeyStore()
-
-