更改symmetric.key.master.password在6.0中不起作用

时间:2017-06-05 05:41:28

标签: java encryption hybris

Same question

在安装新的hybris实例时,我尝试更改symmetric.key.master.password。但是在服务器启动时它会抛出以下错误。

请注意:我创建了symmetric.key.master.password随机文字/数字,例如(JOSD53FJPjas1243ojdf9872rIJDFOJS3DioaIUOSI64Dj4foiaew12fIIOAS

错误

  [java] ERROR [main] [EncryptionUtil] pad block corrupted
  [java] javax.crypto.BadPaddingException: pad block corruptedWARN  [main] [CloseAwareApplicationContext] Exception encountered during context initialization - cancelling refresh attempt
  [java]     at org.bouncycastle.jce.provider.JCEBlockCipher.engineDoFinal(Unknown Source)
  [java]     at javax.crypto.Cipher.doFinal(Cipher.java:2165)
  [java]     at de.hybris.platform.util.encryption.EncryptionUtil.loadKey(EncryptionUtil.java:527)
  [java]     at de.hybris.platform.util.encryption.EncryptionUtil.loadKey(EncryptionUtil.java:484)
  [java]     at de.hybris.platform.util.encryption.EncryptionUtil.loadKey(EncryptionUtil.java:429)
  [java]
  [java]     at de.hybris.platform.core.MasterTenant.readKeyFiles(MasterTenant.java:235)
  [java]     at de.hybris.platform.core.MasterTenant.getValueEncryptor(MasterTenant.java:147)
  [java]     at de.hybris.platform.directpersistence.read.DefaultSLDItemDAO.init(DefaultSLDItemDAO.java:69)
  [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  [java]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  [java]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  [java]     at java.lang.reflect.Method.invoke(Method.java:498)
  [java]     at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:349)
  [java]     at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:300)
  [java]     at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:133)
  [java]     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:408)
  [java]     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1566)
  [java]     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
  [java]     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
  [java]     at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
  [java]     at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
  [java]     at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
  [java]     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
  [java]     at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351)

修改: -

local.properties更改:

symmetric.key.file.1=default-128-bit-aes-key.hybris
symmetric.key.file.2=Generated-256-Bit-AES-Key2.hybris
symmetric.key.file.default=2
symmetric.key.master.password=1234567

以上配置hybris服务器工作正常(hybrisserver.sh / ant initialize等)。但是,如果我尝试将master.password更改为1234568,则pad block corruptedhybrisserver.sh/ant initialize。我也尝试使用新数据库(drop / create)并执行ant initialize,得到相同的错误。它仅适用于OOTB master.password1234567

2 个答案:

答案 0 :(得分:1)

从您的堆栈跟踪中我认为问题可能在于加载symmetric.key.file

请尝试使用help.hybris.com/Transparent Attribute Encryption (TAE) - Hybris V6

中提供的建议重新生成对称密钥

答案 1 :(得分:0)

如果您可以访问Hybris wiki,请参阅此链接,它可能会对您有所帮助 Transparent Attribute Encryption