Adnan
Adnan

Reputation: 8180

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

Upvotes: 0

Views: 788

Answers (1)

Maurice Perry
Maurice Perry

Reputation: 9651

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

Upvotes: 1

Related Questions