michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: package org.mozilla.gecko.browserid; michael@0: michael@0: import java.security.GeneralSecurityException; michael@0: michael@0: import org.mozilla.gecko.sync.ExtendedJSONObject; michael@0: michael@0: michael@0: public interface VerifyingPublicKey { michael@0: /** michael@0: * Generate a JSON representation of a public key. michael@0: * michael@0: * @param publicKey michael@0: * to represent. michael@0: * @return JSON representation. michael@0: */ michael@0: public ExtendedJSONObject toJSONObject(); michael@0: michael@0: /** michael@0: * Verify a signature. michael@0: * michael@0: * @param message michael@0: * to verify signature of. michael@0: * @param signature michael@0: * to verify. michael@0: * @return true if signature is a signature of message produced by the private michael@0: * key corresponding to this public key. michael@0: * @throws GeneralSecurityException michael@0: */ michael@0: public boolean verifyMessage(byte[] message, byte[] signature) throws GeneralSecurityException; michael@0: }