Last active
June 3, 2025 21:06
-
-
Save pedroinfo/eff9230be58f442f492f243739705e6e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub EnviarComCertificadoCliente() | |
Dim http As Object | |
Dim url As String | |
Dim certSubject As String | |
Dim json As String | |
url = "https://sua-api.com/endpoint" | |
certSubject = "CN=Nome do seu certificado" | |
Set http = CreateObject("WinHttp.WinHttpRequest.5.1") | |
http.Open "POST", url, False | |
' Configura o certificado cliente pelo subject da store do usuário | |
' O parâmetro pode ser: | |
' "CURRENT_USER\MY\<subject>" ou "LOCAL_MACHINE\MY\<subject>" | |
' Exemplo: | |
http.SetClientCertificate "CURRENT_USER\MY\" & certSubject | |
http.SetRequestHeader "Content-Type", "application/json" | |
json = "{""chave"":""valor""}" | |
http.Send json | |
MsgBox "Status: " & http.Status & vbCrLf & "Resposta: " & http.ResponseText | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment