public void GenerateBytejailKeyPairExaggeratedTest() { const string expected = "2NjStPkM3Wr2JwqmH7gG7sRUhyGVG2FFewUajjbHrWRvjDtLqwB"; // Test with KeePass generated inputs: length of 1024 exclude " and \ const string userInputPartOne = "s7MgHRz?|dP@mmD7Q#Y~:m[]~Sjy7ad)t`tO&61B@o8l9p+['.V}y{L~])z{KM*:Cr8iw2t63^bpyn]b+x8Hh5#UG^gu>y1JgVj:4]NkYR<aE+T1C/3EaC9xxL#`n:=c0^_|eZm%-5T^yOM5DI9 ,XcG!Ej5=IuV0/j>bsYM'x[hQY#uwqNkm?0emxikBM$NHyzi9SLVd?E[)9x=.]d)f,]+9;;LJx|$ki|O-7PvZR/tF}9L&Hn!whdoklx+cyGiKCh=$qfXC9nuu;!21b=)as;R$%[d4[VESbTZ<tVMiZyT0|wDSCZTLT9v`QRg[6]m0Vgr]Ps@bp`J&P_4tfv:rJJ*P.z-!=]Nc07UwfUq2,C:vI1`LHrb$>ooM_S7{Lby/awngY9TMKAi[vj+V0u6'ot&gC?@6PtUP$8*iTeP`|~|)5^Y-_Nc@1]1jJO-.3+`r<BPFuDzah'H334*M^^8g;?v{9)P,=R[Uw*$D]w#oZm6yZ}c:5V^.*(F8S{?x!s#{)UL-}`VMdg:Y6Z]KE8%tjsE;Y)w+G>S@'K1Sf;]8<$`@Novad[whD.rahiJdfPetl`9 A)DH ZupA*6FIwU8n6Fa~Wf_-an*Etny9>GH}+5+F2!Y*?gD <P~`b~)xm~+9&2X;#K[iPj%F8.M/9/ifi?l1 )buY%2cIf,Rf/]NLgKoszB^ p$jmww1yfU)+lu#E-|)0lG7V{C!?]T`2cO/.k 3=C .`xcx&k sT1b&/.(8/Za)qO5w4)hDz'~tO]Y{ueGG[<<[L@kt1W~>Ct0ZsQNF{3RI!mIxS?L8CUTOEXxroeMhK;'p8xQ-_0Qr^St+0vJ;]#,?*0#F5146lN7MMQXN7b@Z)I>BQQ8S2'_WiBn)r$?Q~IE[)~b*`a8H8Y u`i4m# k^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$(LcE={`H|3R@~6GrasDK]sT*@/HD0 1?iFqh@YKr?iteSyhs&f9$^+US*MkeB)f=^n69_)1hEU~A<hK8-#MAbpzm4H>oWUx~Fk28zQfR[w!3[ -W cJSp_J "; Console.WriteLine("--- Generate bytejail KeyPair start ---"); var zx = new Zxcvbn.Zxcvbn(); Console.WriteLine(" - UserInputPartOne (utf8): " + userInputPartOne + " [" + userInputPartOne.Length + "]"); Console.WriteLine(" - UserInputPartOne Entropy (~): " + zx.EvaluatePassword(userInputPartOne).Entropy); Console.WriteLine(" - UserInputPartTwo (utf8): " + userInputPartTwo + " [" + userInputPartTwo.Length + "]"); Console.WriteLine(" - UserInputPartTwo Entropy (~): " + zx.EvaluatePassword(userInputPartTwo).Entropy); var keyPair = KeyGenerator.GenerateBytejailKeyPair(userInputPartOne, userInputPartTwo); 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.EncodeBytejailPublicKey(keyPair.PublicKey); Console.WriteLine(" - Public ID (base58): " + encodedPublicKey + " [" + encodedPublicKey.Length + "]"); Console.WriteLine("--- Generate bytejail KeyPair end ---"); Assert.AreEqual(expected, encodedPublicKey); }
public void GenerateBytejailKeyPairTest() { const string expected = "2PNPvrfYAQxhaGYaAzsWTYgEzymmQZ37jG2vJThBJHDcY4SABnH"; const string userInputPartOne = "*****@*****.**"; const string userInputPartTwo = "magnetometers payee induce tangibly polonaises unrestricted oilfield"; Console.WriteLine("--- Generate bytejail KeyPair start ---"); var zx = new Zxcvbn.Zxcvbn(); Console.WriteLine(" - UserInputPartOne (utf8): " + userInputPartOne + " [" + userInputPartOne.Length + "]"); Console.WriteLine(" - UserInputPartOne Entropy (~): " + zx.EvaluatePassword(userInputPartOne).Entropy); Console.WriteLine(" - UserInputPartTwo (utf8): " + userInputPartTwo + " [" + userInputPartTwo.Length + "]"); Console.WriteLine(" - UserInputPartTwo Entropy (~): " + zx.EvaluatePassword(userInputPartTwo).Entropy); var keyPair = KeyGenerator.GenerateBytejailKeyPair(userInputPartOne, userInputPartTwo); 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.EncodeBytejailPublicKey(keyPair.PublicKey); Console.WriteLine(" - Public ID (base58): " + encodedPublicKey + " [" + encodedPublicKey.Length + "]"); Console.WriteLine("--- Generate bytejail KeyPair end ---"); Assert.AreEqual(expected, encodedPublicKey); }
public void EncodeBytejailKeyPairBadKeyTest2() { KeyGenerator.EncodeBytejailPublicKey(SodiumCore.GetRandomBytes(31)); }
public void EncodeBytejailKeyPairBadKeyTest() { KeyGenerator.EncodeBytejailPublicKey(null); }