/** * Returns a signed string. * * @param str string to sign. * * @return the signed string. */ public synchronized String sign(String str) { if (str == null || str.length() == 0) { throw new IllegalArgumentException("NULL or empty string to sign"); } byte[] secret = secretProvider.getCurrentSecret(); String signature = computeSignature(secret, str); return str + SIGNATURE + signature; }
/** * Returns a signed string. * * @param str string to sign. * * @return the signed string. */ public synchronized String sign(String str) { if (str == null || str.length() == 0) { throw new IllegalArgumentException("NULL or empty string to sign"); } byte[] secret = secretProvider.getCurrentSecret(); String signature = computeSignature(secret, str); return str + SIGNATURE + signature; }
/** * Returns a signed string. * * @param str string to sign. * * @return the signed string. */ public synchronized String sign(String str) { if (str == null || str.length() == 0) { throw new IllegalArgumentException("NULL or empty string to sign"); } byte[] secret = secretProvider.getCurrentSecret(); String signature = computeSignature(secret, str); return str + SIGNATURE + signature; }
/** * Returns a signed string. * * @param str string to sign. * * @return the signed string. */ public synchronized String sign(String str) { if (str == null || str.length() == 0) { throw new IllegalArgumentException("NULL or empty string to sign"); } byte[] secret = secretProvider.getCurrentSecret(); String signature = computeSignature(secret, str); return str + SIGNATURE + signature; }
/** * Returns a signed string. * * @param str string to sign. * * @return the signed string. */ public synchronized String sign(String str) { if (str == null || str.length() == 0) { throw new IllegalArgumentException("NULL or empty string to sign"); } byte[] secret = secretProvider.getCurrentSecret(); String signature = computeSignature(secret, str); return str + SIGNATURE + signature; }
/** * Returns a signed string. * <p/> * The signature '&s=SIGNATURE' is appended at the end of the string. * * @param str string to sign. * * @return the signed string. */ public synchronized String sign(String str) { if (str == null || str.length() == 0) { throw new IllegalArgumentException("NULL or empty string to sign"); } byte[] secret = secretProvider.getCurrentSecret(); String signature = computeSignature(secret, str); return str + SIGNATURE + signature; }
protected void checkSignatures(String rawValue, String originalSignature) throws SignerException { boolean isValid = false; byte[][] secrets = secretProvider.getAllSecrets(); for (int i = 0; i < secrets.length; i++) { byte[] secret = secrets[i]; if (secret != null) { String currentSignature = computeSignature(secret, rawValue); if (originalSignature.equals(currentSignature)) { isValid = true; break; } } } if (!isValid) { throw new SignerException("Invalid signature"); } } }
protected void checkSignatures(String rawValue, String originalSignature) throws SignerException { boolean isValid = false; byte[][] secrets = secretProvider.getAllSecrets(); for (int i = 0; i < secrets.length; i++) { byte[] secret = secrets[i]; if (secret != null) { String currentSignature = computeSignature(secret, rawValue); if (originalSignature.equals(currentSignature)) { isValid = true; break; } } } if (!isValid) { throw new SignerException("Invalid signature"); } } }
protected void checkSignatures(String rawValue, String originalSignature) throws SignerException { boolean isValid = false; byte[][] secrets = secretProvider.getAllSecrets(); for (int i = 0; i < secrets.length; i++) { byte[] secret = secrets[i]; if (secret != null) { String currentSignature = computeSignature(secret, rawValue); if (originalSignature.equals(currentSignature)) { isValid = true; break; } } } if (!isValid) { throw new SignerException("Invalid signature"); } } }
protected void checkSignatures(String rawValue, String originalSignature) throws SignerException { boolean isValid = false; byte[][] secrets = secretProvider.getAllSecrets(); for (int i = 0; i < secrets.length; i++) { byte[] secret = secrets[i]; if (secret != null) { String currentSignature = computeSignature(secret, rawValue); if (originalSignature.equals(currentSignature)) { isValid = true; break; } } } if (!isValid) { throw new SignerException("Invalid signature"); } } }
protected void checkSignatures(String rawValue, String originalSignature) throws SignerException { boolean isValid = false; byte[][] secrets = secretProvider.getAllSecrets(); for (int i = 0; i < secrets.length; i++) { byte[] secret = secrets[i]; if (secret != null) { String currentSignature = computeSignature(secret, rawValue); if (originalSignature.equals(currentSignature)) { isValid = true; break; } } } if (!isValid) { throw new SignerException("Invalid signature"); } } }
protected void checkSignatures(String rawValue, String originalSignature) throws SignerException { byte[] orginalSignatureBytes = StringUtils.getBytesUtf8(originalSignature); boolean isValid = false; byte[][] secrets = secretProvider.getAllSecrets(); for (int i = 0; i < secrets.length; i++) { byte[] secret = secrets[i]; if (secret != null) { String currentSignature = computeSignature(secret, rawValue); if (MessageDigest.isEqual(orginalSignatureBytes, StringUtils.getBytesUtf8(currentSignature))) { isValid = true; break; } } } if (!isValid) { throw new SignerException("Invalid signature"); } } }