Wyko
Jul 12, 2023Altostratus
How to make a password-protected private key via REST
Hey everyone!
Does anyone know how to use a REST command to create a password protected key? I tried the following, but it gave me the error:
{"code":400,"message":"\"passphrase\" may not be specified in the context of the \"create\" command. \"passphrase\" may be specified using the following commands: install","errorStack":[],"apiError":26214401}
payload = {
"name": f"{fqdn}-key-{datetime.utcnow().strftime('%Y%m%d%H%M%S')}.key",
"commonName": options.common_name,
"keySize": options.key_size,
"keyType": "rsa-private",
"options": [{"gen-csr": "www.testing.com"}],
"organization": options.organization,
"city": options.city,
"state": options.state,
"emailAddress": options.email,
"subjectAlternativeName": sans,
"passphrase": password,
"securityType": "password",
}
r = await ltm.post("mgmt/tm/sys/crypto/key", json=payload, raise_err=False)