Beispiel #1
0
        public static bool KeysAreCompatible(byte[] publicKey, byte[] privateKey)
        {
            if (publicKey == null || privateKey == null)
            {
                return(false);
            }

            MixCastEncrypter encrypter = new MixCastEncrypter(publicKey);
            MixCastDecrypter decrypter = new MixCastDecrypter(privateKey);

            byte[] testData  = { 3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8, 9, 7, 9 };
            byte[] encrypted = encrypter.Encrypt(testData);
            byte[] decrypted = decrypter.Decrypt(encrypted);

            if (!MixCastCryptoUtils.BytesEqual(testData, decrypted))
            {
                return(false);
            }

            return(true);
        }
Beispiel #2
0
 public static void InitDecrypt()
 {
     byte[] privateKey = MixCastEncryptionKey.ReadKeyFromRegistry(DECRYPT_REGISTRY_KEY);
     _Decrypt = privateKey != null ? new MixCastDecrypter(privateKey) : null;
 }