Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
The default implementation for verifying the authenticity of messages using base64 encoded digital signatures.

Mirko Caserta (
public class Base64EncodedVerifierImpl implements Base64EncodedVerifier {
    private VerifierImpl verifier = new VerifierImpl();
    private String charsetName = "UTF-8";

The signature algorithm. The default is SHA1withRSA.

algorithm the signature algorithm
    public void setAlgorithm(String algorithm) {

The public key for verifying the message.

publicKey the public key
    public void setPublicKey(PublicKey publicKey) {

The charset to use when converting a string into a raw byte array representation. The default is UTF-8.

charsetName the charset name (default: UTF-8)
    public void setCharsetName(String charsetName) {
        this. = charsetName;

Verifies the authenticity of a message using a base64 encoded digital signature.

message the original message to verify
signature the base64 encoded digital signature
true if the original message is verified by the digital signature
    public boolean verify(String messageString signature) {
        try {
            return .verify(message.getBytes(), Base64.decodeBase64(signature));
        } catch (UnsupportedEncodingException e) {
            throw new SignatureException("unsupported encoding: charsetName=" + e);
New to GrepCode? Check out our FAQ X