Code example for InvalidKeyException

Methods: getMessageprintStackTrace

0
 
            try { 
                signer.initVerify(pk);
            } catch (InvalidKeyException e) {
                Log.e(TAG, " failed!  initializing verification");
                Log.e(TAG, String.format(" Reason = %s", e.getMessage()));
                e.printStackTrace();
                return false; 
            } 
 
            // base64 decoding for signature file 
            olen = signature.length;
            CryptLog.i(DebugFlag, TAG, String.format(" SigLen = %d", olen));
            CryptLog.i(DebugFlag, TAG, " Verifying the RSA/SHA-1 signature");
            try { 
                signer.update(ptext, 0, ptext.length);
                if (!signer.verify(signature)) {
                    Log.e(TAG, " failed! signature verification");
                    return false; 
                }