Source

KeeOtp / OtpAuthData.cs

Diff from to

OtpAuthData.cs

         const string sizeParameter = "size";
         const string counterParameter = "counter";
 
-        public byte[] Key { get; set; }
+        public Key Key { get; set; }
         public OtpType Type { get; set; }
 
         public int Step { get; set; }
 
             var otpData = new OtpAuthData();
 
-            otpData.Key = Base32.Decode(parameters[keyParameter]);
+            otpData.Key = ProtectedKey.CreateProtectedKeyAndDestroyPlaintextKey(Base32.Decode(parameters[keyParameter]));
+
             if (parameters[typeParameter] != null)
                 otpData.Type = (OtpType)Enum.Parse(typeof(OtpType), parameters[typeParameter]);
 
             get
             {
                 NameValueCollection collection = new NameValueCollection();
-                collection.Add(keyParameter, Base32.Encode(this.Key).Replace("=", "%3d"));
+                string base32Key = null;
+                this.Key.UsePlainKey(key =>
+                {
+                    base32Key = Base32.Encode(key).Replace("=", "%3d");
+                });
+                collection.Add(keyParameter, base32Key);
 
                 if (this.Type != KeeOtp.OtpType.Totp)
                     collection.Add(typeParameter, this.Type.ToString());
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.