1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/mobile/android/base/browserid/BrowserIDKeyPair.java Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,35 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +package org.mozilla.gecko.browserid; 1.9 + 1.10 +import org.mozilla.gecko.sync.ExtendedJSONObject; 1.11 + 1.12 +public class BrowserIDKeyPair { 1.13 + public static final String JSON_KEY_PRIVATEKEY = "privateKey"; 1.14 + public static final String JSON_KEY_PUBLICKEY = "publicKey"; 1.15 + 1.16 + protected final SigningPrivateKey privateKey; 1.17 + protected final VerifyingPublicKey publicKey; 1.18 + 1.19 + public BrowserIDKeyPair(SigningPrivateKey privateKey, VerifyingPublicKey publicKey) { 1.20 + this.privateKey = privateKey; 1.21 + this.publicKey = publicKey; 1.22 + } 1.23 + 1.24 + public SigningPrivateKey getPrivate() { 1.25 + return this.privateKey; 1.26 + } 1.27 + 1.28 + public VerifyingPublicKey getPublic() { 1.29 + return this.publicKey; 1.30 + } 1.31 + 1.32 + public ExtendedJSONObject toJSONObject() { 1.33 + ExtendedJSONObject o = new ExtendedJSONObject(); 1.34 + o.put(JSON_KEY_PRIVATEKEY, privateKey.toJSONObject()); 1.35 + o.put(JSON_KEY_PUBLICKEY, publicKey.toJSONObject()); 1.36 + return o; 1.37 + } 1.38 +}