public class KeyStoreHelper extends Object
Modifier and Type | Field and Description |
---|---|
static String |
PROP_PUB_KS_PWD |
static String |
PROP_PUB_KS_URL |
static String |
PROP_PVT_ALIAS |
static String |
PROP_PVT_KS_PWD |
static String |
PROP_PVT_KS_URL |
static String |
PROP_PVT_PWD |
static String |
PROP_SIGN |
Constructor and Description |
---|
KeyStoreHelper()
Creates a KeyStoreHelper and initialises the KeyStore, by loading its entries.
|
Modifier and Type | Method and 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.
|
KeyStore |
getPubKeyStore() |
char[] |
getPubKeyStorePwd() |
URL |
getPubKeyStoreURL() |
String |
getPvtKeyAlias() |
char[] |
getPvtKeyPassword() |
KeyStore |
getPvtKeyStore() |
char[] |
getPvtKeyStorePwd() |
URL |
getPvtKeyStoreURL() |
boolean |
isSigned() |
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.
|
public static final String PROP_SIGN
public static final String PROP_PVT_KS_URL
public static final String PROP_PVT_KS_PWD
public static final String PROP_PVT_ALIAS
public static final String PROP_PVT_PWD
public static final String PROP_PUB_KS_URL
public static final String PROP_PUB_KS_PWD
public KeyStoreHelper()
RuntimeDroolsException
- in case any error happens when initialising and loading the keystore.public byte[] signDataWithPrivateKey(byte[] data) throws UnrecoverableKeyException, KeyStoreException, NoSuchAlgorithmException, InvalidKeyException, SignatureException
data
- the byte[] of data to be signedUnrecoverableKeyException
KeyStoreException
NoSuchAlgorithmException
InvalidKeyException
SignatureException
public boolean checkDataWithPublicKey(String publicKeyAlias, byte[] data, byte[] signature) throws KeyStoreException, NoSuchAlgorithmException, InvalidKeyException, SignatureException
data
- the original data that was signedsignature
- the provided signatureKeyStoreException
NoSuchAlgorithmException
InvalidKeyException
SignatureException
public boolean isSigned()
public URL getPvtKeyStoreURL()
public char[] getPvtKeyStorePwd()
public String getPvtKeyAlias()
public char[] getPvtKeyPassword()
public URL getPubKeyStoreURL()
public char[] getPubKeyStorePwd()
public KeyStore getPvtKeyStore()
public KeyStore getPubKeyStore()
Copyright © 2001–2016 JBoss by Red Hat. All rights reserved.