Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 package org.mozilla.gecko.browserid;
7 import java.security.GeneralSecurityException;
9 import org.mozilla.gecko.sync.ExtendedJSONObject;
11 public interface SigningPrivateKey {
12 /**
13 * Return the JSON Web Token "alg" header corresponding to this private key.
14 * <p>
15 * The header is used when formatting web tokens, and generally denotes the
16 * algorithm and an ad-hoc encoding of the key size.
17 *
18 * @return header.
19 */
20 public String getAlgorithm();
22 /**
23 * Generate a JSON representation of a private key.
24 * <p>
25 * <b>This should only be used for debugging. No private keys should go over
26 * the wire at any time.</b>
27 *
28 * @param privateKey
29 * to represent.
30 * @return JSON representation.
31 */
32 public ExtendedJSONObject toJSONObject();
34 /**
35 * Sign a message.
36 * @param message to sign.
37 * @return signature.
38 * @throws GeneralSecurityException
39 */
40 public byte[] signMessage(byte[] message) throws GeneralSecurityException;
41 }