Commons Codec
  1. Commons Codec
  2. CODEC-40

[codec] Patch to add crypto-compatible BigInteger encoding support to Base64

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: Nightly Builds
    • Fix Version/s: 1.4
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

      Description

      There are crypto standards that require large integers for keys to be encoded in
      base64 with some special caveats (no sign bit, padding, etc). One of the
      standards that requires this is the w3c's XML-Signature standard. This patch
      adds this support along with junit tests. This code is taken from the Apache XML
      Security project's own Base64 class and changed to be more readable and add
      junit tests.

        Activity

        Hide
        ggregory@seagullsw.com added a comment -

        Should have been closed a while back. Code was committed in 2008!

        Show
        ggregory@seagullsw.com added a comment - Should have been closed a while back. Code was committed in 2008!
        Hide
        Henri Yandell added a comment -

        svn ci -m "Adding Chris Black's patch from CODEC-40 adding BigInteger support to Base64. Still needs edge case testing" src

        Sending src/java/org/apache/commons/codec/binary/Base64.java
        Sending src/test/org/apache/commons/codec/binary/Base64Test.java
        Transmitting file data ..
        Committed revision 634904.

        Show
        Henri Yandell added a comment - svn ci -m "Adding Chris Black's patch from CODEC-40 adding BigInteger support to Base64. Still needs edge case testing" src Sending src/java/org/apache/commons/codec/binary/Base64.java Sending src/test/org/apache/commons/codec/binary/Base64Test.java Transmitting file data .. Committed revision 634904.
        Hide
        Chris Black added a comment -

        Wow, I can't believe that patch has come back after so long
        Feel free to use it, let me know if you need me to do anything more official.

        Show
        Chris Black added a comment - Wow, I can't believe that patch has come back after so long Feel free to use it, let me know if you need me to do anything more official.
        Hide
        Henri Yandell added a comment -

        Also, just noticed that we'd need to get approval from Chris to use the patch. This predates moving to JIRA, so the Attachment says 'No' under the 'Apache granted permisson' bit.

        Show
        Henri Yandell added a comment - Also, just noticed that we'd need to get approval from Chris to use the patch. This predates moving to JIRA, so the Attachment says 'No' under the 'Apache granted permisson' bit.
        Hide
        ggregory@seagullsw.com added a comment -

        I think it would be nice to have the tests and unit tests cover some simple and edge cases: null, -1, 0, 1 as well as bogus byte arrays. A senisble error should be throws NullArgumentException, Illegal ArgumentException, etc.

        Show
        ggregory@seagullsw.com added a comment - I think it would be nice to have the tests and unit tests cover some simple and edge cases: null, -1, 0, 1 as well as bogus byte arrays. A senisble error should be throws NullArgumentException, Illegal ArgumentException, etc.
        Hide
        Henri Yandell added a comment -

        Consider for 1.4.

        Show
        Henri Yandell added a comment - Consider for 1.4.
        Hide
        Chris Black added a comment -

        Created an attachment (id=17703)
        Adds crypto-compatible integer encoding/decoding to commons-codec Base64

        Show
        Chris Black added a comment - Created an attachment (id=17703) Adds crypto-compatible integer encoding/decoding to commons-codec Base64

          People

          • Assignee:
            Unassigned
            Reporter:
            Chris Black
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development