简体   繁体   中英

Verify signature

I have 64bit encoded signature need to verify SHA1

this is what I did

byte[] decodeValue = Base64.decode(currentItem.getEnclosure().getSignature(), Base64.DEFAULT);

and I got byte results

now signature

try {

 Signature signature = Signature.getInstance("SHA1withRSA");

    if(signature.verify(decodeValue)){
... ...

   }catch (Exception e){
    Log.e("ERROR",e.getMessage());
   }

I always got this exception Signature object is not initialized properly

How to resolve this

To verify the signature, you must:

  1. initialize the Signature object with the certificate of the issuer,
  2. call update() with all the bytes of the message,
  3. call verify() with the bytes of the signature

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM