From 44632e8e04f913938b1c3d3672ef370d3cc15583 Mon Sep 17 00:00:00 2001 From: Cyrus <24922493+cyrus-dev@users.noreply.github.com> Date: Tue, 30 Mar 2021 08:06:26 -0400 Subject: [PATCH] Updated the code for authority serial number and serial number for the general info for any certificate to no longer use the getLong method of the Big Integer object. This truncated the value. Instead, the new code uses the Hex.toHexString method from bouncy castle. --- .../portal/util/CertificateStringMapBuilder.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/util/CertificateStringMapBuilder.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/util/CertificateStringMapBuilder.java index ebdee349..3ec6aad5 100644 --- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/util/CertificateStringMapBuilder.java +++ b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/util/CertificateStringMapBuilder.java @@ -53,10 +53,10 @@ public final class CertificateStringMapBuilder { if (certificate != null) { data.put("issuer", certificate.getIssuer()); //Serial number in hex value - data.put("serialNumber", Long.toHexString(certificate.getSerialNumber().longValue())); + data.put("serialNumber", Hex.toHexString(certificate.getSerialNumber().toByteArray())); if (!certificate.getAuthoritySerialNumber().equals(BigInteger.ZERO)) { - data.put("authSerialNumber", Long.toHexString(certificate - .getAuthoritySerialNumber().longValue())); + data.put("authSerialNumber", Hex.toHexString(certificate + .getAuthoritySerialNumber().toByteArray())); } if (certificate.getId() != null) { data.put("certificateId", certificate.getId().toString());