Skip to content

Tag: cryptography

Invalid AES key length: 20 bytes (Java 11)

I am trying to generate a key using Java. To be honest I am not that experienced with keys, password, ciphers and encryption. And from whatever I have searched from this site, I see it as a very common problem. I did some reading and came up with this code that I wrote: This is modified from an answer that

Authorized responder for an OCSP response not validating with CertPathValidator

I’m trying to validate a certificate path with stapled OCSP checking through CertPathValidator. There might be some RFC-protocol that prohibits what I expect to validate just fine, but I’ve been unable to find this. Some paint art to describe relations between certificates discussed: overview When verifying the certificate path I get an exception stating that the responder is not authorized

Is SecureRandom weaken when seed with Random?

Could a seed from java.util.Random for weaken the cryptographically strong random number generator? I saw this code and wonder why this is done in that specific way. From the documentation, the call of setSeed will never reduce randomness. So why is setSeed called anyway? public void setSeed(long seed) Reseeds this random object, using the eight bytes contained in the

Decrypt Java AES/CBC/PKCS5Padding with CryptoJS

I have some problem decrypting text with CryptoJS that has been encrypted with Java. The decryption should be done with AES/CBC/PKCS5Padding. The encrypted string is base64 encoded and I decode it before trying to decrypt the string. This is how the Java code looks like: And this is how I attempt to decrypt it in CryptoJS. SharedSecretKey is both the

CMS signature SHA1+RSA with PEM format – Java

I need to generate a CMS with SHA1+RSA detached signature in PEM format over a xml file input. I need to make this from Java code in runtime. I need to avoid the use of an external tool like OpenSSL. This is because we need invoke some services with the generated signature from Java and manage error properly if an