private static void GetCryptoParams(Smb2CryptoInfo cryptoInfo, CryptoOperationType operationType, out BCryptCipherMode mode, out int nonceLength) { if (cryptoInfo.CipherId == EncryptionAlgorithm.ENCRYPTION_AES128_CCM) { mode = BCryptCipherMode.CCM; nonceLength = Smb2Consts.AES128CCM_Nonce_Length; } else if (cryptoInfo.CipherId == EncryptionAlgorithm.ENCRYPTION_AES128_GCM) { mode = BCryptCipherMode.GCM; nonceLength = Smb2Consts.AES128GCM_Nonce_Length; } else { throw new InvalidOperationException(String.Format( "No valid encryption algorithm is set in Smb2CryptoInfo when trying to {0}", operationType)); } }
private static void GetCryptoParams(Smb2CryptoInfo cryptoInfo, CryptoOperationType operationType, out BCryptCipherMode mode, out int nonceLength) { if (cryptoInfo.CipherId == EncryptionAlgorithm.ENCRYPTION_AES128_CCM) { mode = BCryptCipherMode.CCM; nonceLength = Smb2Consts.AES128CCM_Nonce_Length; } else if (cryptoInfo.CipherId == EncryptionAlgorithm.ENCRYPTION_AES128_GCM) { mode = BCryptCipherMode.GCM; nonceLength = Smb2Consts.AES128GCM_Nonce_Length; } else { throw new InvalidOperationException(String.Format( "No valid encryption algorithm is set in Smb2CryptoInfo when trying to {0}", operationType)); } }