RFR: 8296787: Unify debug printing format of X.509 cert serial numbers [v5]

Sean Coffey coffeys at openjdk.org
Tue Dec 5 10:45:35 UTC 2023


On Mon, 4 Dec 2023 21:00:47 GMT, Ben Perez <duke at openjdk.org> wrote:

>> Updated `X509CertSelector.java`, `SerialNumber.java`, and `SSLLogger`  to use same debug printing format for X.509 serial numbers. The changes are:
>> -  `X509CertSelector` was `SN: 83be056904246b1a1756ac95991c74a` and now is `Serial number: 08:3B:E0:56:90:42:46:B1:A1:75:6A:C9:59:91:C7:4A`
>> - `SerialNumber` was `SerialNumber: [ 083be056 904246b1 a1756ac9 5991c74a]` and now is `Serial number: 08:3B:E0:56:90:42:46:B1:A1:75:6A:C9:59:91:C7:4A`
>> - `SSLLogger` was `"serial number" : "083BE056904246B1A1756AC95991C74A"` and now is `"serial number" : 08:3B:E0:56:90:42:46:B1:A1:75:6A:C9:59:91:C7:4A`
>
> Ben Perez has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Standardized serial number print format

Edits are heading in the right direction. 

How about refactoring the Debug utility methods ? `toString(byte[]) `might be better as `toHexString(byte[])`

you could also introduce a `toHexString(BigInteger)` method in Debug. That will save you the extra `toByteArray()` call you're making in the various call sites.

It should be possible to extend code coverage in an existing x509 test also to ensure the serial number `toString `output is as expected and to ensure we don't regress in this area in the future etc.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/16834#issuecomment-1840491001



More information about the security-dev mailing list