/// <summary> /// Get settings as byte array /// </summary> /// <returns>Byte array</returns> public byte[] GetSettingsAsBytes() { byte[] returnValue = null; Enum.TryParse(this.algorithm, out SymmetricEncryptionAlgorithm actualAlgorithm); if (actualAlgorithm == SymmetricEncryptionAlgorithm.AES_CTR) { returnValue = ChecksumHelper.JoinByteArrays( Encoding.UTF8.GetBytes(this.algorithm), BitConverter.GetBytes(this.keySizeInBits), settingsAES_CTR.GetSettingsAsBytes() ); } else if (actualAlgorithm == SymmetricEncryptionAlgorithm.ChaCha20) { returnValue = ChecksumHelper.JoinByteArrays( Encoding.UTF8.GetBytes(this.algorithm), BitConverter.GetBytes(this.keySizeInBits), settingsChaCha20.GetSettingsAsBytes() ); } else { throw new NotImplementedException(); } return(returnValue); }
/// <summary> /// Get settings as byte array /// </summary> /// <returns>Byte array</returns> public byte[] GetSettingsAsBytes() { // Join them together return(ChecksumHelper.JoinByteArrays(this.nonce, BitConverter.GetBytes(counter))); }