Skip to content

Commit

Permalink
Merge pull request #1 from kaminomobile/fix/snreading
Browse files Browse the repository at this point in the history
fixed the reading of serial numbers
  • Loading branch information
nejcpintar authored Sep 19, 2022
2 parents d6d6fcf + 6074f8f commit 34d06bf
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Sources/NFCPassportReader/X509Wrapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,9 @@ public class X509Wrapper {
}

public func getSerialNumber() -> String? {
let serialNr = String( ASN1_INTEGER_get(X509_get_serialNumber(cert)), radix:16, uppercase: true )
return serialNr
let bn = ASN1_INTEGER_to_BN(X509_get_serialNumber(cert), nil)
guard let hex = BN_bn2hex(bn) else { return nil }
return String(cString: hex)
}

public func getSignatureAlgorithm() -> String? {
Expand Down

0 comments on commit 34d06bf

Please sign in to comment.