diff --git a/app/App.tsx b/app/App.tsx index ece131243..753a99705 100644 --- a/app/App.tsx +++ b/app/App.tsx @@ -15,7 +15,7 @@ import { } from '@env'; import { PassportData } from '../common/src/utils/types'; import { revealBitmapFromMapping } from '../common/src/utils/revealBitmap'; -import { jmrtdToStandardName } from '../common/src/utils/formatNames'; +import { toStandardName } from '../common/src/utils/formatNames'; import { generateCircuitInputs } from '../common/src/utils/generateInputs'; import { AWS_ENDPOINT } from '../common/src/constants/constants'; import { @@ -147,7 +147,7 @@ function App(): JSX.Element { const passportData = { mrz, - signatureAlgorithm, + signatureAlgorithm: toStandardName(signatureAlgorithm), pubKey: { modulus: modulus, }, @@ -189,7 +189,7 @@ function App(): JSX.Element { const passportData: PassportData = { mrz: mrz.replace(/\n/g, ''), - signatureAlgorithm: jmrtdToStandardName(signatureAlgorithm), + signatureAlgorithm: toStandardName(signatureAlgorithm), pubKey: { modulus: modulus, curveName: curveName, diff --git a/common/src/utils/formatNames.ts b/common/src/utils/formatNames.ts index 82076cc29..78a6b5eea 100644 --- a/common/src/utils/formatNames.ts +++ b/common/src/utils/formatNames.ts @@ -1,9 +1,10 @@ -// we use the sig alg / hash function names returned in modulus extractor, the iOS module and the OID reference +// we use the sig alg / hash function names returned in modulus extractor and the OID reference // Example for https://oidref.com/1.2.840.113549.1.1.11: sha256WithRSAEncryption // the jmrtd lib returns other names (ex: SHA256withRSA), see this page: https://github.com/E3V3A/JMRTD/blob/master/jmrtd/src/org/jmrtd/lds/SODFile.java +// Sometimesm, iOS module too (ex rsaEncryption instead of sha256WithRSAEncryption) // So we translate here -export function jmrtdToStandardName(jmrtdName: string): string { +export function toStandardName(jmrtdName: string): string { switch (jmrtdName) { // hash functions case "SHA-1": @@ -52,6 +53,8 @@ export function jmrtdToStandardName(jmrtdName: string): string { return "rsassa-pss"; case "SHA256withRSAandMGF1": return "id-mgf1" + case "rsaEncryption": + return "sha256WithRSAEncryption"; // added this one for iOS default: console.log(`JMRTD sig alg or hash function ${jmrtdName} not found in mapping, returning it as it is`); return jmrtdName;