ec2: add support for creation and importing of real SSH keys (#2108)
* ec2: add support for creation and importing of real SSH keys * setup: lock PyYAML version to avoid incompatibilities
This commit is contained in:
parent
d8ff67197b
commit
fb2a76fd66
8 changed files with 179 additions and 37 deletions
15
tests/test_ec2/helpers.py
Normal file
15
tests/test_ec2/helpers.py
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import six
|
||||
|
||||
from cryptography.hazmat.backends import default_backend
|
||||
from cryptography.hazmat.primitives import serialization
|
||||
from cryptography.hazmat.primitives.asymmetric import rsa
|
||||
|
||||
|
||||
def rsa_check_private_key(private_key_material):
|
||||
assert isinstance(private_key_material, six.string_types)
|
||||
|
||||
private_key = serialization.load_pem_private_key(
|
||||
data=private_key_material.encode('ascii'),
|
||||
backend=default_backend(),
|
||||
password=None)
|
||||
assert isinstance(private_key, rsa.RSAPrivateKey)
|
||||
Loading…
Add table
Add a link
Reference in a new issue