public static boolean verify ( PublicKey key , String base64Signature , String content , String timestamp , int duration ) throws Exception { if ( key == null || base64Signature == null || content == null || timestamp == null ) { return false ; } try { if ( timestamp != null && duration > 0 ) { validateTime ( timestamp , duration ) ; } Signature signature = Signature . getInstance ( SIGN_ALGORITHM ) ; signature . initVerify ( key ) ; signature . update ( content . getBytes ( ) ) ; byte [ ] signatureBytes = Base64 . decodeBase64 ( base64Signature ) ; return signature . verify ( signatureBytes ) ; } catch ( Exception e ) { log . error ( "Authentication Exception:verifySignature" , e ) ; throw e ; } }
Verifies a digitally signed payload .