A System.IO.FileNotFoundException exception was thrown when a method was called in PCL on a Windows 8 phone

I am working on decrypting a string (read from a database) in PCL for Windows Phone 8. Below is a scenerio:

A solution that has 3 projects, a Windows UI , a Windows Phone portable class library, and a class library .

The class library project has a StringDecryption class that contains the code below:

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;

namespace DecryptString
{
    public class StringDecryption
    {
        public string Decryption(string encryptedTExt)
        {
            var protectedText = this.ReadEncryptedData(encryptedTExt);

            // Decrypt the text by using the Unprotect method.
            var textByte = ProtectedData.Unprotect(protectedText, null, DataProtectionScope.CurrentUser);

            // Convert the text from byte to string and display it in the text box.
            return Encoding.UTF8.GetString(textByte, 0, textByte.Length);

        }

        public byte[] ReadEncryptedData(string text)
        {
            var reader = new StreamReader(text).BaseStream;
            var textArray = new byte[reader.Length];

            reader.Read(textArray, 0, textArray.Length);
            reader.Close();

            return textArray;
        }

        public string Getname()
        {
            return "MyName";
        }
    }
}

dll System.IO.FileNotFoundException, , Getname. . "System.Security, Version = 4.0.0.0, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a" . .

PCL?

.

+4
1

, " " " ". . (, .NET Framework), , .

PCL??

PCL Crypto.

, , , , . :

+1

Source: https://habr.com/ru/post/1547116/


All Articles