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 org.mozilla.gecko.sync.ExtendedJSONObject; michael@0: michael@0: public class BrowserIDKeyPair { michael@0: public static final String JSON_KEY_PRIVATEKEY = "privateKey"; michael@0: public static final String JSON_KEY_PUBLICKEY = "publicKey"; michael@0: michael@0: protected final SigningPrivateKey privateKey; michael@0: protected final VerifyingPublicKey publicKey; michael@0: michael@0: public BrowserIDKeyPair(SigningPrivateKey privateKey, VerifyingPublicKey publicKey) { michael@0: this.privateKey = privateKey; michael@0: this.publicKey = publicKey; michael@0: } michael@0: michael@0: public SigningPrivateKey getPrivate() { michael@0: return this.privateKey; michael@0: } michael@0: michael@0: public VerifyingPublicKey getPublic() { michael@0: return this.publicKey; michael@0: } michael@0: michael@0: public ExtendedJSONObject toJSONObject() { michael@0: ExtendedJSONObject o = new ExtendedJSONObject(); michael@0: o.put(JSON_KEY_PRIVATEKEY, privateKey.toJSONObject()); michael@0: o.put(JSON_KEY_PUBLICKEY, publicKey.toJSONObject()); michael@0: return o; michael@0: } michael@0: }