Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. Preventing and encrypting data from breaking Xml Structure

Preventing and encrypting data from breaking Xml Structure

Scheduled Pinned Locked Moved XML / XSL
securityxmlquestion
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Saksida Bojan
    wrote on last edited by
    #1

    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?

    S 1 Reply Last reply
    0
    • S Saksida Bojan

      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?

      S Offline
      S Offline
      Stuart Dootson
      wrote on last edited by
      #2

      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

      S 1 Reply Last reply
      0
      • S Stuart Dootson

        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

        S Offline
        S Offline
        Saksida Bojan
        wrote on last edited by
        #3

        In Other words. I Shoud encrypt with aes256 and then encode in Base64? Will Base64 UTF-7 encode conflict with Xml UTF-8 encode?

        S 1 Reply Last reply
        0
        • S Saksida Bojan

          In Other words. I Shoud encrypt with aes256 and then encode in Base64? Will Base64 UTF-7 encode conflict with Xml UTF-8 encode?

          S Offline
          S Offline
          Stuart Dootson
          wrote on last edited by
          #4

          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

          S 1 Reply Last reply
          0
          • S Stuart Dootson

            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

            S Offline
            S Offline
            Saksida Bojan
            wrote on last edited by
            #5

            Thank you for your help

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups