

error ( e ) return None, None # All existing CMKs were checked and the desired key was not found return None, None Create a customer master key # list_keys ( Marker = response ) except ClientError as e : logging. debug ( 'A CMK with the specified description was not found' ) done = True else : # Yes, retrieve another batch try : response = kms_client. error ( e ) return None, None # Is this the key we're looking for? if key_info = desc : return cmk, cmk # Are there more keys to retrieve? if not response : # No, the CMK was not found logging. describe_key ( KeyId = cmk ) except ClientError as e : logging. error ( e ) return None, None done = False while not done : for cmk in response : # Get info about the key, including its description try : key_info = kms_client. list_keys () except ClientError as e : logging. client ( 'kms' ) try : response = kms_client. Twine requires at least version 3.7.Def retrieve_cmk ( desc ): """Retrieve an existing KMS CMK based on its description :param desc: Description of CMK specified when the CMK was created :return Tuple(KeyId, KeyArn) where: KeyId: CMK ID KeyArn: Amazon Resource Name of CMK :return Tuple(None, None) if a CMK with the specified description was not found """ # Retrieve a list of existing CMKs # If more than 100 keys exist, retrieve and process them in batches kms_client = boto3. The pip install twine is necessary as Python-RSA requires Python >= 3.6, and Twine upload -r rsa dist/rsa-4.9.tar.gz dist/rsa-4.9-*.whl Twine check dist/rsa-4.9.tar.gz dist/rsa-4.9-*.whl # Use `twine upload -r rsa` to upload with this token. See for help using API tokens to publish. Use this token when publishing instead of your username and password.Īs password, use the token itself, including the pypi- prefix. Key is required username+password will not work. Since this project is considered critical on the Python Package Index, Setup of Development Environment python3 -m venv. This library is no exception, so use it with care. Licensed under the Apache License, version 2.0 Securityīecause of how Python internally stores numbers, it is very hard (if not impossible) to make a pure-Python program secure against timing attacks. The source code is maintained at GitHub and is Or download it from the Python Package Index. For all changes, check the changelog.ĭownload and install using: pip install rsa

The code was mostly written byĭocumentation can be found at the Python-RSA homepage. Generation according to PKCS#1 version 1.5.

It supportsĮncryption and decryption, signing and verifying signatures, and key

Python-RSA is a pure-Python RSA implementation.
