spring-cloud / spring-cloud/spring-cloud-config
Crypto stuff could be mocked in tests to prevent failures when there is no JCE
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 2k
- Forks
- 1.3k
- Avg merge
- 2d 59m
- Merged PRs (30d)
- 16
Description
Hi,
I've an Ubuntu 15.04 and run with JVM Oracle JDK 1.8.60 and I got the followinf excpetion in mvn clean test
Tests run: 3, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.13 sec <<< FAILURE! - in org.springframework.cloud.config.server.encryption.EncryptionControllerMultiTextEncryptorTests
shouldEncryptUsingApplicationAndProfiles(org.springframework.cloud.config.server.encryption.EncryptionControllerMultiTextEncryptorTests) Time elapsed: 0.13 sec <<< ERROR!
java.lang.IllegalArgumentException: Unable to initialize due to invalid secret key
at javax.crypto.Cipher.checkCryptoPerm(Cipher.java:1024)
at javax.crypto.Cipher.implInit(Cipher.java:790)
at javax.crypto.Cipher.chooseProvider(Cipher.java:849)
at javax.crypto.Cipher.init(Cipher.java:1348)
at javax.crypto.Cipher.init(Cipher.java:1282)
at org.springframework.security.crypto.encrypt.CipherUtils.initCipher(CipherUtils.java:113)
at org.springframework.security.crypto.encrypt.AesBytesEncryptor.encrypt(AesBytesEncryptor.java:115)
at org.springframework.security.crypto.encrypt.HexEncodingTextEncryptor.encrypt(HexEncodingTextEncryptor.java:36)
at org.springframework.cloud.config.server.encryption.EncryptionController.checkEncryptorInstalled(EncryptionController.java:169)
at org.springframework.cloud.config.server.encryption.EncryptionController.encrypt(EncryptionController.java:127)
at org.springframework.cloud.config.server.encryption.EncryptionControllerMultiTextEncryptorTests.shouldEncryptUsingApplicationAndProfiles(EncryptionControllerMultiTextEncryptorTests.java:30)
with maven results as:
Results :
Tests in error:
EncryptionControllerMultiTextEncryptorTests.shouldEncryptUsingApplicationAndProfiles:30 » IllegalArgument
EncryptionControllerTests.appAndProfile:70 » IllegalArgument Unable to initial...
EncryptionControllerTests.sunnyDayRsaKey:53 » IllegalArgument Unable to initia...
EncryptionControllerTests.formDataIn:82 » IllegalArgument Unable to initialize...
EncryptionControllerTests.addEnvironment:114 » IllegalArgument Unable to initi...
EncryptionControllerTests.formDataInWithPrefix:94 » IllegalArgument Unable to ...
KeyStoreTextEncryptorLocatorTests.testDifferentKeyDefaultSecret:60 » IllegalArgument
KeyStoreTextEncryptorLocatorTests.testDifferentKeyAndSecret:69 » IllegalArgument
KeyStoreTextEncryptorLocatorTests.testDefaults:44 » IllegalArgument Unable to ...
CipherEnvironmentEncryptorTests.shouldDecryptEnvironment:48 » IllegalArgument ...
CipherEnvironmentEncryptorTests.shouldDecryptEnvironmentWithKey:62 » IllegalArgument
Tests run: 119, Failures: 0, Errors: 11, Skipped: 0
What can should I try to fix it?
Thanks
Andrea
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Run mvn clean test and inspect the failing EncryptionControllerMultiTextEncryptorTests, EncryptionControllerTests, KeyStoreTextEncryptorLocatorTests, and CipherEnvironmentEncryptorTests. Trace the calls through EncryptionController.checkEncryptorInstalled and determine how the crypto-dependent test behavior can be isolated; done means these listed tests pass in an environment without JCE.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- backend, security, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100