From 95a5a8f9efef02ddcec5b3f69be99a00d71a802a Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Sun, 16 Dec 2018 21:19:24 -0600 Subject: Import implementation of IisCA from old repo's scasched/scaexec. --- src/ca/scassl7.cpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/ca/scassl7.cpp (limited to 'src/ca/scassl7.cpp') diff --git a/src/ca/scassl7.cpp b/src/ca/scassl7.cpp new file mode 100644 index 00000000..47c16a9d --- /dev/null +++ b/src/ca/scassl7.cpp @@ -0,0 +1,34 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +#include "precomp.h" + +HRESULT ScaSslCertificateWrite7( + __in_z LPCWSTR wzWebBase, + __in SCA_WEB_SSL_CERTIFICATE* pswscList + ) +{ + HRESULT hr = S_OK; + WCHAR wzEncodedCertificateHash[CB_CERTIFICATE_HASH * 2 + 1] = { 0 }; + + for (SCA_WEB_SSL_CERTIFICATE* pswsc = pswscList; pswsc; pswsc = pswsc->pNext) + { + hr = ScaWriteConfigID(IIS_SSL_BINDING); + ExitOnFailure(hr, "Failed write SSL binding ID"); + hr = ScaWriteConfigID(IIS_CREATE); // Need to determine site action + ExitOnFailure(hr, "Failed write binding action"); + + hr = ScaWriteConfigString(wzWebBase); //site name key + ExitOnFailure(hr, "Failed to write SSL website"); + hr = ScaWriteConfigString(pswsc->wzStoreName); //ssl store name + ExitOnFailure(hr, "Failed to write SSL store name"); + + hr = StrHexEncode(pswsc->rgbSHA1Hash, countof(pswsc->rgbSHA1Hash), wzEncodedCertificateHash, countof(wzEncodedCertificateHash)); + ExitOnFailure(hr, "Failed to encode SSL hash"); + + hr = ScaWriteConfigString(wzEncodedCertificateHash); //ssl hash + ExitOnFailure(hr, "Failed to write SSL hash"); + } +LExit: + + return hr; +} -- cgit v1.2.3-55-g6feb