Exemple #1
0
        public void CalculateRandomKeyAndIv(CryptoTypes cryptoType)
        {
            CryptoType = cryptoType;

            byte[] random = new byte[5];
            (new RNGCryptoServiceProvider()).GetNonZeroBytes(random);
            mPassword = Convert.ToBase64String(random);

            int saltStrength = Math.Max(32 - mPassword.Length, 0);

            byte[] buff = new byte[saltStrength];
            (new RNGCryptoServiceProvider()).GetBytes(buff);
            SaltByteArray = buff;

            PasswordDeriveBytes pdb  = new PasswordDeriveBytes(mPassword, SaltByteArray);
            SymmetricAlgorithm  algo = SelectAlgorithm();

            mKey = pdb.GetBytes(algo.KeySize / 8);

            mIV = new byte[algo.BlockSize / 8];

            for (int i = 0; i < mIV.Length; i++)
            {
                mIV[i] = 0;
            }
        }
 public CryptoHelper(CryptoTypes CryptoType)
 {
     this.mKey = new byte[] {
         1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0x10,
         0x11, 0x12, 0x13, 20, 0x15, 0x16, 0x17, 0x18
      };
     this.mIV = new byte[] { 0x41, 110, 0x44, 0x1a, 0x45, 0xb2, 200, 0xdb };
     this.SaltByteArray = new byte[] { 0x49, 0x76, 0x61, 110, 0x20, 0x4d, 0x65, 100, 0x76, 0x65, 100, 0x65, 0x76 };
     this.mCryptoType = CryptoTypes.encTypeRijndael;
     this.mPassword = "******";
     this.CryptoType = CryptoType;
 }
Exemple #3
0
        public bool Verify(string value, CryptoTypes type)
        {
            Regex regex;

            switch (type)
            {
            case CryptoTypes.BTC:
                regex = new Regex(BTC);
                return(regex.Match(value).Success);

            case CryptoTypes.ETH:
                regex = new Regex(ETH);
                return(regex.Match(value).Success);
            }
            return(false);
        }
Exemple #4
0
 public CryptoMgr(CryptoTypes CryptoType)
 {
     this.CryptoType = CryptoType;
 }
Exemple #5
0
 internal Crypto(CryptoTypes cryptoType)
 {
     this.CryptoType = cryptoType;
 }
Exemple #6
0
		/// <summary>
		///		decrypts a string acc. to the decryption type
		/// </summary>
		/// <param name="inputText">string to decrypt</param>
		/// <param name="cryptoType">type of decryption</param>
		/// <returns>a decrypted string</returns>
		public string Decrypt(string inputText, CryptoTypes cryptoType)
		{
			this.CryptoType = cryptoType;
			return Decrypt(inputText);
		}
Exemple #7
0
 public string Encrypt(string inputText, CryptoTypes cryptoType)
 {
     CryptoType = cryptoType;
     return Encrypt(inputText);
 }
Exemple #8
0
 /// <summary>
 ///     Encrypt string acc. to cryptoType and with user defined password
 /// </summary>
 /// <param name="inputText">text to encrypt</param>
 /// <param name="password">password to use when encrypting</param>
 /// <param name="cryptoType">type of encryption</param>
 /// <returns>an encrypted string</returns>
 internal string Encrypt(string inputText, string password, CryptoTypes cryptoType)
 {
     mCryptoType = cryptoType;
     return this.Encrypt(inputText, password);
 }
Exemple #9
0
 public CryptoHelper(CryptoTypes CryptoType)
 {
     this.CryptoType = CryptoType;
     calculateNewKeyAndIV();
 }
 public EncryptionServices(CryptoTypes CryptoType)
 {
     this.CryptoType = CryptoType;
 }
Exemple #11
0
 /// <summary>
 ///     Encrypt string acc. to cryptoType and with user defined password
 /// </summary>
 /// <param name="inputText">text to encrypt</param>
 /// <param name="password">password to use when encrypting</param>
 /// <param name="cryptoType">type of encryption</param>
 /// <returns>an encrypted string</returns>
 internal string Encrypt(string inputText, string password, CryptoTypes cryptoType)
 {
     mCryptoType = cryptoType;
     return(this.Encrypt(inputText, password));
 }
Exemple #12
0
 /// <summary>
 ///     Encrypt string acc. to cryptoType
 /// </summary>
 /// <param name="inputText">text to encrypt</param>
 /// <param name="cryptoType">type of encryption</param>
 /// <returns>an encrypted string</returns>
 internal string Encrypt(string inputText, CryptoTypes cryptoType)
 {
     this.CryptoType = cryptoType;
     return(this.Encrypt(inputText));
 }
Exemple #13
0
 public CryptoService(CryptoTypes cryptoType)
     : this()
 {
     this.CryptoType = cryptoType;
 }
Exemple #14
0
 /// <summary>
 ///     Encrypt string acc. to cryptoType
 /// </summary>
 /// <param name="inputText">text to encrypt</param>
 /// <param name="cryptoType">type of encryption</param>
 /// <returns>an encrypted string</returns>
 public string Encrypt(string inputText, CryptoTypes cryptoType)
 {
     CryptoType = cryptoType;
     return(Encrypt(inputText));
 }
