Android examples for java.security:RSA
verify RSA Digital Signature
//package com.java2s; import android.util.Base64; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.security.PublicKey; import java.security.Signature; import java.security.SignatureException; public class Main { public static boolean verifyDigitalSignature(String payload, String signedPayload, PublicKey publicKey) throws NoSuchAlgorithmException, InvalidKeyException, SignatureException {/*ww w.ja v a2 s . c om*/ Signature signature = Signature.getInstance("SHA256withRSA"); signature.initVerify(publicKey); signature.update(payload.getBytes()); byte[] signedPayloadContent = Base64.decode(signedPayload, Base64.DEFAULT); return signature.verify(signedPayloadContent); } }