'Return an encrypted credential reference.'

def _encrypt_credential(self, credential):

    credential_copy = credential.copy()
    if (credential.get('type', None) == 'ec2'):
        (encrypted_blob, key_hash) = self.credential_provider_api.encrypt(json.dumps(credential['blob']))
    else:
        (encrypted_blob, key_hash) = self.credential_provider_api.encrypt(credential['blob'])
    credential_copy['encrypted_blob'] = encrypted_blob
    credential_copy['key_hash'] = key_hash
    credential_copy.pop('blob', None)
    return credential_copy
