added formatting of iOS sig alg name but left the check commented

This commit is contained in:
0xturboblitz
2024-02-23 16:49:33 -07:00
parent ad076dd29b
commit daefec1ed4
2 changed files with 8 additions and 5 deletions

View File

@@ -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,

View File

@@ -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;