Example #1
0
        public static ICrypto GetCrypto(CryptoAlgorithm algorithm)
        {
            ICrypto crypto = null;

            switch (algorithm)
            {
            case CryptoAlgorithm.DES:
                crypto = new Sym_DES( );
                break;

            case CryptoAlgorithm.RC2:
                crypto = new Sym_RC2( );
                break;

            case CryptoAlgorithm.Rijndael:
                crypto = new Sym_Rijndael( );
                break;

            case CryptoAlgorithm.TripleDES:
                crypto = new Sym_TripleDES( );
                break;

            case CryptoAlgorithm.RSA:
                crypto = new Asym_RSA( );
                break;

            default:
                Debug.Assert(false);
                break;
            }
            Debug.Assert(crypto != null);
            return(crypto);
        }
Example #2
0
        public static ICrypto GetCrypto( CryptoAlgorithm algorithm )
        {
            ICrypto crypto = null;
            switch ( algorithm )
            {
                case CryptoAlgorithm.DES:
                    crypto = new Sym_DES( );
                    break;

                case CryptoAlgorithm.RC2:
                    crypto = new Sym_RC2( );
                    break;

                case CryptoAlgorithm.Rijndael:
                    crypto = new Sym_Rijndael( );
                    break;

                case CryptoAlgorithm.TripleDES:
                    crypto = new Sym_TripleDES( );
                    break;

                case CryptoAlgorithm.RSA:
                    crypto = new Asym_RSA( );
                    break;

                default:
                    Debug.Assert( false );
                    break;
            }
            Debug.Assert( crypto != null );
            return crypto;
        }