/// <summary> /// Decrypts the base64key using an internal private key. /// </summary> /// <param name="base64Text">The encrypted string in base64 format.</param> /// <returns>The plaintext string.</returns> public virtual string Decrypt(string base64Text) { if (!this._encryptionOptions.Encrypt) { return(base64Text); } string plaintext = CryptographyUtils.Decrypt(this._algorithm, base64Text, this._encryptionOptions.InternalKey); return(plaintext); }
/// <summary> /// Encrypts the plaintext using an internal private key. /// </summary> /// <param name="plaintext">The text to encrypt.</param> /// <returns>An encrypted string in base64 format.</returns> public string Encrypt(string plaintext) { if (!this._encryptionOptions.Encrypt) { return(plaintext); } string base64Text = CryptographyUtils.Encrypt(this._algorithm, plaintext); return(base64Text); }
/// <summary> /// Default options /// </summary> public CryptoSym() { this._encryptionOptions = new CryptoConfig(); this._algorithm = CryptographyUtils.CreateSymmAlgoTripleDes(); }
/// <summary> /// Default options /// </summary> public CryptoHash() { this._encryptionOptions = new CryptoConfig(); this._algorithm = CryptographyUtils.CreateHashAlgoMd5(); }