internal byte[] EncryptIke1Data(ICryptoLibrary cryptoLibrary, Ike1Data ike1Data) { if (Status != MessageSessionStatusCode.inProgress) { throw new InvalidOperationException(); } var decryptedMessageData = MessageEncoderDecoder.EncodeIke1DataWithPadding(cryptoLibrary, ike1Data); var encryptedMessageData = new byte[decryptedMessageData.Length]; cryptoLibrary.ProcessAesCbcBlocks(true, _aesKey, _iv, decryptedMessageData, encryptedMessageData); Status = MessageSessionStatusCode.encryptionDecryptionCompleted; return(encryptedMessageData); }
internal byte[] EncryptShortSingleMessage(ICryptoLibrary cryptoLibrary, string messageText) { if (Status != MessageSessionStatusCode.inProgress) { throw new InvalidOperationException(); } var decryptedMessageData = MessageEncoderDecoder.EncodePlainTextMessageWithPadding_plainTextUtf8_256(cryptoLibrary, messageText); var encryptedMessageData = new byte[decryptedMessageData.Length]; cryptoLibrary.ProcessAesCbcBlocks(true, _aesKey, _iv, decryptedMessageData, encryptedMessageData); Status = MessageSessionStatusCode.encryptionDecryptionCompleted; return(encryptedMessageData); }