Project

General

Profile

Actions

Defect #3072

closed

Uploading/creating certificate via authority into IdM will crop 0 from the beginning of serial number

Added by Roman Kučera about 2 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Roman Kučera
Target version:
Start date:
03/14/2022
Due date:
% Done:

100%

Estimated time:
Affected versions:
Owner:

Description

There is issue when you upload certificate manually to IdM it will not save the serial number correctly.
the issue is on line https://git.bcvsolutions.eu/modules/crt/-/blob/develop/Realization/backend/crt/crt-impl/src/main/java/eu/bcvsolutions/idm/crt/service/DefaultCertificateManager.java#L674
This same lane is at some other places to, so it should be fixed in all places probably.
We can probably use
Debug.toHexString(certificateSerialNumber).toUpperCase() from sun.security.util.Debug
There is only some issue with weird spaces in the converted string, so we need to fix it to.

Actions #1

Updated by Roman Kučera about 2 years ago

  • Subject changed from Uploading certificate into IdM will crop 0 from the beginning of serial number to Uploading/creating certificate via authority into IdM will crop 0 from the beginning of serial number
Actions #2

Updated by Roman Kučera about 2 years ago

Better solution is to use Hex.encodeHexString(certificateSerialNumber.toByteArray()).toUpperCase();
import org.apache.commons.codec.binary.Hex;
certificateSerialNumber is X509 instance
the point is that when we get byte array from BigInteger the leading 0 are still in place.

Actions #3

Updated by Roman Kučera about 2 years ago

  • Status changed from New to In Progress
  • Assignee set to Roman Kučera
Actions #4

Updated by Roman Kučera about 2 years ago

  • % Done changed from 0 to 80

Implemented in https://git.bcvsolutions.eu/modules/crt/-/commits/3072-serial-number-with-leading-zero
Now if serial number of certificate has odd number of digits the leading 0 is added.

Actions #5

Updated by Roman Kučera about 2 years ago

  • Target version set to 2.5.0
Actions #6

Updated by Roman Kučera about 2 years ago

  • Status changed from In Progress to Needs feedback
  • Assignee changed from Roman Kučera to Tomáš Doischer

@doischert please can you make a review?

Actions #7

Updated by Tomáš Doischer about 2 years ago

  • Assignee changed from Tomáš Doischer to Roman Kučera
  • % Done changed from 80 to 100

LGTM, nice solution!

Actions #8

Updated by Roman Kučera about 2 years ago

  • Status changed from Needs feedback to Closed

released

Actions

Also available in: Atom PDF