public EncryptedString(System.Security.SecureString str, byte[] key)
        {
            if (!str.IsReadOnly())
                throw new ArgumentException("SecureString is not read only");

            this.encr = new EncryptionHelper(key);
            this.str = str;
        }
 public EncryptedString(string base64String, byte[] key)
 {
     this.encr = new EncryptionHelper(key);
     this.str = encr.DecryptToSecureStringFromBase64(base64String);
 }
 public EncryptedString(byte[] key)
 {
     str = new System.Security.SecureString();
     str.MakeReadOnly();
     encr = new EncryptionHelper(key);
 }
 public void SetKey(byte[] key)
 {
     EncryptionHelper encrhelper = new EncryptionHelper(key);
     if (base64 != null)
     {
         str = encrhelper.DecryptToSecureStringFromBase64(base64);
         base64 = null;
     }
     encr = encrhelper;
 }