public void Should_ComputeIdenticalC0AndC1Values_When_TheSameKeyAndNonceArePassed()
        {
            var phe   = new PheCrypto();
            var skS   = phe.DecodeSecretKey(this.clientPrivate);
            var nonce = phe.GenerateNonce();

            var(c0, c1)   = phe.ComputeC(skS, nonce);
            var(c00, c11) = phe.ComputeC(skS, nonce);

            Assert.Equal(Bytes.ToString(c0, StringEncoding.HEX), Bytes.ToString(c00, StringEncoding.HEX));
            Assert.Equal(Bytes.ToString(c1, StringEncoding.HEX), Bytes.ToString(c11, StringEncoding.HEX));
        }
示例#2
0
        public void Should_ComputeIdenticalC0AndC1Values_When_TheSameKeyAndNonceArePassed()
        {
            var phe = new PheCrypto();

            var skS = phe.DecodeSecretKey(Bytes.FromString("I4ETKFzr3QmUu+Olhp1L2KvRgjfseO530R/A+aQ80Go=", StringEncoding.BASE64));
            var nS  = Bytes.FromString("4g1N7hTxVWEHesoGZ5eTwbufdSnRtzxzkEQaBkXWsL4=", StringEncoding.BASE64);
            var c0  = Bytes.FromString("BI4mieAp/rdVctneZnhj0Ucu8Sc4LGMu2P5z9j49iXtN3AhDBWgIS1A4kfLI1ktcQAJACK4vwgutomtuWSoYllc=", StringEncoding.BASE64);
            var c1  = Bytes.FromString("BHENDFDcDsaWwpZLAWXDvEXlrEpIwr1p+OESiRCSemnk41WdfObVsvGPsYNFopaCJN762vP4MINb9HGzjmbM+aU=", StringEncoding.BASE64);

            var(c00, c11) = phe.ComputeC(skS, nS);

            Assert.Equal(c0, c00);
            Assert.Equal(c1, c11);
        }