Skip to main content

I am working a sample involving encryption and decryption and facing issues.

Here is the problem:

While using the "Encrypt and Decrypt Fields" processor when we encrypt something using it, it outputs the resulting fields in a ByteArray format, and when we save it somewhere like localFS the ByteArray gets converted into String Format,
Now when it comes to the decryption part, The processor needs ByteArray format only , So when I try to convert the String into Byte array it results in some unrecognizable characters which causes error.

Encryption:

Decryption:

Please let me know if you have any pointers.

@Satish Panchware 

 

Kindly give a try to convert string to BYTE_ARRAY and decrypt  it , check if its giving the expected result or  not.

 

If the issue still persists , please provide the sample input and expected result ,so i can help you on it.

 

 

Thanks & Regards

Bikram_


Hi Bikram,

Thanks for the reply, I am already converting to byte array before decrypting.

 



Hey Bikram,
While storing the encrypted fields using in JSON format the Byte Array is being converted into String automatically, so to counter that we are trying to Convert into String explicitly, but it is outputting some unrecognizable characters.

Is there any other way to store the Byte array in a JSON file which is not converted automatically into string data type.
because on string conversion the encryption format is hampered, and we are getting “Bad Cipher” error.

The plan is to first encrypt a JSON file using any StreamSets processor and save it somewhere on localFS then on a separate pipeline we need to decrypt the same file and get the values for further processing.


When I use the Encrypt and Decrypt component to encrypt a string field, I encounter the following error. Could you please tell me what might be causing this issue? Also, when I convert the string type to a byte array or base64 characters, it doesn't work either.

 


Hi Bikram,

Thanks for the reply, I am already converting to byte array before decrypting.

 

Hello, I also encountered the same problem. How did you solve it? Can you screenshot it and show me?I look forward to receiving your reply. Thank you very much.


@Satish Panchware 

@sky 

I attempted various methods to encrypt and decrypt the string, and I'm pleased to report that the results align with our expectations.

I have also attached the pipeline used for this process.

Please review the provided information, and let me know if this contributes to resolving the issues at hand. Additionally,

I have included a sample output that demonstrates the decrypted strings for your reference.

 

Thanks & Regards

Bikram_


Reply