public void GenerateMiniLockKeyPairTest() { const string expected = "Cz5bEJLKdSib9kWxkmskExaaLdRg8tVA2qsFBnfdQwkMe"; const string email = "*****@*****.**"; const string password = "******"; Console.WriteLine("--- Generate miniLock 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.GenerateMiniLockKeyPair(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.EncodeMiniLockPublicKey(keyPair.PublicKey); Console.WriteLine(" - Public ID (base58): " + encodedPublicKey + " [" + encodedPublicKey.Length + "]"); Console.WriteLine("--- Generate miniLock KeyPair end ---"); Assert.AreEqual(expected, encodedPublicKey); }
public void EncodeMiniLockKeyPairBadKeyTest2() { KeyGenerator.EncodeMiniLockPublicKey(SodiumCore.GetRandomBytes(31)); }
public void EncodeMiniLockKeyPairBadKeyTest() { KeyGenerator.EncodeMiniLockPublicKey(null); }