Exemplo n.º 1
0
        public void GenerateCurveLockKeyPairTest()
        {
            const string expected = "MrDDGk7GYEypr93LMgJn4Av3c98fWamRKvAKbjrTEvjtz5kRxj";
            const string email    = "*****@*****.**";
            const string password = "******";

            Console.WriteLine("--- Generate CurveLock KeyPair start ---");
            var zx = new Zxcvbn.Zxcvbn();

            Console.WriteLine(" - E-Mail (utf8): " + email + " [" + email.Length + "]");
            Console.WriteLine(" - E-Mail Entropy (~): " + zx.EvaluatePassword(email).Entropy);
            Console.WriteLine(" - Password (utf8): " + password + " [" + password.Length + "]");
            Console.WriteLine(" - Password Entropy (~): " + zx.EvaluatePassword(password).Entropy);
            var keyPair = KeyGenerator.GenerateCurveLockKeyPair(email, password);

            Console.WriteLine(" - Private Key (hex): " + Utilities.BinaryToHex(keyPair.PrivateKey) + " [" +
                              keyPair.PrivateKey.Length + "]");
            Console.WriteLine(" - Public Key (hex): " + Utilities.BinaryToHex(keyPair.PublicKey) + " [" +
                              keyPair.PublicKey.Length + "]");
            var encodedPublicKey = KeyGenerator.EncodeCurveLockPublicKey(keyPair.PublicKey);

            Console.WriteLine(" - Public ID (base58): " + encodedPublicKey + " [" +
                              encodedPublicKey.Length + "]");
            Console.WriteLine("--- Generate CurveLock KeyPair end ---");
            Assert.AreEqual(expected, encodedPublicKey);
        }
Exemplo n.º 2
0
 public void EncodeCurveLockKeyPairBadKeyTest2()
 {
     KeyGenerator.EncodeCurveLockPublicKey(SodiumCore.GetRandomBytes(31));
 }
Exemplo n.º 3
0
 public void EncodeCurveLockKeyPairBadKeyTest()
 {
     KeyGenerator.EncodeCurveLockPublicKey(null);
 }