示例#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;
            }
        }
示例#2
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;
 }
示例#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);
        }
示例#4
0
 public CryptoMgr(CryptoTypes CryptoType)
 {
     this.CryptoType = CryptoType;
 }
示例#5
0
 internal Crypto(CryptoTypes cryptoType)
 {
     this.CryptoType = cryptoType;
 }
示例#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);
		}
示例#7
0
 public string Encrypt(string inputText, CryptoTypes cryptoType)
 {
     CryptoType = cryptoType;
     return Encrypt(inputText);
 }
示例#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);
 }
示例#9
0
 public CryptoHelper(CryptoTypes CryptoType)
 {
     this.CryptoType = CryptoType;
     calculateNewKeyAndIV();
 }
示例#10
0
 public EncryptionServices(CryptoTypes CryptoType)
 {
     this.CryptoType = CryptoType;
 }
示例#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));
 }
示例#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));
 }
示例#13
0
 public CryptoService(CryptoTypes cryptoType)
     : this()
 {
     this.CryptoType = cryptoType;
 }
示例#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));
 }
示例#15
0
 public static CryptoService Create(CryptoTypes type)
 {
     return(new CryptoService(type));
 }
示例#16
0
 public VNPTCrypto(CryptoTypes CryptoType)
 {
     this.CryptoType = CryptoType;
 }
示例#17
0
 public Encryption(CryptoTypes CryptoType)
 {
     this.CryptoType = CryptoType;
 }
示例#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));
 }
示例#19
0
 public static CryptoTool Create(CryptoTypes type)
 {
     return(new CryptoTool(type));
 }
示例#20
0
 public LVCrypto(CryptoTypes CryptoType)
 {
     this.CryptoType = CryptoType;
 }
示例#21
0
 internal CryptoTool(CryptoTypes cryptoType)
 {
     this.CryptoType = cryptoType;
 }
示例#22
0
 /// <summary>
 /// 생성자(암/복호화 타입을 지정)
 /// </summary>
 /// <param name="CryptoType"></param>
 public CryptoService(CryptoTypes CryptoType)
 {
     this.CryptoType = CryptoType;
 }
示例#23
0
 public string Decrypt(string inputText, string password, CryptoTypes cryptoType)
 {
     this.mCryptoType = cryptoType;
     this.Password    = password;
     return(Decrypt(inputText));
 }
示例#24
0
 public Crypto(CryptoTypes CryptoType)
 {
     this.CryptoType = CryptoType;
 }
示例#25
0
 public Cryptography(CryptoTypes CryptoType)
 {
     this.CryptoType = CryptoType;
 }
示例#26
0
 public CryptoHelper(CryptoTypes CryptoType)
 {
     this.CryptoType = CryptoType;
 }
示例#27
0
 public Crypto(CryptoTypes CryptoType, bool compatible)
 {
     mCompactCompatible = compatible;
     this.CryptoType = CryptoType;
 }
示例#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);
 }
示例#29
0
 public string Encrypt(string inputText, string password, CryptoTypes cryptoType)
 {
     mCryptoType = cryptoType;
     Password    = password;
     return(Encrypt(inputText));
 }
示例#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);
		}
示例#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));
 }
示例#32
0
        public Security(CryptoTypes CryptoType)
		{
			this.CryptoType = CryptoType;
		}
示例#33
0
 public GMCSecurity(CryptoTypes CryptoType)
 {
     this.CryptoType = CryptoType;
 }
示例#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));
 }
示例#35
0
 public string Encrypt(string inputText, string password, CryptoTypes cryptoType)
 {
     this.mCryptoType = cryptoType;
     return this.Encrypt(inputText, password);
 }
示例#36
0
 public CryptoHelper(CryptoTypes CryptoType)
 {
     this.CryptoType = CryptoType;
 }
示例#37
0
 public Cryptography(CryptoTypes CryptoType)
 {
     this.CryptoType = CryptoType;
 }