Exemple #1
0
        public void TripleDesTest()
        {
            var buffer = _source.FromEncodingString(_encoding);

            buffer = _symmetric.EncryptTripleDes(buffer);
            buffer = _symmetric.DecryptTripleDes(buffer);
            Assert.Equal(_source, buffer.AsEncodingString(_encoding));

            var encrypt = _symmetric.EncryptTripleDes(buffer, _token).AsBase64String();

            Assert.NotEmpty(encrypt);

            var decrypt = _symmetric.DecryptTripleDes(encrypt.FromBase64String(), _token)
                          .AsEncodingString(_encoding);

            Assert.Equal(_source, decrypt);
        }