![]() |
The Java Developers Almanac 1.4Order this book from Amazon. |
e204. Verifying a SignatureSee also e198 Generating a Public/Private Key Pair and e202 Listing All Available Signature Algorithms.// Verifies the signature for the given buffer of bytes using the public key. public static boolean verifySignature(PublicKey key, byte[] buffer, byte[] signature) { try { Signature sig = Signature.getInstance(key.getAlgorithm()); sig.initVerify(key); sig.update(buffer, 0, buffer.length); return sig.verify(signature); } catch (SignatureException e) { } catch (InvalidKeyException e) { } catch (NoSuchAlgorithmException e) { } return false; }
e203. Creating a Signature e205. Signing a Java Object
© 2002 Addison-Wesley. |