Multiple choice technology security

What is the signature of the sign method in the security API?

  1. java.lang.String sign(java.lang.String data, java.lang.String key) throws EncryptionException

  2. java.lang.String sign(java.lang.String data, java.lang.String key)

  3. java.lang.String sign(java.lang.String data)

  4. java.lang.String sign(java.lang.String data) throws SecurityException

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

The sign() method takes only the data parameter and throws SecurityException because signing operations are critical security operations that can fail for various reasons (invalid key format, cryptographic errors, etc.). Unlike method A which incorrectly requires a key parameter, the signature method implies the key is managed internally. Option C is incorrect because signing can fail and should signal errors.