/// <summary> /// Protects the specified data. /// </summary> /// <param name="data">The data.</param> /// <param name="entropy">The entropy.</param> /// <returns></returns> public byte[] Protect(byte[] data, string entropy = "") { //as there is no way to include entropy as separate attribute or flag we just append it to the end of the data //to be able to take it into consideration when unprotecting var entropyBytes = GetBytes(entropy); var dataWithEntropy = Combine(data, entropyBytes); var encrypted = _encrypt.Encode(dataWithEntropy); return(_sign.Encode(encrypted)); }
/// <summary> /// Protects the specified data. /// </summary> /// <param name="data">The data.</param> /// <param name="entropy">The entropy.</param> /// <returns></returns> public byte[] Protect(byte[] data, string entropy = "") { var encrypted = _encrypt.Encode(data); return(_sign.Encode(encrypted)); }