get Crypto Service Provider - CSharp System.Security.Cryptography

CSharp examples for System.Security.Cryptography:Encrypt Decrypt

Description

get Crypto Service Provider

Demo Code

// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. http://www.apache.org/licenses/LICENSE-2.0..
using System.Text;
using System.Security.Cryptography;
using System.Linq;
using System.IO;/*from   w  ww. j a  v a2s . com*/
using System.Collections.Generic;
using System;

public class Main{
        static TripleDESCryptoServiceProvider getCryptoServiceProvider(string key)
        {
            TripleDESCryptoServiceProvider crypto = new TripleDESCryptoServiceProvider();
            crypto.Key = Encoding.Default.GetBytes(key + "123456789").Take(crypto.KeySize / 8).ToArray();
            crypto.IV = Encoding.Default.GetBytes(TripleDESVector + "123456789").Take(crypto.BlockSize / 8).ToArray();
            return crypto;
        }
}

Related Tutorials