예제 #1
0
        public void Should_ComputeTheSameC0Value_For_SpecifiedListOfParameters()
        {
            var phe = new PheCrypto();

            var pwd = Bytes.FromString("passw0rd");
            var skC = phe.DecodeSecretKey(Bytes.FromString("gPdKsQRz9Vmc/DnbfxCHUioU6omEa0Sg7pncSHOhA7I=", StringEncoding.BASE64));
            var nC  = Bytes.FromString("CTnPcIn2xcz+4/9jjLuFZNJiWLBiohnaGVTb3X1zPt0=", StringEncoding.BASE64);
            var c0  = Bytes.FromString("BKAH5Rww+a9+8lzO3oYE8zfz2Oxp3+Xrv2jp9EFGRlS7bWU5iYoWQHZqrkM+UYq2TYON3Gz8w3mzLSy3yS0XlJw=", StringEncoding.BASE64);
            var t0  = Bytes.FromString("BPGwrvLl3CAolVo1RIoNT7TqTC3T66eLykxa/Vw1gyof+3scfaiqTAAQXQ57q6zEkEeJHjNl4GBghQceI/UNl7c=", StringEncoding.BASE64);

            var c00 = phe.ComputeC0(skC, pwd, nC, t0);

            Assert.Equal(c0, c00);
        }
        public void Should_ComputeTheSameC0Value_For_SpecifiedListOfParameters()
        {
            var phe = new PheCrypto();
            var ns  = new byte[]
            {
                0x04, 0x60, 0x41, 0x90, 0xea, 0xe3, 0x03, 0x48,
                0xc4, 0x67, 0xa2, 0x56, 0xaa, 0x20, 0xf0, 0xe1,
                0x22, 0xfd, 0x4c, 0x54, 0xb0, 0x2a, 0x03, 0x26,
                0x84, 0xf1, 0x22, 0x11, 0xfc, 0x9a, 0x8e, 0xe3,
            };
            var pwd        = Bytes.FromString("passw0rd");
            var skC        = phe.DecodeSecretKey(this.clientPrivate);
            var hash       = new Dictionary <string, int>();
            var expectedC0 = Bytes.FromString("047062653b3a156a0a211686506f86427f13cdbe3825ca4ee820a8f202b91cf76cd276cc2f506191b491e85f5ac412cc36b2502cfbf23b130b0808d93c37271651", StringEncoding.HEX);
            var t0         = Bytes.FromString("04f1b0aef2e5dc2028955a35448a0d4fb4ea4c2dd3eba78bca4c5afd5c35832a1ffb7b1c7da8aa4c00105d0e7babacc49047891e3365e0606085071e23f50d97b7", StringEncoding.HEX);

            var c0 = phe.ComputeC0(skC, pwd, ns, t0);

            Assert.Equal(expectedC0, c0);
        }