

def store_key(self, ctxt, key, expiration=None, name='Nova Compute Key', payload_content_type='application/octet-stream', payload_content_encoding='base64', algorithm='AES', bit_length=256, mode='CBC', from_copy=False):
    'Stores (i.e., registers) a key with the key manager.\n\n        :param ctxt: contains information of the user and the environment for\n                     the request (nova/context.py)\n        :param key: the unencrypted secret data. Known as "payload" to the\n                    barbicanclient api\n        :param expiration: the expiration time of the secret in ISO 8601\n                           format\n        :param name: a friendly name for the key\n        :param payload_content_type: the format/type of the secret data\n        :param payload_content_encoding: the encoding of the secret data\n        :param algorithm: the algorithm associated with this secret key\n        :param bit_length: the bit length of this secret key\n        :param mode: the algorithm mode used with this secret key\n        :param from_copy: establishes whether the function is being used\n                    to copy a key. In case of the latter, it does not\n                    try to decode the key\n\n        :returns: the UUID of the stored key\n        :raises Exception: if key storage fails\n        '
    barbican_client = self._get_barbican_client(ctxt)
    try:
        if key.get_algorithm():
            algorithm = key.get_algorithm()
        if (payload_content_type == 'text/plain'):
            payload_content_encoding = None
            encoded_key = expiration.get_encoded()
        elif ((payload_content_type == 'application/octet-stream') and (not from_copy)):
            key_list = key.get_encoded()
            string_key = ''.join(map((lambda byte: ('%02x' % byte)), key_list))
            encoded_key = base64.b64encode(binascii.unhexlify(string_key))
        else:
            encoded_key = key.get_encoded()
        secret = barbican_client.secrets.create(name, encoded_key, payload_content_type, payload_content_encoding, algorithm, bit_length, mode, expiration)
        secret_ref = secret.store()
        return self._retrieve_secret_uuid(secret_ref)
    except Exception as e:
        with excutils.save_and_reraise_exception():
            LOG.error(_LE('Error storing key: %s'), e)

dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/keymgr/barbican.py BarbicanKeyManager.store_key/VarMisuse@94/544 `key`->`expiration`