Skip to content

This component will calculate SHA-hash for your message and then sign that with a certificate stored in Microsoft Azure KeyVault.

Notifications You must be signed in to change notification settings

Thorium/KeyVaultSigning

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Azure KeyVault signing

This component will calculate SHA-hash for your message and then sign that with Azure KeyVault.

Pre-conditions:

  • Install Azure CLI:
 powershell Invoke-WebRequest -Uri https://aka.ms/installazurecliwindows -OutFile .\AzureCLI.msi; Start-Process msiexec.exe -Wait -ArgumentList '/I AzureCLI.msi /quiet'; rm .\AzureCLI.msi

Then just reference this library and call:

KeyVault.sign "keyvault" "certificateName" "Hello world!"

By default the library uses SHA256 and UTF8, but you can modify that, and change the Azure authentication:

KeyVault.configureAlgorithm <- KeyVault.Algorithms.SHA384
KeyVault.configureEncoding <- System.Text.Encoding.Unicode
let changeDefaultCredentials =
    KeyVault.configureAzureCredentials <- fun() ->
        Azure.Identity.DefaultAzureCredential (
            Azure.Identity.DefaultAzureCredentialOptions (
                    //ExcludeEnvironmentCredential = true
                    //,ExcludeManagedIdentityCredential = true
                    ExcludeSharedTokenCacheCredential = true
                    ,ExcludeVisualStudioCredential = true
                    //,ExcludeVisualStudioCodeCredential = true
                    //,ExcludeAzureCliCredential = true
                    //,ExcludeInteractiveBrowserCredential = true
                ))