java signature verification
I am getting the exception ,
java.security.SignatureException: invalid encodin开发者_如何学JAVAg for signature
in my program . the following is the code snippet
Signature sig=Signature.getInstance("SHA1WithDSA");
sig.initVerify(qakeyPair.getPublic());
sig.update(data.getBytes());
sig.verify(sig_bytes)
why is this happening..?
The contents of sig_bytes
are not a valid signature according to what the algorithm expects. Perhaps they're the byte representation of a base64 or hex encoded signature rather than the decoded signature data.
精彩评论