コード例 #1
0
        public static async Task StorePasswords(String Passwords, CryptographicKey AesKey)
        {
            CryptographicKey k = await GetRasKey(AesKey);

            int a = int.Parse(await StorageInterface.ReadFromRoamingFolder("PWM/INDEX"));

            for (int i = 0; i < a; i++)
            {
                await StorageInterface.DeleteFromRoamingFolder("PWM/Passwords" + i);
            }


            String[] PWD = Passwords.DivideToLength(768);
            await StorageInterface.WriteToRoamingFolder("PWM/INDEX", PWD.Length.ToString());

            for (int i = 0; i < PWD.Length; i++)
            {
                IBuffer plain   = CryptographicBuffer.ConvertStringToBinary(PWD[i], BinaryStringEncoding.Utf8);
                IBuffer cryptic = CryptographicEngine.Encrypt(k, plain, null);
                await StorageInterface.WriteBufferToRoamingFolder("PWM/Passwords" + i, cryptic);
            }
        }