내 개발 컴퓨터에서 발생하지 않은 배포 컴퓨터에서이 예외가 발생했습니다. 이것은 .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 키 컨테이너를 만들고 응용 프로그램 수준에서 키 컨테이너에 대한 올바른 액세스 권한이없는 경우 예외가 발생합니다. 그것이 지정된 파일 시스템을 찾고 있습니까?
예, 문제를 해결하려면 어떻게해야합니까?
가장 큰 문제는 배포 컴퓨터 또는 IIS를 관리하지 않는다는 것입니다. 심지어는 비슷한 문제 해결 방법을 찾았지만 IIS에서 시도 할 수는 없습니다. 나는 IT 부서에 문제 해결 방법을 안내하기 전에 더 자세히 배우고 싶습니다. https://blogs.msdn.microsoft.com/duetsupport/2012/04/06/system-security-cryptography-cryptographicexception-the-system-cannot-find-the-file-specified/ – Feng