2011-08-22 5 views
1

데이터베이스에 액세스 할 수있는 사람이 여러 명 있기 때문에 암호화를 구현하고 싶습니다. 직원이 중요한 정보를 응용 프로그램에 저장하려고하기 때문에 암호화를 구현하고 싶습니다. 분리와 보안을 만들기 위해 필자는 하나의 SQL 테이블에서 데이터를 암호화하는 '키'를 사용하여 이상적으로 암호화를 구현하려고합니다.중소 규모 회사의 MSSQL 데이터베이스에 가장 적합한 암호화는 무엇입니까

나는 스스로를하고있는 것을 알고 있습니다. 트릭을 놓치지 않을 것이고, 특히 DB가 그렇지 않은 것처럼 해커에 대해 너무 많이 걱정할 필요가없는 우리 크기의 경우에는 테스트와 테스트가 가장 좋습니다. 외부 접근 가능. 이해 관계자를 보호하기에 충분합니다.

보안 등급이 적절한 지 알고 싶습니다. 또한 Google이 어떤 종류의 암호화를 사용할지 알기 위해 무엇이 필요한지 제 3 자 플러그인에서 모두 잃어 버렸습니다. 그들의 제품은 모두 자신들이 위대하다는 말을 할 것입니까?

내가 찾을 수있는 대부분의 다른 질문과 제안 된 '유사 질문' '

+2

(링크 ROTT을 방지하기 위해) 옷을 벗었 암호화는 가장 중요한 최고의, 또는 아니다, 솔루션의 일부 해커가 DB에 액세스 할 것으로 예상하는 경우 암호를 암호화하는 것 외에 다른 문제가 있습니다. 마찬가지로 중요한 것은 시스템/데이터베이스가 액세스 할 수 없도록 시스템/데이터베이스의 보안을 유지하는 것입니다. –

+0

좋아요, 제 의도는 정보를 '스크램블 (scramble)'하고 C# 응용 프로그램의 정보를 '디 스크램블 (descramble)'하고 데이터베이스에 '스크램블 드'정보를 저장하는 것이 었습니다. 우리는 DB에서 작업하는 사람들이 몇 명 있으며, 민감한 내용을 '스크램블'합니다. – Coops

+1

@Kieren Johnstone, 암호는 암호화되거나 일반 텍스트로 저장 될 필요가 없습니다. 하나는 (소금에 절인) 암호 해시 암호를 저장해야하며 인증은 단순히 해시를 비교해야합니다. –

답변

1

개인적으로 AES는 아주 쉽게 구현할 수 있으며 민감한 개인 데이터는 DES와는 달리 사람들을 보호 할 수있는 충분한 암호화를 제공합니다.http://msdn.microsoft.com/en-us/magazine/cc164055.aspx 과 함께 제공되는 기본 예제 : http://msdn.microsoft.com/en-us/magazine/cc164846.aspx

를 구현하는 방법의 매우 깨끗 예를 들어 여기에 당신이 어떻게 작동하는지에 대한 기술적 이해를 갖고 싶어

이 문서에서는 AES로 깊이 간다 : http://www.obviex.com/samples/Code.aspx?Source=EncryptionCS&Title=Symmetric%20Key%20Encryption&Lang=C%23

예 (여기 대신 '쓰기'의 원하는 것입니다 '오른쪽'.)

using System; 
using System.IO; 
using System.Security.Cryptography; 

namespace RijndaelManaged_Examples 
{ 
    class RijndaelMemoryExample 
    { 
     public static void Main() 
     { 
      try 
      { 

       string original = "Here is some data to encrypt!"; 

       // Create a new instance of the RijndaelManaged 
       // class. This generates a new key and initialization 
       // vector (IV). 
       RijndaelManaged myRijndael = new RijndaelManaged(); 

       // Encrypt the string to an array of bytes. 
       byte[] encrypted = encryptStringToBytes_AES(original, myRijndael.Key, myRijndael.IV); 

       // Decrypt the bytes to a string. 
       string roundtrip = decryptStringFromBytes_AES(encrypted, myRijndael.Key, myRijndael.IV); 

       //Display the original data and the decrypted data. 
       Console.WriteLine("Original: {0}", original); 
       Console.WriteLine("Round Trip: {0}", roundtrip); 

      } 
      catch (Exception e) 
      { 
       Console.WriteLine("Error: {0}", e.Message); 
      } 
     } 

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

      // Declare the streams used 
      // to encrypt to an in memory 
      // array of bytes. 
      MemoryStream msEncrypt = null; 
      CryptoStream csEncrypt = null; 
      StreamWriter swEncrypt = null; 

      // Declare the RijndaelManaged object 
      // used to encrypt the data. 
      RijndaelManaged aesAlg  = null; 

