شهادة موقعة ذاتية في Windows بدون MakeCert؟
-
06-07-2019 - |
سؤال
لدينا تطبيق Windows Server Type Type Type حيث نحتاج إلى إنشاء شهادة موقعة ذاتيًا على الخادم لاستخدامها من قبل بعض خدمات الويب WCF. من عمليات البحث الخاصة بنا على الويب ، يبدو أنه لا يمكن توزيع الأداة المساعدة MakeCert في platformsdk من Microsoft مع تطبيقنا ، لذلك نحن نبحث عن بدائل.
هل يعرف أي شخص كيفية استخدام OpenSSL لإنشاء شهادة والحصول عليها في متجر شهادات Windows LocalMachine؟ أو بدلاً من ذلك ، هل من المقبل إلى الأمام إدراج الشهادة في المتجر في تطبيق .NET وهل يجب علينا فقط إنشاء ملف الشهادة باستخدام OpenSSL؟ أي مساعدة/اقتراحات سيكون موضع تقدير.
المحلول
لسوء الحظ ، لا يمكنني التعليق على أي شيء حتى الآن ، لذلك سأقوم بنشر هذا كإجابة.
أرى أن هذا المنشور قديم بعض الشيء ، لكنني في قارب مماثل ووجدت هذا في ملف Visual Studio 2008 Redist.txt:
Windows SDK Files
Subject to the license terms for the software, the following files may be distributed unmodified:
MageUI.exe
Mage.exe
Makecert.exe
لست متأكدًا مما إذا كان هناك شيء ما قد تغير (وإذا كان تفسيري صحيحًا) ، ولكن يبدو أن MakeCert.exe مدرج كجزء من Windows SDK ، والذي تم تضمينه في المنعطف كجزء من تثبيت VS2008 يمكن إعادة توزيعه بالفعل.
نصائح أخرى
You can now Create Self Signed Certificates with PowerShell The commands you need are New-SelfSignedCertificate and Export-PfxCertificate. Ex: to create a certificate
New-SelfSignedCertificate -certstorelocation cert:\localmachine\my -dnsname orin.windowsitpro.internal
to export it
Export-PfxCertificate -cert cert:\localMachine\my\CE0976529B02DE058C9CB2C0E64AD79DAFB18CF4 -FilePath e:\temp\cert.pfx -Password $pwd
This link is really helpful
http://windowsitpro.com/blog/creating-self-signed-certificates-powershell
Woohoo! It's time for pinvoke for you
crypt32 provides a CertCreateSelfSignCertificate function; if that succeeds you can store it in the user's personal store (or the machine store assuming you're working elevated)
I haven't used OpenSSL, but I'm in the same boat and have found this article helpful:
Securing WCF Services with Certificates
The author walks you through installing Microsoft Certificate Services, creating a CA that can be added to the trusted certificate authorities (on both client and server, since it's self signed), then generating client and server certificates that chain from the self-signed CA cert.
You won't need the client certs, but it does help you to create a self-signed CA and server cert.
One alternative for programmatically generating certificates is Bouncy Castle's C#-version. http://www.bouncycastle.org/csharp/