/// <summary> /// Hem verilen parametreye göre hem de şifreci tipine göre bir sonuç döndürür. /// </summary> /// <param name="algorithmType"></param> /// <param name="parameter"></param> public CryptographerManager(CryptoAlgorithmType algorithmType, CryphtographerParameter parameter) { if (algorithmType == CryptoAlgorithmType.Simple) this.criptographerFactory = new SimpleCryphtographerFactory(parameter); if (algorithmType == CryptoAlgorithmType.Complicate) this.criptographerFactory = new HardestCryphtographerFactory(parameter); }
/// <summary> /// Verilen parametreye göre bir sonuç döndürür. /// </summary> /// <param name="algorithmType">Şifreci tipleri</param> public CryptographerManager(CryptoAlgorithmType algorithmType) { if (algorithmType == CryptoAlgorithmType.Simple) this.criptographerFactory = new SimpleCryphtographerFactory(keySizeConst, keyConst); if (algorithmType == CryptoAlgorithmType.Complicate) this.criptographerFactory = new HardestCryphtographerFactory(keySizeConst, keyConst); }
/// <summary> /// Hem verilen parametreye göre hem de şifreci tipine göre bir sonuç döndürür. /// </summary> /// <param name="algorithmType"></param> /// <param name="parameter"></param> public CryptographerManager(CryptoAlgorithmType algorithmType, CryphtographerParameter parameter) { if (algorithmType == CryptoAlgorithmType.Simple) { this.criptographerFactory = new SimpleCryphtographerFactory(parameter); } if (algorithmType == CryptoAlgorithmType.Complicate) { this.criptographerFactory = new HardestCryphtographerFactory(parameter); } }
/// <summary> /// Verilen parametreye göre bir sonuç döndürür. /// </summary> /// <param name="algorithmType">Şifreci tipleri</param> public CryptographerManager(CryptoAlgorithmType algorithmType) { if (algorithmType == CryptoAlgorithmType.Simple) { this.criptographerFactory = new SimpleCryphtographerFactory(keySizeConst, keyConst); } if (algorithmType == CryptoAlgorithmType.Complicate) { this.criptographerFactory = new HardestCryphtographerFactory(keySizeConst, keyConst); } }
public ConnectionSender(IConnectionSender sender, CryptoAlgorithmType cryptoAlgorithmType, byte[] cryptoKey, byte[] nonce, IBytesPool bytesPool) { _sender = sender; if (cryptoAlgorithmType == CryptoAlgorithmType.Aes_Gcm_256) { _encrypter = new AesGcmEncrypter(cryptoKey, nonce, bytesPool); } else { throw new NotSupportedException(nameof(cryptoAlgorithmType)); } _bytesPool = bytesPool; }
public ConnectionReceiver(IConnectionReceiver receiver, CryptoAlgorithmType cryptoAlgorithmType, int maxReceiveByteCount, byte[] cryptoKey, byte[] nonce, IBytesPool bytesPool) { _receiver = receiver; _maxReceiveByteCount = maxReceiveByteCount; if (cryptoAlgorithmType == CryptoAlgorithmType.Aes_Gcm_256) { _decrypter = new AesGcmDecrypter(cryptoKey, nonce, bytesPool); } else { throw new NotSupportedException(nameof(cryptoAlgorithmType)); } _bytesPool = bytesPool; }
/// <summary> /// Converts algorithm type into algorithm implementation class /// </summary> /// <param name = "algorithmType">Type of the algorithm.</param> /// <returns>Crypto algorithm type</returns> public static Type GetCryptoAlgorithmType(CryptoAlgorithmType algorithmType) { Type result = null; switch (algorithmType) { case CryptoAlgorithmType.RijndaelManaged: result = typeof(RijndaelManaged); break; case CryptoAlgorithmType.Des: result = typeof(DESCryptoServiceProvider); break; case CryptoAlgorithmType.Rc2: result = typeof(RC2CryptoServiceProvider); break; case CryptoAlgorithmType.TripleDes: result = typeof(TripleDESCryptoServiceProvider); break; } return(result); }
private static void ParseAlgorithmTypes(ProfileMessage myProfileMessage, ProfileMessage otherProfileMessage, out KeyExchangeAlgorithmType keyExchangeAlgorithmType, out KeyDerivationAlgorithmType keyDerivationAlgorithmType, out CryptoAlgorithmType cryptoAlgorithmType, out HashAlgorithmType hashAlgorithmType) { keyExchangeAlgorithmType = EnumHelper.GetOverlappedMaxValue(myProfileMessage.KeyExchangeAlgorithmTypes, otherProfileMessage.KeyExchangeAlgorithmTypes) ?? throw new OmniSecureConnectionException("key exchange algorithm does not match."); keyDerivationAlgorithmType = EnumHelper.GetOverlappedMaxValue(myProfileMessage.KeyDerivationAlgorithmTypes, otherProfileMessage.KeyDerivationAlgorithmTypes) ?? throw new OmniSecureConnectionException("key derivation algorithm does not match."); cryptoAlgorithmType = EnumHelper.GetOverlappedMaxValue(myProfileMessage.CryptoAlgorithmTypes, otherProfileMessage.CryptoAlgorithmTypes) ?? throw new OmniSecureConnectionException("Crypto algorithm does not match."); hashAlgorithmType = EnumHelper.GetOverlappedMaxValue(myProfileMessage.HashAlgorithmTypes, otherProfileMessage.HashAlgorithmTypes) ?? throw new OmniSecureConnectionException("Hash algorithm does not match."); }
/// <summary> /// Converts algorithm type into algorithm implementation class /// </summary> /// <param name = "algorithmType">Type of the algorithm.</param> /// <returns>Crypto algorithm type</returns> public static Type GetCryptoAlgorithmType(CryptoAlgorithmType algorithmType) { Type result = null; switch (algorithmType) { case CryptoAlgorithmType.RijndaelManaged: result = typeof (RijndaelManaged); break; case CryptoAlgorithmType.Des: result = typeof (DESCryptoServiceProvider); break; case CryptoAlgorithmType.Rc2: result = typeof (RC2CryptoServiceProvider); break; case CryptoAlgorithmType.TripleDes: result = typeof (TripleDESCryptoServiceProvider); break; } return result; }