Custom Search

Tuesday, July 8, 2014

OpenStack ValueError: AES key must be either 16, 24, or 32 bytes long

=========== Fix ======
1)
Goto "/etc/heat/heat.conf" and set "auth_encryption_key" with 32 char string, like
auth_encryption_key=12345678912345678912345678912345

2)
For more info check the method "encrypt" of /usr/lib/python2.7/dist-packages/heat/common/crypt.py

def encrypt(auth_info):
    if auth_info is None:
        return None, None
    sym = utils.SymmetricCrypto()
    res = sym.encrypt(cfg.CONF.auth_encryption_key[:32],
                      auth_info, b64encode=True)
    return 'oslo_decrypt_v1', res







===========command i used======

#heat --os-username admin --os-password nova --os-tenant-name admin --os-auth-url http://192.168.56.102:35357/v2.0 --heat-url http://127.0.0.1:8004/v1/5864a59a240e4a43bc3c17fcbd6cfd83 --os-no-client-auth --debug stack-create stk1 -f https://raw.githubusercontent.com/openstack/heat-templates/master/hot/hello_world.yaml -P "db_password=P23456" -P "KeyName=k2" -P "ImageId=13ad8950-1f00-4587-8d3c-dd726265de08"

========error====

2014-07-08 16:45:57.821 4350 ERROR root [-] Unexpected error occurred serving API: AES key must be either 16, 24, or 32 bytes long
Traceback (most recent call last):

  File "/usr/lib/python2.7/dist-packages/heat/openstack/common/rpc/amqp.py", line 462, in _process_data
    **args)

  File "/usr/lib/python2.7/dist-packages/heat/openstack/common/rpc/dispatcher.py", line 180, in dispatch
    result = getattr(proxyobj, method)(ctxt, **kwargs)

  File "/usr/lib/python2.7/dist-packages/heat/engine/service.py", line 63, in wrapped
    return func(self, ctx, *args, **kwargs)

  File "/usr/lib/python2.7/dist-packages/heat/engine/service.py", line 522, in create_stack
    stack.store()

  File "/usr/lib/python2.7/dist-packages/heat/engine/parser.py", line 231, in store
    new_creds = db_api.user_creds_create(self.context)

  File "/usr/lib/python2.7/dist-packages/heat/db/api.py", line 162, in user_creds_create
    return IMPL.user_creds_create(context)

  File "/usr/lib/python2.7/dist-packages/heat/db/sqlalchemy/api.py", line 453, in user_creds_create
    user_creds_ref.tenant = values.get('tenant')

  File "/usr/lib/python2.7/dist-packages/heat/db/sqlalchemy/api.py", line 165, in _encrypt
    return crypt.encrypt(value.encode('utf-8'))

  File "/usr/lib/python2.7/dist-packages/heat/common/crypt.py", line 39, in encrypt
    auth_info, b64encode=True)

  File "/usr/lib/python2.7/dist-packages/heat/openstack/common/crypto/utils.py", line 130, in encrypt
    cipher = self.cipher.new(key, self.cipher.MODE_CBC, iv)

  File "/usr/lib/python2.7/dist-packages/Crypto/Cipher/AES.py", line 94, in new
    return AESCipher(key, *args, **kwargs)

  File "/usr/lib/python2.7/dist-packages/Crypto/Cipher/AES.py", line 59, in __init__
    blockalgo.BlockAlgo.__init__(self, _AES, key, *args, **kwargs)

  File "/usr/lib/python2.7/dist-packages/Crypto/Cipher/blockalgo.py", line 141, in __init__
    self._cipher = factory.new(key, *args, **kwargs)

ValueError: AES key must be either 16, 24, or 32 bytes long

No comments:

Post a Comment