src/main/java/toy/crypto/PkiUtils.java
/**
     * Verifies a signature of a given signer on a given message.
     * @param id the signer ID
     * @param plainText the original message
     * @param signature the message signature
     * @return true if valid, false if not
     */
Verifies a signature of a given signer on a given message.
@param id the signer ID
@param plainText the original message
@param signature the message signature
@return true if valid, false if not
Verifies a signature of a given signer on a given message . @param id the signer ID @param plainText the original message @param signature the message signature @return true if valid false if not
static public boolean verify(int id, String plainText, String signature)  {
        synchronized (globalLock) {
            Signature publicSignature = clusterPubKeys.get(id);
            try {
                publicSignature.update(plainText.getBytes(UTF_8));
                byte[] signatureBytes = Base64.getDecoder().decode(signature);
                return publicSignature.verify(signatureBytes);
            } catch (Exception e) {
                logger.fatal("Unable to validate message", e);
            }
        }
        return false;
    }
static public boolean verify ( int id , String plainText , String signature ) { synchronized ( globalLock ) { Signature publicSignature = clusterPubKeys . get ( id ) ; try { publicSignature . update ( plainText . getBytes ( UTF_8 ) ) ; byte [ ] signatureBytes = Base64 . getDecoder ( ) . decode ( signature ) ; return publicSignature . verify ( signatureBytes ) ; } catch ( Exception e ) { logger . fatal ( "Unable to validate message" , e ) ; } } return false ; }
Verifies a signature of a given signer on a given message.
Verifies a signature of a given signer on a given message .