PowerShell script signing and key requirements for the AD agent
Review the signature format and the public key and certificate formats that the Okta Active Directory agent accepts when it verifies a PowerShell script.
Supported key and certificate formats
Upload the public key, or a certificate that contains it, in one of the formats in the following table.
| Format | File extension | File begins with |
|---|---|---|
| PEM public key | .pem, .pub |
-----BEGIN PUBLIC KEY----- |
| PEM RSA public key | .pem, .pub |
-----BEGIN RSA PUBLIC KEY----- |
| X.509 certificate (Base-64 encoded) | .crt, .cer, .pem |
-----BEGIN CERTIFICATE----- |
- The key must be an RSA key, 2048-bit or larger.
- Binary (DER)
.crtor.cerfiles aren't supported. When you export a certificate from Windows, select Base-64 encoded X.509. - When you upload a certificate, Okta uses only the public key inside it. Okta doesn't check certificate expiry, issuer, or chain of trust.
Signature requirements
The script must carry an RSA-SHA256 (PKCS#1 v1.5) signature, Base64-encoded in a signature block at the end of the script. The AD agent verifies the signature against the uploaded key at every invocation.
Note: Authenticode signatures created with
Set-AuthenticodeSignature aren't supported.Signed script format
A signed script is your script content followed by a signature block as the last lines of the file.
Write-Host "Hello, World!"
# SIG # Begin signature block
# AdAiuv7EgPMMjV7FxbD4FETWGQrzWX6LMmLcw5e+aDzkmyGpXLhqjNG17sRxmT2c
# tnAELlxxfAU7jaUE7C4Zhh/HScPvLeqqd1CHsdxSIM4H1ZJPOl1nfv0WDBE/BpBW
# ...
# nDmYKKlhFtlCDIXqvtwUfQ==
# SIG # End signature block
- The block starts with the line
# SIG # Begin signature blockand ends with the line# SIG # End signature block. - Each line between them starts with
#followed by part of the Base64-encoded signature. - Nothing comes after the End line.
Note: Any change to the script after signing invalidates the signature, including changes made by tools that convert encoding or line endings. Re-sign the final copy that sits at the configured path.