Skip to content

Commit

Permalink
fix: parsing certificateReference
Browse files Browse the repository at this point in the history
Parsing certificateReference to integer may cause the value range to be
exceeded. Therefore, it is now parsed to BigInteger
  • Loading branch information
tsenger committed Oct 11, 2024
1 parent 88b256f commit b5f0638
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<groupId>de.tsenger</groupId>
<artifactId>vdstools</artifactId>
<version>0.3.1</version>
<version>0.3.2</version>
<name>VDS Tools java library</name>
<description>A library to parse, verify and build/encode Visible Digital Seals (VDS)</description>
<packaging>jar</packaging>
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/de/tsenger/vdstools/seals/DigitalSeal.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package de.tsenger.vdstools.seals;

import java.io.IOException;
import java.math.BigInteger;
import java.security.cert.X509Certificate;
import java.time.LocalDate;
import java.util.EnumMap;
Expand Down Expand Up @@ -77,8 +78,8 @@ public String getIssuingCountry() {
* @return Formated SignerCertRef all UPPERCASE
*/
public String getSignerCertRef() {
int certRefInteger = Integer.decode("0x" + vdsHeader.certificateReference);
return String.format("%s%x", vdsHeader.signerIdentifier, certRefInteger).toUpperCase();
BigInteger certRefInteger = new BigInteger(vdsHeader.certificateReference, 16);
return String.format("%s%x", vdsHeader.signerIdentifier, certRefInteger).toUpperCase();
}

public String getSignerIdentifier() {
Expand Down

0 comments on commit b5f0638

Please sign in to comment.