Wed, 31 Dec 2014 07:22:50 +0100
Correct previous dual key logic pending first delivery installment.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | package org.mozilla.gecko.browserid; |
michael@0 | 6 | |
michael@0 | 7 | import java.security.GeneralSecurityException; |
michael@0 | 8 | |
michael@0 | 9 | import org.mozilla.gecko.sync.ExtendedJSONObject; |
michael@0 | 10 | |
michael@0 | 11 | public interface SigningPrivateKey { |
michael@0 | 12 | /** |
michael@0 | 13 | * Return the JSON Web Token "alg" header corresponding to this private key. |
michael@0 | 14 | * <p> |
michael@0 | 15 | * The header is used when formatting web tokens, and generally denotes the |
michael@0 | 16 | * algorithm and an ad-hoc encoding of the key size. |
michael@0 | 17 | * |
michael@0 | 18 | * @return header. |
michael@0 | 19 | */ |
michael@0 | 20 | public String getAlgorithm(); |
michael@0 | 21 | |
michael@0 | 22 | /** |
michael@0 | 23 | * Generate a JSON representation of a private key. |
michael@0 | 24 | * <p> |
michael@0 | 25 | * <b>This should only be used for debugging. No private keys should go over |
michael@0 | 26 | * the wire at any time.</b> |
michael@0 | 27 | * |
michael@0 | 28 | * @param privateKey |
michael@0 | 29 | * to represent. |
michael@0 | 30 | * @return JSON representation. |
michael@0 | 31 | */ |
michael@0 | 32 | public ExtendedJSONObject toJSONObject(); |
michael@0 | 33 | |
michael@0 | 34 | /** |
michael@0 | 35 | * Sign a message. |
michael@0 | 36 | * @param message to sign. |
michael@0 | 37 | * @return signature. |
michael@0 | 38 | * @throws GeneralSecurityException |
michael@0 | 39 | */ |
michael@0 | 40 | public byte[] signMessage(byte[] message) throws GeneralSecurityException; |
michael@0 | 41 | } |