Defect #3072
closedUploading/creating certificate via authority into IdM will crop 0 from the beginning of serial number
100%
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.
Updated by Roman Kučera almost 3 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
Updated by Roman Kučera almost 3 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.
Updated by Roman Kučera almost 3 years ago
- Status changed from New to In Progress
- Assignee set to Roman Kučera
Updated by Roman Kučera almost 3 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.
Updated by Roman Kučera over 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?
Updated by Tomáš Doischer over 2 years ago
- Assignee changed from Tomáš Doischer to Roman Kučera
- % Done changed from 80 to 100
LGTM, nice solution!