草庐IT

ca-certificates

全部标签

c# - Visual Studio 2015 和 IFormatProvider 中的字符串插值 (CA1305)

VisualStudio2015中新的字符串插值样式是这样的:Dims=$"Hello{name}"但如果我使用它,代码分析会告诉我我破坏了CA1305:SpecifyIFormatProvider以前我是这样做的:Dims=String.Format(Globalization.CultureInfo.InvariantCulture,"Hello{0}",name)但是新样式怎么办呢?我必须提到我正在寻找.Net4.5.2的解决方案(for.Net4.6dcastrohastheanswer) 最佳答案 您将使用System.F

c# - CA1001 在异步方法上实现 IDisposable

考虑以下代码:publicclassTest{publicasyncTaskDo(){awaitTask.Delay(200);using(vardisposable=newDisposable()){disposable.Do();}}}publicclassDisposable:IDisposable{publicvoidDo(){}publicvoidDispose(){}}当我在VisualStudio中运行代码分析时,我收到一条警告:WarningCA1001ImplementIDisposableonTest.d__0becauseitcreatesmembersofthe

c# - Azure 网站中的站点无法处理 X509Certificate2

我在Azure网站(不是托管服务)中有站点,我需要在那里处理带有私钥的.pfx证书。varx509Certificate2=newX509Certificate2(certificate,password);但我遇到了以下异常:System.Security.Cryptography.CryptographicException:Thesystemcannotfindthefilespecified.atSystem.Security.Cryptography.CryptographicException.ThrowCryptographicException(Int32hr)atSy

c# - 从 PKCS#12 字节数组构建 X509Certificate2 如何抛出 CryptographicException ("The system cannot find the file specified.")?

我试图从一个字节数组中的PKCS#12blob构造一个X509Certificate2并得到一个相当令人费解的错误。此代码在具有WindowsXP管理员权限的桌面应用程序中运行。堆栈跟踪如下,但我在尝试排除故障时迷路了,因为_LoadCertFromBlob被标记为[MethodImpl(MethodImplOptions.InternalCall)]。System.Security.Cryptography.CryptographicException:Thesystemcannotfindthefilespecified.atSystem.Security.Cryptography

c# - 代码分析 CA1063 在从 IDisposable 派生并在基类中提供实现时触发

我有一些代码会触发代码分析警告CA1063:CA1063:Microsoft.Design:RemoveIDisposablefromthelistofinterfacesimplementedby'Functionality'andoverridethebaseclassDisposeimplementationinstead.但是,我不确定我需要做什么来修复这个警告。简而言之,我有一个派生自IDisposable的接口(interface)IFunctionality。类Functionality实现了IFunctionality但派生自类Reusable以便能够重用som代码。R

c# - X509Store Certificates.Find FindByThumbprint 问题

我在使用X509Store.Certificates.Find方法时遇到问题publicstaticX509Certificate2FromStore(StoreNamestoreName,StoreLocationstoreLocation,X509FindTypefindType,stringfindValue){X509Storestore=newX509Store(storeName,storeLocation);store.Open(OpenFlags.ReadOnly);try{//findValue="7a6fa503ab57b81d6318a51ca265e739a51

c# - CA2202,如何解决这个问题

谁能告诉我如何从以下代码中删除所有CA2202警告?publicstaticbyte[]Encrypt(stringdata,byte[]key,byte[]iv){using(MemoryStreammemoryStream=newMemoryStream()){using(DESCryptoServiceProvidercryptograph=newDESCryptoServiceProvider()){using(CryptoStreamcryptoStream=newCryptoStream(memoryStream,cryptograph.CreateEncryptor(ke

c# - "The remote certificate is invalid according to the validation procedure."使用 Gmail SMTP 服务器

我收到这个错误:Theremotecertificateisinvalidaccordingtothevalidationprocedure.每当我尝试在我的C#代码中使用Gmail的SMTP服务器发送电子邮件时。有人可以指出解决此问题的正确方向吗?以下是堆栈跟踪...atSystem.Net.Security.SslState.StartSendAuthResetSignal(ProtocolTokenmessage,AsyncProtocolRequestasyncRequest,Exceptionexception)atSystem.Net.Security.SslState.C

Docker:无法读取 CA 证书

我在Windows10Pro上安装了Docker,但无法正常工作。当我尝试运行hello-world时,我得到了couldnotreadCAcertificate它在machine/machines/default中寻找证书。但是那个文件夹不存在。我创建了一台名为“default”的机器(它创建了上述文件夹),但这并没有帮助。在此之前,我创建了另一台名为“dev”的机器,它似乎有证书,但这似乎也无济于事。机器/机器中还有证书文件-我不知道我是否应该以某种方式指向Docker查找该文件夹(而不是机器/机器/默认)?我对Docker很陌生,所以我可能会遗漏一些东西。但是我整天都在做这件事,

Docker:无法读取 CA 证书

我在Windows10Pro上安装了Docker,但无法正常工作。当我尝试运行hello-world时,我得到了couldnotreadCAcertificate它在machine/machines/default中寻找证书。但是那个文件夹不存在。我创建了一台名为“default”的机器(它创建了上述文件夹),但这并没有帮助。在此之前,我创建了另一台名为“dev”的机器,它似乎有证书,但这似乎也无济于事。机器/机器中还有证书文件-我不知道我是否应该以某种方式指向Docker查找该文件夹(而不是机器/机器/默认)?我对Docker很陌生,所以我可能会遗漏一些东西。但是我整天都在做这件事,