openbaton / NFVO

Repository containing the source code of the NFVO
Apache License 2.0
61 stars 56 forks source link

BadPaddingException Crypto #227

Closed wittling closed 6 years ago

wittling commented 6 years ago

I have not looked into what is causing this yet, but the stack trace is huge on it and it is happening often enough and taking enough log space that I thought I would record it as an issue. In this case it is happening after a release of resources (AES), but I see this pop up after releasing resources even if I am not running AES.

I am using the develop branch of the NFVO loaded from bootstrap script, so this may not be an issue on a master branch.

2017-11-08 11:16:47.476 INFO 5080 --- [nio-8443-exec-8] o.o.nfvo.core.events.EventDispatcher : Registered event endpointEventEndpoint{name='Subscription:INSTANTIATE_FINISH', networkServiceId='null', virtualNetworkFunctionId='null', type=REST, endpoint='http://localhost:9999/elasticity-management/INSTANTIATE_FINISH', event=INSTANTIATE_FINISH, description='null', status='null'} BaseEntity{id='b823bace-4a5c-414c-9b6f-0308449991ef', version=0, projectId='975cda45-1d2c-4d11-a8e2-5ccd9d0dbf5e', shared=false, metadata=null} 2017-11-08 11:16:47.477 DEBUG 5080 --- [atonAsyncTask-1] o.o.nfvo.core.events.EventManagement : Checking for unreachable events 2017-11-08 11:16:47.551 INFO 5080 --- [io-8443-exec-10] o.o.nfvo.core.events.EventDispatcher : Registered event endpointEventEndpoint{name='Subscription:RELEASE_RESOURCES_FINISH', networkServiceId='null', virtualNetworkFunctionId='null', type=REST, endpoint='http://localhost:9999/elasticity-management/RELEASE_RESOURCES_FINISH', event=RELEASE_RESOURCES_FINISH, description='null', status='null'} BaseEntity{id='3c771297-3be3-4fb1-bed9-2b68293fef24', version=0, projectId='975cda45-1d2c-4d11-a8e2-5ccd9d0dbf5e', shared=false, metadata=null} 2017-11-08 11:16:47.552 DEBUG 5080 --- [atonAsyncTask-1] o.o.nfvo.core.events.EventManagement : Checking for unreachable events 2017-11-08 11:16:47.618 INFO 5080 --- [nio-8443-exec-1] o.o.nfvo.core.events.EventDispatcher : Registered event endpointEventEndpoint{name='Subscription:ERROR', networkServiceId='null', virtualNetworkFunctionId='null', type=REST, endpoint='http://localhost:9999/elasticity-management/ERROR', event=ERROR, description='null', status='null'} BaseEntity{id='b7059287-a5fa-485a-92ac-b1308af0c142', version=0, projectId='975cda45-1d2c-4d11-a8e2-5ccd9d0dbf5e', shared=false, metadata=null} 2017-11-08 11:16:47.618 DEBUG 5080 --- [atonAsyncTask-1] o.o.nfvo.core.events.EventManagement : Checking for unreachable events javax.crypto.BadPaddingException: Given final block not properly padded at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:989) at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:845) at com.sun.crypto.provider.AESCipher.engineDoFinal(AESCipher.java:446) at javax.crypto.Cipher.doFinal(Cipher.java:2165) at org.openbaton.nfvo.common.utils.key.KeyHelper.decryptNew(KeyHelper.java:88) at org.openbaton.nfvo.security.components.ComponentManager.registerService(ComponentManager.java:100) at org.openbaton.nfvo.api.admin.RestComponents.registerService(RestComponents.java:149) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498)

lorenzotomasini commented 6 years ago

Hello,

sorry for the delay. How can i reproduce the issue? Should i just run the develop branch with the compatible ASE? or with any invocation from the SDK this error will occur? is it happening also in the RC?

From your logs, it seems that it is happening every time you try to register a service org.openbaton.nfvo.security.components.ComponentManager.registerService(ComponentManager.java:100).

Do you confirm that?

wittling commented 6 years ago

This was occuring in the nfvo window (log) when you ran the AutoScaling Engine. I believe it occurred if you stopped the ase engine while orchestrator (nfvo) was still running, after VMs had finished their full life cycle and were in START state. I can check when I go to the office tomorrow.

wittling commented 6 years ago

I still see this error printing on my NFVO logs. Very verbose. It actually doesn't seem to be affecting functionality, so I have not prioritized investigation of it. I do remember a while back, that when I generated keys for services (like aes), some of those keys would get generated with metacharacters (the type that cause issues with regular expressions, like hyphens, question marks, asterisks and so forth). I got into the habit of generating the keys multiple times, until I would get a key that had none of these characters. Then I would put it in my properties file and things tended to work better. It COULD be, that this Bad Padding Exception is related to something with these keys. But again - despite the fact that this prints continually for a while in the NFVO log when I stop my scaling engine, it does not seem to impact the functionality or behavior of any of the modules.

marcellom commented 6 years ago

This should be fixed. If you have the same issue with release 6 please reopen it.