X509Certificate2构造函数抛出Internal.Cryptography.CryptoThrowHelper + WindowsCryptographicException:磁盘上没有足够的空间 [英] X509Certificate2 constructor throwing Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException: There is not enough space on the disk
问题描述
I am running into a similar issue that is described here. This is a .NET Core 3.1 App running as a Azure WebJob in Azure App Service. Based on the discussion in the above link, I assume this is an issue with file counts in a directory, I am having trouble figuring out which directory is getting full. The environments page on the Kudu portal shows this, basically doesn't seem to be a overall disk space issue-
D:\home usage: 57,344 MB total; 56,795 MB free
d:\local usage: 11,264 MB total; 10,683 MB free
我也确实查看了以上链接中提到的路径,但没有取得很大的成功.在尝试相关问题中建议的代码修复之前,是否有办法弄清楚哪个是违规路径?
I also did look at the paths mentioned in the above link without much success. Is there a way to figure out which is the offending path, before I try the code fix suggested in the related issue?
[08/02/2020 09:20:53 > 4708f0: INFO] Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException: There is not enough space on the disk.
[08/02/2020 09:20:53 > 4708f0: INFO] at Internal.Cryptography.Pal.CertificatePal.FilterPFXStore(Byte[] rawData, SafePasswordHandle password, PfxCertStoreFlags pfxCertStoreFlags)
[08/02/2020 09:20:53 > 4708f0: INFO] at Internal.Cryptography.Pal.CertificatePal.FromBlobOrFile(Byte[] rawData, String fileName, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags)
[08/02/2020 09:20:53 > 4708f0: INFO] at System.Security.Cryptography.X509Certificates.X509Certificate..ctor(Byte[] rawData, String password, X509KeyStorageFlags keyStorageFlags)
[08/02/2020 09:20:53 > 4708f0: INFO] at System.Security.Cryptography.X509Certificates.X509Certificate2..ctor(Byte[] rawData, String password)
推荐答案
除非PFX装有 X509KeyStorageFlags.EphemeralKeySet
,否则私钥材料将写入磁盘.特定位置取决于PFX中的信息,但是在所有PFX负载的99.99%中使用的目录记录在
Unless a PFX is loaded with X509KeyStorageFlags.EphemeralKeySet
, the private key material is written to disk. The particular place depends on the information in the PFX, but the directories used in 99.99% of all PFX loads are documented at https://docs.microsoft.com/en-us/windows/win32/seccng/key-storage-and-retrieval#key-directories-and-files.
(在0.01%的情况下,PFX内容表示将密钥加载到使用其他位置的其他存储提供程序中.)
(In the 0.01% case, the PFX contents say to load the key into some other storage provider which uses some other location.)
或者,除非您要执行一些需要命名键的操作之一,否则在加载PFX时指定 EphemeralKeySet
.
Or, unless you're doing one of the few things that require named keys, specify EphemeralKeySet
when loading the PFX.
这篇关于X509Certificate2构造函数抛出Internal.Cryptography.CryptoThrowHelper + WindowsCryptographicException:磁盘上没有足够的空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!