Uploaded image for project: 'Commons Sandbox'
  1. Commons Sandbox
  2. SANDBOX-151

[ID] VersionFourGenerator.nextIdentifier fails in secure mode

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • None
    • Nightly Builds
    • Id
    • None
    • This JIRA environment is horrible: If I am not logged in I cannot report a bug (may be OK), but I am then on a page which just does not tell me about authorization problems but offers me some other projects where I could report!

    Description

      Generating secure ID only works on initialization, aftyerwards always the same ID is returned.

      Fix the wrong if-blocks, then also the third ID will be unique...:
      private UUID nextUUID(boolean secure)
      {
      byte[] raw = new byte[UUID_BYTE_LENGTH];
      if (secure) {
      //Initialize the secure random if null.
      if (secureRandom == null) {
      try {
      if (usePRNGPackage != null)

      { secureRandom = SecureRandom.getInstance(usePRNG, usePRNGPackage); }

      else

      { secureRandom = SecureRandom.getInstance(usePRNG); }

      } catch (NoSuchAlgorithmException nsae)

      { nsae.printStackTrace(); secure = false; //Fail back to default PRNG/Random }

      catch (NoSuchProviderException nspe)

      { nspe.printStackTrace(); secure = false; //Fail back to default PRNG/Random }

      }

      // fix by mattin
      if (secureRandom != null)

      { secureRandom.nextBytes(raw); }

      }

      if (!secure)

      { regularRandom.nextBytes(raw); }

      Attachments

        Activity

          People

            joehni Joerg Schaible
            mattin Martin Heitz
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: