Firstly, apologies for the amount of code I’m about to post. I’m trying to use the RSA public key from my Java application to encrypt a message in an Android app, and then send the ciphertext back to a Java environment for decryption, but upon attempting to decrypt I always get this error: The cip…
Tag: encryption
Java encryption with sha256 and salt
I need a little help from you, I have an exercise , to do a login program and to store the password with sha-256 and salt, I made a part, but here it’s the hard part. I’ve read that if you use sha-256 that you can’t reverse the operation to determine the password. If it’s true then wha…
No Java folder located in Library despite JDK installation
Currently running OSX El Capitan on a recently set up computer. I’m trying to set up Java’s unlimited crypto policy which requires me to modify some files within my current jre, but I can’t find the Java folder that is supposed to be located within Library. I’ve run /usr/libexec/java_h…
Is there a way to encrypt/decrypt using Bouncy Castle without using compression
I’m looking for a way to encrypt/decrypt files/byte arrays without calling compression of input. To be more precises don’t want to use something like ByteArrayOutputStream bOut = new …
Encrypt password fields in mongodb
I have following code, it insert the userName and password into database but the password is stored in plain text format. I mean when I’ll look into the db I can see the inserted password. I want to store password in encrypted format How can I achieve this? Answer According to the conversation in the co…
null pointer Exception after writeObject to OutputStream
This is code for a basic chat server. The user is asked to enter a username and password on the Chat_Client, which is then encrypted using EncryptedMessage’s encrypt method and sent to the Chat_Server via the ClientOutputStream using writeObject. When code line clientOutputStream.writeObject(uname) is r…
JavaScript, Java, Php, or C++ cipher encryption – reworking algorithm
I am trying to implement a loop that encrypts a string to the given shift amount of int shift. The code below works great, however I’d like to change the code so that it encrypts in a descending order instead of ascending. Any clues as to what to change in the algorithm? With a shift of 3, the above cod…
Calculation of Diffie–Hellman public key slow
hi i’m trying to implement a Diffie–Hellman key exchange but the calculation for 100000 already takes several seconds. I won’t know hoch much time it would take for a 256bit number. Is it so slow because of the implementation of BigInteger or am i off the track? Answer the problem is that g.pow(se…
Seeking in AES-CTR-encrypted input
As AES in CTR mode is great for random access, lets say I have a data source created with a CipherOutputStream in AES-CTR mode. The library underneath—which is not mine—uses a RandomAccessFile that allows to seek to a specific byte offset in the file. My initial thought would be to use a CipherInputStream wit…
C# and Java DES Encryption value are not identical
I am trying to encrypt the same data using C# and Java. If the data is more than 7 bytes then Java and C#’s encrypted value are not identical. Input 1: a java output: FrOzOp/2Io8= C# output: FrOzOp/2Io8= Input 2: abc j : H9A/ahl8K7I= c#: H9A/ahl8K7I= Input 3: aaaaaaaa (Problem) j : Gxl7e0aWPd7j6l7uIEuMx…