2013-06-28 9 views
0

Windows Phone 초보자는 여기에 있습니다.'EncryptStringToBytes_Aes'이름이 현재 컨텍스트에 존재하지 않습니다.

Windows Phone AesManaged Class에서 AES 튜토리얼을 확인하고 샘플 프로젝트에서 샘플을 사용해 보았습니다.

나는 그것이 작동하지 수 있으며 오류

에게 이름을 부여 유지 'EncryptStringToBytes_Aes'어떤 도움이 높게 평가되어 현재 상황

에 존재하지 않습니다.


코드

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

namespace myProject.Services 
{ 
    class Encrypter 
    { 
     public static string encryptMessage(String message) 
     { 
      string cryptex = null; 

      try 
      { 
       using (AesManaged theAes = new AesManaged()) 
       { 
        byte[] encryptedStream = EncryptStringToBytes_Aes(message, theAes.Key, theAes.IV); 

        cryptex = System.Text.Encoding.UTF8.GetString(encryptedStream, 0, encryptedStream.Count()); 
       } 
      } 
      catch (Exception ex) 
      { 
       Debug.WriteLine("Error: {0}", ex.Message); 
      } 
      return cryptex; 
     } 
    } 
} 
+1

EncryptStringToBytes_Aes 메소드를 구현 했습니까? 자습서에 표시된대로 ... – ThaMe90

답변

1

음 예 - 당신이 링크 된 페이지는 샘플 코드에서 EncryptStringToBytes_Aes 방법을 포함 - 그러나 당신이 어떤 이유로, 그것을 복사 할 때 당신은 그것을 생략. Demo 메소드 바로 아래에 있습니다.

static byte[] EncryptStringToBytes_Aes(string plainText, byte[] Key, byte[] IV) 
{ 
    // Check arguments. 
    if (plainText == null || plainText.Length <= 0) 
     throw new ArgumentNullException("plainText"); 
    ... 
} 
+0

그럴 경우! 나는 그것을 이전에 점검했으면 좋겠다. 도움 주셔서 감사합니다. – SamVisualMeta

관련 문제