@@ -79,14 +79,16 @@ text without prepended symbols is the output of a command.
79
79
# the current working directory). A full directory path may be specified
80
80
# instead of saving keys to the current working directory. If specified
81
81
# directories do not exist, they will be created.
82
- >>> generate_and_write_rsa_keypair("rsa_key1", bits=2048, password="password")
82
+ >>> generate_and_write_rsa_keypair(
83
+ password="password", filepath="rsa_key1", bits=2048)
83
84
84
85
# If the key length is unspecified, it defaults to 3072 bits. A length of
85
- # less than 2048 bits raises an exception. A password may be supplied as an
86
- # argument like above, or on the prompt. If no password is passed or
87
- # entered the private key is saved unencrypted.
88
- >>> generate_and_write_rsa_keypair("rsa_key2", prompt=True)
89
- Enter a password for the RSA key:
86
+ # less than 2048 bits raises an exception. A similar function is available
87
+ # to supply a password on the prompt. If an empty password is entered, the
88
+ # private key is saved unencrypted.
89
+ >>> generate_and_write_rsa_keypair_with_prompt("rsa_key2")
90
+ enter password to encrypt private key file '/path/to/rsa_key2'
91
+ (leave empty if key should not be encrypted):
90
92
Confirm:
91
93
92
94
@@ -110,10 +112,11 @@ Import RSA Keys
110
112
# Import an existing private key. If your private key is encrypted,
111
113
# which it should be, you either have to pass a 'password' or enter one
112
114
# on the prompt.
113
- >>> private_rsa_key1 = import_rsa_privatekey_from_file("rsa_key1", password=' some passphrase")
114
- OR:
115
+ >>> private_rsa_key1 = import_rsa_privatekey_from_file("rsa_key1", password=" some passphrase")
116
+ # OR:
115
117
>>> private_rsa_key1 = import_rsa_privatekey_from_file("rsa_key1", prompt=True)
116
- Enter a password for the encrypted RSA key:
118
+ enter password to decrypt private key file '/path/to/rsa_key1'
119
+ (leave empty if key not encrypted):
117
120
118
121
**import_rsa_privatekey_from_file() ** raises a
119
122
*securesystemslib.exceptions.CryptoError * exception if the key / password is
@@ -134,36 +137,35 @@ Create and Import Ed25519 Keys
134
137
135
138
# Continuing from the previous section . . .
136
139
137
- # Generate and write an Ed25519 key pair. A password may be supplied as an
138
- # argument, or on the prompt. If no password is passed or entered the
139
- # private key is saved unencrypted.
140
- >>> generate_and_write_ed25519_keypair('ed25519_key', prompt=True)
141
- Enter a password for the Ed25519 key:
140
+ # The same generation and import functions as for rsa keys exist for ed25519
141
+ >>> generate_and_write_ed25519_keypair_with_prompt('ed25519_key')
142
+ enter password to encrypt private key file '/path/to/ed25519_key'
143
+ (leave empty if key should not be encrypted):
142
144
Confirm:
143
145
144
146
# Import the Ed25519 public key just created . . .
145
147
>>> public_ed25519_key = import_ed25519_publickey_from_file('ed25519_key.pub')
146
148
147
149
# and its corresponding private key.
148
150
>>> private_ed25519_key = import_ed25519_privatekey_from_file('ed25519_key', prompt=True)
149
- Enter a password for the encrypted Ed25519 key:
150
-
151
+ enter password to decrypt private key file '/path/to/ed25519_key'
152
+ (leave empty if key should not be encrypted):
151
153
152
154
Create and Import ECDSA Keys
153
155
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
154
156
155
157
::
156
158
157
- # continuing from the previous sections . . .
158
-
159
- >>> generate_and_write_ecdsa_keypair ('ecdsa_key', prompt=True )
160
- Enter a password for the ECDSA key:
161
- Confirm :
159
+ # The same generation and import functions as for rsa and ed25519 keys
160
+ # exist for ecdsa
161
+ >>> generate_and_write_ecdsa_keypair_with_prompt ('ecdsa_key')
162
+ enter password to decrypt private key file '/path/to/ecdsa_key'
163
+ (leave empty if key should not be encrypted) :
162
164
163
165
>>> public_ecdsa_key = import_ecdsa_publickey_from_file('ecdsa_key.pub')
164
166
>>> private_ecdsa_key = import_ecdsa_privatekey_from_file('ecdsa_key', prompt=True)
165
- Enter a password for the encrypted ECDSA key:
166
-
167
+ enter password to decrypt private key file '/path/to/ecdsa_key'
168
+ (leave empty if key should not be encrypted):
167
169
168
170
Generate ECDSA, Ed25519, and RSA Signatures
169
171
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0 commit comments