Posts

How to do AES encryption&decryption in java?

Image
show you the code: Base64 UrlEncoder for query parameter the key and iv are configured in properties in base64 format. So I use Base64 Decoder decode them before create SecretKeySpec and IvParameterSpec. new SecretKeySpec(Base64.getDecoder().decode(aliasKey), "AES"), new IvParameterSpec(Base64.getDecoder().decode(aliasIv))); Since I am using AES to encrypt query parameter which will be transport via internet. so I use Base64 UrlEncoder for encrption and UrlDecoder for decryption. return Ba  

How to write integration tests against LDAP in your spring boot java application?

Image
The answer is to use an embedded ldap server. spring-ldap-test bring an embedded ldap server based on ApacheDS or UnboundID. In this post, I will demo how I use UnboundID and spring-ldap-test to do testing against an embedded LDAP server. The UnboundID LDAP SDK for Java is a fast, powerful, user-friendly, and completely free Java library for communicating with LDAP directory servers. It offers better performance, better ease of use, and more features than other Java-based LDAP APIs. It is act  

How to do PGP decryption in Java?

Image
In my previous post, I mentioned how to encrypt data with PGP public key. In this post, I will tell you how to decrypt the data with PGP private key. You need a PGP key pair to test the encryption and decryption and see it works. Check this post to generate the PGP key pair. Read|Load PGPPrivateKey from file don't forget the deps before you write your code. Check the encrypt post for it. Notes: The userId is the Real name + email address in format like: `Real <Email>` , you were asked to pro  

How to do PGP encryption in Java?

Image
In order to do PGP encryption, you need the PGP public key file. In this post I will tell how to encrypt data with PGP public key in Java. Dependencies Welcome to the home of the Legion of the Bouncy Castle. A fun place to stay, if you've got some time to kill. bouncycastle.orgHome of open source libraries of the Legion of the Bouncy Castle and their Java cryptography and C# cryptography resources https://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk15on/1.70 The Bouncy Castle Cry