Preventing and encrypting data from breaking Xml Structure
-
I think somethink like this:
<Data encryption="AES256">Some Encrypted Data</Data>
Is it safe to use it like this. And is there a chance that Encryption coud break xml format? What other encrpytion coud i use? And a if a user chose plain text, Are '< and '>' the only characters needed to parse?
-
I think somethink like this:
<Data encryption="AES256">Some Encrypted Data</Data>
Is it safe to use it like this. And is there a chance that Encryption coud break xml format? What other encrpytion coud i use? And a if a user chose plain text, Are '< and '>' the only characters needed to parse?
Saksida Bojan wrote:
Is it safe to use it like this. And is there a chance that Encryption coud break xml format?
Not safe - there is a good chance it could break. Thing is - XML is a text format, and you're trying to embed an arbitrary byte stream in it. So, what you need to do is encode the encrypted byte stream as a character stream, using something like Base64[^] encoding. After that, you could mark the encoded text stream as CDATA[^] - wouldn't hurt...
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
-
Saksida Bojan wrote:
Is it safe to use it like this. And is there a chance that Encryption coud break xml format?
Not safe - there is a good chance it could break. Thing is - XML is a text format, and you're trying to embed an arbitrary byte stream in it. So, what you need to do is encode the encrypted byte stream as a character stream, using something like Base64[^] encoding. After that, you could mark the encoded text stream as CDATA[^] - wouldn't hurt...
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
In Other words. I Shoud encrypt with aes256 and then encode in Base64? Will Base64 UTF-7 encode conflict with Xml UTF-8 encode?
-
In Other words. I Shoud encrypt with aes256 and then encode in Base64? Will Base64 UTF-7 encode conflict with Xml UTF-8 encode?
Saksida Bojan wrote:
In Other words. I Shoud encrypt with aes256 and then encode in Base64?
Yes
Saksida Bojan wrote:
Will Base64 UTF-7 encode conflict with Xml UTF-8 encode?
No - UTF7 is an example of a system that uses base64. You'll also be using base64 to encode binary using 64 characters - you won't be using UTF7.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
-
Saksida Bojan wrote:
In Other words. I Shoud encrypt with aes256 and then encode in Base64?
Yes
Saksida Bojan wrote:
Will Base64 UTF-7 encode conflict with Xml UTF-8 encode?
No - UTF7 is an example of a system that uses base64. You'll also be using base64 to encode binary using 64 characters - you won't be using UTF7.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
Thank you for your help