Examples of EncodedKeyPair


Examples of org.ggp.base.util.crypto.BaseCryptography.EncodedKeyPair

* @author Sam
*/
public class SignableJSONTest extends Assert {
  @Test
    public void testSimpleSigning() throws JSONException {
        EncodedKeyPair p = BaseCryptography.generateKeys();

        JSONObject x = new JSONObject("{3:{7:9,c:4,2:5,a:6},1:2,2:3,moves:14,states:21,alpha:'beta'}");
        assertFalse(SignableJSON.isSignedJSON(x));
        SignableJSON.signJSON(x, p.thePublicKey, p.thePrivateKey);
        assertTrue(SignableJSON.isSignedJSON(x));
View Full Code Here

Examples of org.ggp.base.util.crypto.BaseCryptography.EncodedKeyPair

public class BaseCryptographyTest extends Assert {
  @Test
    public void testSimpleCryptography() throws Exception {
        // Not an ideal unit test because generating the key takes a while,
        // but it's useful to have test coverage at all so we'll make due.
        EncodedKeyPair theKeys = BaseCryptography.generateKeys();
        String theSK = theKeys.thePrivateKey;
        String thePK = theKeys.thePublicKey;

        String theData = "Hello world!";
        String theSignature = BaseCryptography.signData(theSK, theData);
View Full Code Here

Examples of org.ggp.base.util.crypto.BaseCryptography.EncodedKeyPair

            // merely to illustrate how the crypto key API in Match works. If you want to prove
            // that you ran a match, you need to generate your own pair of cryptographic keys,
            // keep them secure and hidden, and pass them to "setCryptographicKeys" in Match.
            // The match will then be signed using those keys. Do not use the sample keys if you
            // want to actually prove anything.
            theMatch.setCryptographicKeys(new EncodedKeyPair(FileUtils.readFileAsString(new File("src/org/ggp/base/apps/utilities/SampleKeys.json"))));
        } catch (JSONException e) {
            System.err.println("Could not load sample cryptograhic keys: " + e);
        }

        // Set up fake players to pretend to play the game
View Full Code Here

Examples of org.ggp.base.util.crypto.BaseCryptography.EncodedKeyPair

    static EncodedKeyPair getKeyPair(String keyPairString) {
      if (keyPairString == null)
        return null;
        try {
            return new EncodedKeyPair(keyPairString);
        } catch (JSONException e) {
            return null;
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.