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 accepts a single String parameter (data) and throws SecurityException. Options A and B incorrectly include a key parameter, while option C is missing the required exception declaration that security operations typically need.

AI explanation

In this security API, sign(String data) takes a single argument and is declared to throw a runtime SecurityException if signing fails (for example due to a missing or invalid signing key), rather than a checked EncryptionException. The two-argument overloads that also pass a key don't match this API's actual method signature, and a version with no throws clause misrepresents that the call can fail.