Verify signature

750 Views Asked by At

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

1

There are 1 best solutions below

2
On

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