      try 
      { 
       // Create a RijndaelManaged object 
       // with the specified key and IV. 
       aesAlg = new RijndaelManaged(); 
       aesAlg.Key = Key; 
       aesAlg.IV = IV; 

       // Create a decrytor to perform the stream transform. 
       ICryptoTransform encryptor = aesAlg.CreateEncryptor(aesAlg.Key, aesAlg.IV); 

       // Create the streams used for encryption. 
       msEncrypt = new MemoryStream(); 
       csEncrypt = new CryptoStream(msEncrypt, encryptor, CryptoStreamMode.Write); 
       swEncrypt = new StreamWriter(csEncrypt); 

       //Write all data to the stream. 
       swEncrypt.Write(plainText); 

      } 
      finally 
      { 
       // Clean things up. 

       // Close the streams. 
       if(swEncrypt != null) 
        swEncrypt.Close(); 
       if (csEncrypt != null) 
        csEncrypt.Close(); 
       if (msEncrypt != null) 
        msEncrypt.Close(); 

       // Clear the RijndaelManaged object. 
       if (aesAlg != null) 
        aesAlg.Clear(); 
      } 

      // Return the encrypted bytes from the memory stream. 
      return msEncrypt.ToArray(); 

     } 

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

      // TDeclare the streams used 
      // to decrypt to an in memory 
      // array of bytes. 
      MemoryStream msDecrypt = null; 
      CryptoStream csDecrypt = null; 
      StreamReader srDecrypt = null; 

      // Declare the RijndaelManaged object 
      // used to decrypt the data. 
      RijndaelManaged aesAlg  = null; 

      // Declare the string used to hold 
      // the decrypted text. 
      string plaintext = null; 

      try 
      { 
       // Create a RijndaelManaged object 
       // with the specified key and IV. 
       aesAlg = new RijndaelManaged(); 
       aesAlg.Key = Key; 
       aesAlg.IV = IV; 

       // Create a decrytor to perform the stream transform. 
       ICryptoTransform decryptor = aesAlg.CreateDecryptor(aesAlg.Key, aesAlg.IV); 

       // Create the streams used for decryption. 
       msDecrypt = new MemoryStream(cipherText); 
       csDecrypt = new CryptoStream(msDecrypt, decryptor, CryptoStreamMode.Read); 
       srDecrypt = new StreamReader(csDecrypt); 

       // Read the decrypted bytes from the decrypting stream 
       // and place them in a string. 
       plaintext = srDecrypt.ReadToEnd(); 
      } 
      finally 
      { 
       // Clean things up. 

       // Close the streams. 
       if (srDecrypt != null) 
        srDecrypt.Close(); 
       if (csDecrypt != null) 
        csDecrypt.Close(); 
       if (msDecrypt != null) 
        msDecrypt.Close(); 

       // Clear the RijndaelManaged object. 
       if (aesAlg != null) 
        aesAlg.Clear(); 
      } 

      return plaintext; 

     } 
    } 
} 
0

스크램블 정보가 대칭 (Rijndael을)를 주요 수행 할 수 있습니다하지만 난 돈 해시 또는 ASP.NET, 데이터 전송 암호화에 대해 이야기 SQL 업데이트를 사용하는 응용 프로그램의 성능을 얼마나 향상시킬 수 있는지 알고 있습니다.

Symmetric (Rijndael) Key

2

모든 보안 바와 유용성 장단점을 제기에 대해 정말이다. 암호화를 사용하면 여기에 많은 옵션이 있지만 핵심 관리에 대한 모든 것입니다.

누가 해독 할 키가 있습니까?

저장 방법은 무엇입니까?

응용 프로그램 데이터에 대한 무차별 대입 공격 (예 : Iron Mountain으로의 FedEx 차단으로 암호화 된 SQL Server 데이터베이스의 백업 테이프 보유)이 키 관리 시스템에 대한 내부 공격보다 덜합니다. 예를 들어 직원이나 개발자가 프로그램을 변경하여 데이터를 해독하고 덤프합니다.

응용 프로그램은 일반적으로 권한이 부여 된 사용자에게 언제든지이 데이터를 해독해야하므로 민감한 열과 우선 액세스 할 수있는 역할의 가시성에 집중하고 암호 화에 대해 걱정할 필요가 있습니다.

SQL Server는 데이터 암호화 및 연결 암호화 만 제공합니다. 사용자가 테이블에 대한 액세스 권한이 SELECT * 인 경우에는 유용하지 않습니다. SQL Server 지식 없이도 열에서 직접 암호화하는 것은 문제가 될 수 있습니다. 예를 들어 하나의 열이 유료 데이터이고 민감한 경우 열에서 암호화하면 SELECT Employee, SUM(Pay) GROUP BY Employee

먼저 애플리케이션에서 사용자와 역할을 식별하고, 보유한 액세스 유형을 검토하고 데이터베이스에 대한 모든 연결이 적절한 역할을 사용하는지 확인합니다.

+0

벙어리 스토리지 유닛이 아닌 암호화 된 데이터의 유용성 감소에 대한 좋은 지적. –

관련 문제