Example #1
0
    // Takes an encrypted key, and a seed, returns a byte array of the the otp decrypted seed
    public static byte[] decryptKey(byte[] key, byte[] seed, int size = 32)
    {
        byte[] otp = new byte[32];

        OTPGenerator(otp, size, seed);
        key = OTPxor(key, otp);
        int valid = VerifyKeys.verifyKey(ByteArrayToHex(key));

        return(key);
    }
Example #2
0
    // Decrypts the blob saved at DideryDemoManager.demoBlob
    public static byte[] decryptFromBlob(string seed, string blobString)
    {
        byte[] seedByte      = HexStringToByteArray(seed);
        byte[] demoBlob      = Convert.FromBase64String(blobString);
        byte[] decryptedKey  = decryptKey(demoBlob, seedByte);
        string decryptedBlob = ByteArrayToHex(decryptedKey);
        int    valid         = VerifyKeys.verifyKey(decryptedBlob);

        return(decryptedKey);
    }
Example #3
0
    // Test that a valid key passes the key validation function
    public int[] testValidKey()
    {
        int[] passed = new int[2];
        passed[1] = 1;

        string key = "0xb5b1870957d373ef0eeffecc6e4812c0fd08f554b37b233526acc331bf1544f7";

        passed[0] = VerifyKeys.verifyKey(key);

        if (passed[0] == 1)
        {
            Debug.Log("testValidKey() failed");
            passed[0] = 0;
        }
        else
        {
            passed[0] = 1;
        }

        return(passed);
    }
Example #4
0
    // Test that a valid key passes the key validation function
    public void testValidKey()
    {
        string key = "0xb5b1870957d373ef0eeffecc6e4812c0fd08f554b37b233526acc331bf1544f7";

        VerifyKeys.verifyKey(key);
    }