/// <summary> /// Initializes a new istance of the CryptoRijndael class.\r\n /// Derives 256bits private Key and IV form password using custom Salt /// </summary> /// <param name="password"></param> /// <param name="salt"></param> public CryptoRijndael(String password, Byte[] salt) { ActiveSalt = new Salt(salt); Rfc2898DeriveBytes db = new Rfc2898DeriveBytes(password, ActiveSalt.Value); ActivePrivateKey = new PrivateKey(db.GetBytes(32)); ActiveIV = new InitVector(db.GetBytes(16)); }
/// <summary> /// Initializes a new istance of the CryptoRijndael class.\r\n /// Derives 256bits private Key from password and IV from iVString using Byte[24] default Salt /// </summary> /// <param name="password"></param> public CryptoRijndael(String password, String iVString) { ActiveSalt = new Salt(defaultSalt); Rfc2898DeriveBytes dbKey = new Rfc2898DeriveBytes(password, ActiveSalt.Value); Rfc2898DeriveBytes dbIV = new Rfc2898DeriveBytes(iVString, ActiveSalt.Value); ActivePrivateKey = new PrivateKey(dbKey.GetBytes(32)); ActiveIV = new InitVector(dbIV.GetBytes(16)); }
/// <summary> /// Initializes a new istance of the CryptoRijndael class.\r\n /// privateKey must be Byte[32] and initVector must be Byte[16] /// </summary> /// <param name="privateKey"></param> /// <param name="initVector"></param> public CryptoRijndael(Byte[] privateKey, Byte[] initVector) { ActivePrivateKey = new PrivateKey(privateKey); ActiveIV = new InitVector(initVector); }
/// <summary> /// Initializes a new istance of the CryptoRijndael class.\r\n /// Creates randoms privateKey and IV. /// </summary> public CryptoRijndael() { ActivePrivateKey = new PrivateKey(); ActiveIV = new InitVector(); }