mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-23 10:51:24 -07:00
openssl_*: Allow user to specify privatekey passphrase
Allow a user to specify the privatekey passphrase when dealing with openssl modules.
This commit is contained in:
parent
a260063ffd
commit
f40db199aa
4 changed files with 66 additions and 12 deletions
|
@ -26,12 +26,14 @@ except ImportError:
|
|||
import hashlib
|
||||
|
||||
|
||||
def get_fingerprint(path):
|
||||
def get_fingerprint(path, passphrase):
|
||||
"""Generate the fingerprint of the public key. """
|
||||
|
||||
fingerprint = {}
|
||||
|
||||
privatekey = crypto.load_privatekey(crypto.FILETYPE_PEM, open(path, 'r').read())
|
||||
privatekey = crypto.load_privatekey(crypto.FILETYPE_PEM,
|
||||
open(path, 'rb').read(),
|
||||
passphrase)
|
||||
|
||||
try:
|
||||
publickey = crypto.dump_publickey(crypto.FILETYPE_ASN1, privatekey)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue