| 1 | // 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. |
| 2 | |
| 3 | #include "precomp.h" |
| 4 | |
| 5 | HRESULT ScaSslCertificateWrite7( |
| 6 | __in_z LPCWSTR wzWebBase, |
| 7 | __in SCA_WEB_SSL_CERTIFICATE* pswscList |
| 8 | ) |
| 9 | { |
| 10 | HRESULT hr = S_OK; |
| 11 | WCHAR wzEncodedCertificateHash[CB_CERTIFICATE_HASH * 2 + 1] = { 0 }; |
| 12 | |
| 13 | for (SCA_WEB_SSL_CERTIFICATE* pswsc = pswscList; pswsc; pswsc = pswsc->pNext) |
| 14 | { |
| 15 | hr = ScaWriteConfigID(IIS_SSL_BINDING); |
| 16 | ExitOnFailure(hr, "Failed write SSL binding ID"); |
| 17 | hr = ScaWriteConfigID(IIS_CREATE); // Need to determine site action |
| 18 | ExitOnFailure(hr, "Failed write binding action"); |
| 19 | |
| 20 | hr = ScaWriteConfigString(wzWebBase); //site name key |
| 21 | ExitOnFailure(hr, "Failed to write SSL website"); |
| 22 | hr = ScaWriteConfigString(pswsc->wzStoreName); //ssl store name |
| 23 | ExitOnFailure(hr, "Failed to write SSL store name"); |
| 24 | |
| 25 | hr = StrHexEncode(pswsc->rgbSHA1Hash, countof(pswsc->rgbSHA1Hash), wzEncodedCertificateHash, countof(wzEncodedCertificateHash)); |
| 26 | ExitOnFailure(hr, "Failed to encode SSL hash"); |
| 27 | |
| 28 | hr = ScaWriteConfigString(wzEncodedCertificateHash); //ssl hash |
| 29 | ExitOnFailure(hr, "Failed to write SSL hash"); |
| 30 | } |
| 31 | LExit: |
| 32 | |
| 33 | return hr; |
| 34 | } |