Hi.I am not so good in Java. I need to know how to convert a DES SecretKey generated using Java to a String and vice versa. I am doing a program in java using DES. It is needed to convert the SecretKey (which is for encryption) to String and has to be sent to another process and in there, the same SecretKey has to be got from Srting (for Decryption).Please help me.
posted 8 years ago
Welcome to JavaRanch.
You can obtain the bytes that make up the key by calling its getEncoded method. Using a reversible encoding like base-64 it is possible to create a String from that (and later transform it back into a byte).