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
Tag: encryption
Plain text encrypt from Dart code but decrypt from Java code
When I encrypt plain text using Dart,and encrypted text is decrypted from Java code, I get this error: Same IV, salt and passphase value using Java side for key generation, but the generated key is different and also cipher test is different. I am using same method for key generation. I don’t know what …
SHA1 signature created in Java not being verified in PHP
I am creating an RSA signature in Java and sending it in the Auth header to a PHP server which is then verifying it. The problem is that although the signature is being verified in Java, it is failing in PHP. How do I fix this? My PHP code where I’m verifying the sign: Update: I am now signing like
How to reproduce Java MessageDigest SHA-1 secret key to be used in MySQL AES_encrypt
I have a function to prepare secret key for encryption and decryption using Java: However, for the old records from database, I would like to manually encrypt using a MySQL query. I have tried using the query below, but the result is different from the result by the Java application. Anyone can advise? or is …
How to decrypt a string in PHP that was encrypted in Java?
I tried to decrypt en encrypted string in JAVA with to code below. How can I get the same result with PHP version? I tried to write in PHP and It outputs with wrong result. Answer The build3DesKey() function expands a too short 3DES key to 24 bytes by padding the end with 0x00 values, for too long keys the
How to decrypt a password protected RSA key in java?
I’m writing a code to consume a private key to encrypt and decrypt a message. The problem is that the key i use is protected by a passphrase. So i have to decrypt the key itself before use it to encrypt and decrypt. This is the header of the key content: How can I achieve that in Java? Answer This
Java AES Decryption with keyFile using BouncyCastle SSL
I am trying to write a Java code decrypt a file encrypted with AES256 using BouncyCastle compatible with OpenSSL decryption. s_key is the file provided which contains the key that will be used to encrypt and decrypt Steps to be done: 1 – Read the key file 2 – Use the key provided to decrypt file i…
AES Encryption algorithms and padding scheme
Hello currently i have to do an AES encription and send it to an external SW but i am having trouble with the sonarqube. this is the relevant part of my current code: Is a little spaguetti cause it´s recyclated for an old code (TripleDES) sorry for that. But we can get the gist of it that`s that we are
Best practice for storing TOKEN/password in Java
I’m working on a Java application that interacts with a REST API. To communicate with this API, I must use TOKEN, all these TOKEN are sensitive data and I cannot write in my code. So I’m looking for a way like a configuration file to store the TOKEN and access it. Currently, I made an XML file with all my
How can I add support for PBEWithMD5AndTripleDES algorithm in modern OpenJDK based JVM (Semeru)
I’m trying to run some legacy code using Semeru: But this code depends on a proprietary Oracle cipher not included in OpenJDK anymore so when running: I’m getting an exception: I’ve tried including Bouncy Castle as an alternative provider, but without luck. Any chance of getting some open so…