Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-6537

StringUtil.fromHexString is used to convert encryptionKey to byte[]

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 10.10.1.1
    • Fix Version/s: 10.11.1.1
    • Component/s: Documentation, Services
    • Labels:
      None
    • Issue & fix info:
      Known fix, Newcomer
    • Bug behavior facts:
      Security

      Description

      The javadoc for StringUtil.fromHexString states that its intended use is to "Convert a hexidecimal string generated by toHexString() back into a byte array", and that null is returned if the length of the hex-string is not even.

      But in JCECipherFactory.init() it is being used to convert the encryptionKey property string to byte[]. For this usage such a restriction makes no sense, and is confusing as it is not documented (at least not in the dev guide chapter about encrypting databases).

      For this usage it would be better to use
      new BigInt(encryptionKey,16).toByteArray() which would not have this restriction. But even with this change the documentation should probably be updated to state that the value for the key must be a valid hex-string, as that is what it will be interpreted as. The first section of the doc should probably also mention that DES is the default algo, and what its minimum key length requirements are (now you need to look at the section about specifying an alternate algo, to find that).

        Attachments

        1. DERBY-6537.zip
          11 kB
          Camilla Haase
        2. DERBY-6537.stat
          0.2 kB
          Camilla Haase
        3. DERBY-6537.diff
          5 kB
          Camilla Haase

          Activity

            People

            • Assignee:
              chaase3 Camilla Haase
              Reporter:
              dyret Dyre Tjeldvoll
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: