Closed KBassford closed 4 years ago
if I try this ...
import os, re, sys import binascii import random import base64 import logging import socket import json import random import urllib.request from Crypto.Cipher import AES from kmip.pie import objects from kmip.pie import client from kmip import enums from kmip.core.factories import attributes def gen_256_symmetric_key(): # Quick and dirty 256-bit symmetric keys. AES_key_length = 16 rawsymkey = os.urandom(AES_key_length) hexencsymkey = binascii.hexlify(rawsymkey) keyname = random_name_generator() usage = [enums.CryptographicUsageMask.ENCRYPT, enums.CryptographicUsageMask.DECRYPT] symkeyobj = objects.SymmetricKey( enums.CryptographicAlgorithm.AES, 256, hexencsymkey, keyname, usage ) return symkeyobj
... the usage is never accepted.
Nevermind, keyname and usage are backwards.
if I try this ...
... the usage is never accepted.