2016-12-10 5 views
0

내 개발 컴퓨터에서 발생하지 않은 배포 컴퓨터에서이 예외가 발생했습니다. 이것은 .net 프레임 워크 웹 사이트입니다.System.Security.Cryptography.CryptographicException : 지정된 파일을 찾을 수 없습니다.

System.Security.Cryptography.CryptographicException: The system cannot find the file specified. 

    at System.Security.Cryptography.CryptographicException.ThrowCryptographicException(Int32 hr) 
    at System.Security.Cryptography.Utils._CreateCSP(CspParameters param, Boolean randomKeyContainer, SafeProvHandle& hProv) 
    at System.Security.Cryptography.Utils.CreateProvHandle(CspParameters parameters, Boolean randomKeyContainer) 
    at System.Security.Cryptography.Utils.GetKeyPairHelper(CspAlgorithmType keyType, CspParameters parameters, Boolean randomKeyContainer, Int32 dwKeySize, SafeProvHandle& safeProvHandle, SafeKeyHandle& safeKeyHandle) 
    at System.Security.Cryptography.RSACryptoServiceProvider.GetKeyPair() 
    at Org.BouncyCastle.Security.DotNetUtilities.CreateRSAProvider(RSAParameters rp) 
    at Box.V2.JWTAuth.BoxJWTAuth..ctor(IBoxConfig boxConfig) 

내 케이스는 웹 사이트에서 사용되는 SDK 중 하나이며 RSA private_keys.pem 파일을 읽습니다. 그리고 GitHub의에서 그 SDK 코드로보고 :

var pwf = new PEMPasswordFinder(this.boxConfig.JWTPrivateKeyPassword); 
     AsymmetricCipherKeyPair key; 
     using (var reader = new StringReader(this.boxConfig.JWTPrivateKey)) 
     { 
      key = (AsymmetricCipherKeyPair)new PemReader(reader, pwf).ReadObject(); 
     } 
     var rsa = DotNetUtilities.ToRSA((RsaPrivateCrtKeyParameters)key.Private); 

내 개발 컴퓨터에서 잘 작동 SDK는 있지만 배포 기계. 지정한 파일을 찾을 수 없습니다. private_key.pem 파일이 아닌 것 같습니다.

그래서 Cryptogrphy가 어떻게 작동하는지 알아 내려고 노력합니다. 여기 내가 발견 한 것은 잘못 되었다면 아무 것도 지적합니다. cryptoAPI처럼 보이고 RSA 키 컨테이너를 만들고 응용 프로그램 수준에서 키 컨테이너에 대한 올바른 액세스 권한이없는 경우 예외가 발생합니다. 그것이 지정된 파일 시스템을 찾고 있습니까?

예, 문제를 해결하려면 어떻게해야합니까?

+0

가장 큰 문제는 배포 컴퓨터 또는 IIS를 관리하지 않는다는 것입니다. 심지어는 비슷한 문제 해결 방법을 찾았지만 IIS에서 시도 할 수는 없습니다. 나는 IT 부서에 문제 해결 방법을 안내하기 전에 더 자세히 배우고 싶습니다. https://blogs.msdn.microsoft.com/duetsupport/2012/04/06/system-security-cryptography-cryptographicexception-the-system-cannot-find-the-file-specified/ – Feng

답변

0

우리는 사무실에서 비슷한 문제가있었습니다. 최근 그룹 정책 업데이트로 %ProgramData%\Microsoft\Crypto\RSA\MachineKeys 폴더에서 사용 권한을 제거했습니다. 우리의 응용 프로그램은 BouncyCastle로 자체 서명 된 인증서를 작성하고있었습니다. 정책 업데이트 전에 응용 프로그램을 설치 한 사용자는 계속 응용 프로그램을 실행할 수있었습니다. 업데이트 후에 앱을 설치 한 사용자는 애플리케이션을 실행할 수 없습니다. Process Monitor를 사용하여 어떤 일이 발생했는지 파악할 수있었습니다 (Windows 탐색기를 사용하여 생성 된 파일을 볼 수 있었지만 응용 프로그램에는 list folder contents이 없었습니다).

이 그룹 정책 업데이트는 하드 드라이브 암호화 ransomware 응용 프로그램이 드라이브를 암호화하는 데 필요한 키를 만들 수 없도록하기 위해 푸시되었습니다. 우리는 보안 부서의 정책을 준수하는이 문제에 대한 영구적 인 솔루션을 개발하기 위해 노력할 것입니다.