-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathA2APrivateKeyExample.py
More file actions
29 lines (19 loc) · 1.03 KB
/
A2APrivateKeyExample.py
File metadata and controls
29 lines (19 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from pysafeguard import *
from src.pysafeguard import A2ATypes, SshKeyFormats
# The appliance host name or IP address
hostName = ''
# Path to the trusted root ca of the appliance
caFile = ''
# The API Key for private key retrieval via A2A
apiKey = ''
# Path to the .pem file for certificate authentication
userCertFile = ''
# Path to the corresponding .key file for certificate authentication
userKeyFile = ''
print('Retrieving private key credentials')
privatekey_openssh = PySafeguardConnection.a2a_get_credential(hostName, apiKey, userCertFile, userKeyFile, caFile, A2ATypes.PRIVATEKEY)
print(f'Private Key (OpenSSH): {privatekey_openssh}')
privatekey_ssh2 = PySafeguardConnection.a2a_get_credential(hostName, apiKey, userCertFile, userKeyFile, caFile, A2ATypes.PRIVATEKEY, SshKeyFormats.SSH2)
print(f'Private Key (SSH2): {privatekey_ssh2}')
privatekey_putty = PySafeguardConnection.a2a_get_credential(hostName, apiKey, userCertFile, userKeyFile, caFile, A2ATypes.PRIVATEKEY, SshKeyFormats.PUTTY)
print(f'Private Key (Putty): {privatekey_putty}')