コード例 #1
0
 /// <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);
 }
コード例 #2
0
 /// <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);
 }
コード例 #3
0
 /// <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);
     }
 }
コード例 #4
0
 /// <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);
     }
 }
コード例 #5
0
        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;
        }
コード例 #6
0
        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;
        }
コード例 #7
0
ファイル: PackService.cs プロジェクト: xafdelta/xafdelta
        /// <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);
        }
コード例 #8
0
 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.");
 }
コード例 #9
0
ファイル: PackService.cs プロジェクト: xafdelta/xafdelta
        /// <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;
        }