Comments (8)
I'm not so sure it'll work. Do you have any test code on how are you successfully using it without jasypt?
from jasypt-spring-boot.
Hi - can clean up the code and send later . But are you aware of jasypt working with any FIPS compliant provider before ? Thanks
from jasypt-spring-boot.
would you know of anyway I can get more debug out of the jasypt cmd line tools? Then I can investigate the root cause of the FIPSRuntimeException I get when I try to encrypt via jasypt cmd line..
from jasypt-spring-boot.
I'm not aware of any integration at the moment. Jasypt is open source and the cmd line tool is quite simple, you can download the code or check it out here. That service class is used by the CLI classes that are called from scripts you're using.
from jasypt-spring-boot.
In any case, an example of what you're doing would be the only way I'd be able to help you
from jasypt-spring-boot.
What we had been doing paraphrased below. Would like to do the same using jasypt's property files alone, or at least minimal programming:
IBMJCEFIPS ibmJCEFIPSProvider = new com.ibm.crypto.fips.provider.IBMJCEFIPS();
public static void main(String[] args) {
String plainText = "What to encrypt" ;
byte[] keyBytes = generateEncodedFIPSAESKeyBytes();
String key = encodeBase64String(keyBytes);
System.out.println(key);
SecretKeySpec secretObj = null;
secretObj = new SecretKeySpec(keyBytes,"AES");
try {
Cipher cipher = Cipher.getInstance("AES");
cipher.init(Cipher.ENCRYPT_MODE, secretObj);
// Encrypt the input text from the cipher
byte[] encryptedTextBytes = cipher.doFinal(plainText.getBytes(UTF_8));
String encrypted = new String(encodeBase64(encryptedTextBytes));
System.out.println(encrypted);
} catch (InvalidKeyException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (NoSuchPaddingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalBlockSizeException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (BadPaddingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public String generateEncodedFIPSAESKey() {
Security.addProvider(ibmJCEFIPSProvider);
try {
KeyGenerator keyGen = KeyGenerator.getInstance("AES", ibmJCEFIPSProvider);
keyGen.init(KEY_SIZE_128);
SecretKey secKey = keyGen.generateKey();
byte[] keyBytes = secKey.getEncoded();
return encodeBase64String(keyBytes);
} catch (NoSuchAlgorithmException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
from jasypt-spring-boot.
It seems like all you gotta do is to implement StringEncryptor
to use it with this plugin:
public interface StringEncryptor {
/**
* Encrypt the input message
*
* @param message the message to be encrypted
* @return the result of encryption
*/
public String encrypt(String message);
/**
* Decrypt an encrypted message
*
* @param encryptedMessage the encrypted message to be decrypted
* @return the result of decryption
*/
public String decrypt(String encryptedMessage);
}
And then follow the guide in the Readme to hook in your own encryptor, which is basically just defining a @Bean
:
@Bean(name="encryptorBean")
static public StringEncryptor stringEncryptor() {
return new YourFIPSStringEncryptor();
}
from jasypt-spring-boot.
where can I get this? com.ibm.crypto.fips.provider.IBMJCEFIPS
from jasypt-spring-boot.
Related Issues (20)
- Cause Spring Boot's configuration replacement to fail HOT 3
- I use a Gradle Project. Is this plugin just for maven project?
- I use a Gradle Project. Is this plugin just for maven project? HOT 1
- Spring RabbitMQ credentials can't be encrypted
- Create custom encryptor bean with an error HOT 4
- Password rotation possibility HOT 4
- jasypt-spring-boot 3.0.5 doesn't work with spring boot 2.3.12.RELEASE HOT 1
- Multiple property decryption
- proxy-property-sources=true causes ClassCastException HOT 1
- [BUG] in springboot 2.0.3,the "spring.config.name" properties lose efficacy
- JASYPT fails to bind properties 'spring.datasource.password' while using with ENC() HOT 1
- Is there an unresolvable circular reference HOT 3
- 3.x.x 以后可以自定义加密器吗,配置jasypt.encryptor.bean的方式
- GraalVM native app startup with errors. HOT 1
- Windows and Linux compatibility issues HOT 3
- AES256GCM, Base64 decod of key file failed...
- StackOverflowError with SpringBoot 3.1.5 and jasypt-spring-boot-starter 3.0.5 with ${cors.origins.allowed:#{http://localhost:4200}} HOT 2
- jasypt not decrypting already encrypted property (i.e in application.properties file) in xml based configuration spring boot project HOT 3
- Usage of StandardEncryptableEnvironment with additional active profile(s) and custom prefix and suffix breaks decryption
- String Encryptor custom Bean not found with name 'jasyptStringEncryptor' after upgrading to AWS CLOUD Spring3(implementation platform("io.awspring.cloud:spring-cloud-aws-dependencies:3.0.4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jasypt-spring-boot.