Exemple #15
0
 public static CryptoService Create(CryptoTypes type)
 {
     return(new CryptoService(type));
 }
Exemple #16
0
 public VNPTCrypto(CryptoTypes CryptoType)
 {
     this.CryptoType = CryptoType;
 }
Exemple #17
0
 public Encryption(CryptoTypes CryptoType)
 {
     this.CryptoType = CryptoType;
 }
Exemple #18
0
 /// <summary>
 ///		decrypts a string acc. to the decryption type
 /// </summary>
 /// <param name="inputText">string to decrypt</param>
 /// <param name="cryptoType">type of decryption</param>
 /// <returns>a decrypted string</returns>
 public string Decrypt(string inputText, CryptoTypes cryptoType)
 {
     this.CryptoType = cryptoType;
     return(Decrypt(inputText));
 }
Exemple #19
0
 public static CryptoTool Create(CryptoTypes type)
 {
     return(new CryptoTool(type));
 }
Exemple #20
0
 public LVCrypto(CryptoTypes CryptoType)
 {
     this.CryptoType = CryptoType;
 }
Exemple #21
0
 internal CryptoTool(CryptoTypes cryptoType)
 {
     this.CryptoType = cryptoType;
 }
Exemple #22
0
 /// <summary>
 /// 생성자(암/복호화 타입을 지정)
 /// </summary>
 /// <param name="CryptoType"></param>
 public CryptoService(CryptoTypes CryptoType)
 {
     this.CryptoType = CryptoType;
 }
Exemple #23
0
 public string Decrypt(string inputText, string password, CryptoTypes cryptoType)
 {
     this.mCryptoType = cryptoType;
     this.Password    = password;
     return(Decrypt(inputText));
 }
Exemple #24
0
 public Crypto(CryptoTypes CryptoType)
 {
     this.CryptoType = CryptoType;
 }
Exemple #25
0
 public Cryptography(CryptoTypes CryptoType)
 {
     this.CryptoType = CryptoType;
 }
Exemple #26
0
 public CryptoHelper(CryptoTypes CryptoType)
 {
     this.CryptoType = CryptoType;
 }
Exemple #27
0
 public Crypto(CryptoTypes CryptoType, bool compatible)
 {
     mCompactCompatible = compatible;
     this.CryptoType = CryptoType;
 }
Exemple #28
0
 /// <summary>
 ///     Encrypt string acc. to cryptoType
 /// </summary>
 /// <param name="inputText">text to encrypt</param>
 /// <param name="cryptoType">type of encryption</param>
 /// <returns>an encrypted string</returns>
 internal string Encrypt(string inputText, CryptoTypes cryptoType)
 {
     this.CryptoType = cryptoType;
     return this.Encrypt(inputText);
 }
Exemple #29
0
 public string Encrypt(string inputText, string password, CryptoTypes cryptoType)
 {
     mCryptoType = cryptoType;
     Password    = password;
     return(Encrypt(inputText));
 }
Exemple #30
0
		/// <summary>
		///		decrypts a string acc. to decryption type and user defined password key
		/// </summary>
		/// <param name="inputText">string to decrypt</param>
		/// <param name="password">password key used to decrypt</param>
		/// <param name="cryptoType">type of decryption</param>
		/// <returns>a decrypted string</returns>
		public string Decrypt(string inputText, string password, CryptoTypes cryptoType)
		{
			mCryptoType = cryptoType;
			return Decrypt(inputText,password);
		}
Exemple #31
0
 /// <summary>
 ///     decrypts a string usi decryption type with user defined key
 /// </summary>
 /// <param name="inputText">string to decrypt</param>
 /// <param name="secretKey">key key used to decrypt</param>
 /// <param name="cryptoType">type of decryption</param>
 /// <returns>a decrypted string</returns>
 public string Decrypt(string inputText, string secretKey, CryptoTypes cryptoType)
 {
     mCryptoType = cryptoType;
     return(Decrypt(inputText, secretKey));
 }
Exemple #32
0
        public Security(CryptoTypes CryptoType)
		{
			this.CryptoType = CryptoType;
		}
Exemple #33
0
 public GMCSecurity(CryptoTypes CryptoType)
 {
     this.CryptoType = CryptoType;
 }
Exemple #34
0
 /// <summary>
 ///		decrypts a string acc. to decryption type and user defined password key
 /// </summary>
 /// <param name="inputText">string to decrypt</param>
 /// <param name="password">password key used to decrypt</param>
 /// <param name="cryptoType">type of decryption</param>
 /// <returns>a decrypted string</returns>
 public string Decrypt(string inputText, string password, CryptoTypes cryptoType)
 {
     mCryptoType = cryptoType;
     return(Decrypt(inputText, password));
 }
 public string Encrypt(string inputText, string password, CryptoTypes cryptoType)
 {
     this.mCryptoType = cryptoType;
     return this.Encrypt(inputText, password);
 }
Exemple #36
0
 public CryptoHelper(CryptoTypes CryptoType)
 {
     this.CryptoType = CryptoType;
 }
 public Cryptography(CryptoTypes CryptoType)
 {
     this.CryptoType = CryptoType;
 }