コード例 #1
0
        private static ICryptographyProvider LoadProvider()
        {
            ICryptographyProvider result = null;

            switch (encryptFormat)
            {
                case EncryptFormat.Encrypted:
                    result = new SymmetricAlgorithmProvider();
                    break;
                case EncryptFormat.None:
                    result = new NonCryptoProvider();
                    break;
                default:
                    result = new HashAlgorithmProvider();
                    break;
            }

            return result;
        }
コード例 #2
0
 public static string DesEncode(string plainText)
 {
     ICryptographyProvider cryptographyProvider = new SymmetricAlgorithmProvider(AlgorithmFormat.DES);
     return cryptographyProvider.Encrypt(plainText);
 }
コード例 #3
0
 public static string DesDecode(string cypherText)
 {
     ICryptographyProvider cryptographyProvider = new SymmetricAlgorithmProvider(AlgorithmFormat.DES);
     return cryptographyProvider.Decrypt(cypherText);
 }