Claus Ibsen created CAMEL-26258:
-----------------------------------

             Summary: camel-alibaba-kms - encrypt corrupts a binary InputStream 
or File plaintext by converting it to a String before Base64
                 Key: CAMEL-26258
                 URL: https://issues.apache.org/jira/browse/CAMEL-26258
             Project: Camel
          Issue Type: Bug
            Reporter: Claus Ibsen
             Fix For: 4.24.0


Found while adding the catalog body types of alibaba-kms (CAMEL-24961, PR 
#28409).

h4. 1. A binary stream or File plaintext is corrupted

{{KMSUtils.encodePlaintextForEncrypt}} (main 2a465aa4814c, lines 93-97) 
Base64-encodes byte[] and String bodies as they are, but converts any other 
body to a String first, so a binary {{InputStream}} or {{File}} is changed 
before it is encrypted and decrypt gives back different bytes. Checked on 
4.24.0-SNAPSHOT with a Mockito client set on the endpoint.

Proposed: convert the other bodies with {{getBody(byte[].class)}} before Base64.

_Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to