コード例 #1
0
        public string Decrypt(string message)
        {
            Initialize();
            AssertUtils.AssertNotNull(message);

            return(Charset.GetString(Encryptor.Decrypt(BaseEncoder.Decode(message))));
        }
コード例 #2
0
        public bool Verify(string message, string digested)
        {
            Initialize();
            AssertUtils.AssertNotNull(message);
            AssertUtils.AssertNotNull(digested);

            return(Digester.Verify(Charset.GetBytes(message), BaseEncoder.Decode(digested)));
        }
コード例 #3
0
        public override TBase[] DecodeHeadless(PacketData data, int arrayLength)
        {
            var result = new TBase[arrayLength];

            for (int i = 0; i < arrayLength; i++)
            {
                result[i] = BaseEncoder.Decode(data);
            }
            return(result);
        }
コード例 #4
0
        public new bool Verify(string password, string digested)
        {
            Initialize();
            AssertUtils.AssertNotNull(password);
            AssertUtils.AssertNotNull(digested);

            byte[] dg = BaseEncoder.Decode(digested);
            AssertUtils.AssertTrue(dg.Length > SaltSize);

            byte[] salt   = new byte[SaltSize];
            byte[] secKey = new byte[dg.Length - SaltSize];
            ArrayUtils.Copy(dg, salt, secKey);

            byte[] computedSecKey = secretKeyGenerator.Generate(password, salt, IterationCount, KeySize);
            return(computedSecKey.SequenceEqual(secKey));
        }
コード例 #5
0
        public override TType Decode(PacketData data)
        {
            var isNull = Types.Bool.Decode(data);

            return(isNull ? default(TType) : BaseEncoder.Decode(data));
        }
コード例 #6
0
        public override TBase[] DecodeHeadless(PacketData data, int arrayLength)
        {
            var result = new TBase[arrayLength];

            BoolArrayEncoder.DecodeBoolArray(data, arrayLength, index => result[index] = BaseEncoder.Decode(data));
            return(result);
        }