public string Decrypt(string message) { Initialize(); AssertUtils.AssertNotNull(message); return(Charset.GetString(Encryptor.Decrypt(BaseEncoder.Decode(message)))); }
public bool Verify(string message, string digested) { Initialize(); AssertUtils.AssertNotNull(message); AssertUtils.AssertNotNull(digested); return(Digester.Verify(Charset.GetBytes(message), BaseEncoder.Decode(digested))); }
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); }
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)); }
public override TType Decode(PacketData data) { var isNull = Types.Bool.Decode(data); return(isNull ? default(TType) : BaseEncoder.Decode(data)); }
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); }