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:
Daniel Miranda 2019-05-25 07:17:52 -03:00 committed by Terry Cain
commit fb2a76fd66
8 changed files with 179 additions and 37 deletions

View file

@ -1,8 +1,12 @@
from moto.ec2 import utils
from .helpers import rsa_check_private_key
def test_random_key_pair():
key_pair = utils.random_key_pair()
assert len(key_pair['fingerprint']) == 59
assert key_pair['material'].startswith('---- BEGIN RSA PRIVATE KEY ----')
assert key_pair['material'].endswith('-----END RSA PRIVATE KEY-----')
rsa_check_private_key(key_pair['material'])
# AWS uses MD5 fingerprints, which are 47 characters long, *not* SHA1
# fingerprints with 59 characters.
assert len(key_pair['fingerprint']) == 47