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 in the security API throws SecurityException to handle cryptographic failures gracefully. Option B lacks exception handling, A throws the wrong exception type, and C is missing the key parameter. Security operations must declare appropriate exceptions for failure scenarios.