From 81f2da8f1f654cab9e2dc1933760e4244a352d66 Mon Sep 17 00:00:00 2001 From: Raul Metsma Date: Wed, 11 Sep 2024 10:44:51 +0300 Subject: [PATCH] Don't use string catalogs IB-8186 Signed-off-by: Raul Metsma --- EstEIDToken/Localizable.xcstrings | 241 ------------------- EstEIDToken/TokenSession.m | 16 +- EstEIDToken/en.lproj/Localizable.strings | 12 + EstEIDToken/en.lproj/Localizable.stringsdict | 27 +++ EstEIDToken/et.lproj/Localizable.strings | 12 + EstEIDToken/et.lproj/Localizable.stringsdict | 27 +++ EstEIDToken/ru.lproj/Localizable.strings | 12 + EstEIDToken/ru.lproj/Localizable.stringsdict | 27 +++ EstEIDTokenApp.xcodeproj/project.pbxproj | 46 +++- EstEIDTokenApp/EstEidTokenApp.swift | 2 +- EstEIDTokenApp/Localizable.xcstrings | 6 +- 11 files changed, 160 insertions(+), 268 deletions(-) delete mode 100644 EstEIDToken/Localizable.xcstrings create mode 100644 EstEIDToken/en.lproj/Localizable.strings create mode 100644 EstEIDToken/en.lproj/Localizable.stringsdict create mode 100644 EstEIDToken/et.lproj/Localizable.strings create mode 100644 EstEIDToken/et.lproj/Localizable.stringsdict create mode 100644 EstEIDToken/ru.lproj/Localizable.strings create mode 100644 EstEIDToken/ru.lproj/Localizable.stringsdict diff --git a/EstEIDToken/Localizable.xcstrings b/EstEIDToken/Localizable.xcstrings deleted file mode 100644 index 6c8feba..0000000 --- a/EstEIDToken/Localizable.xcstrings +++ /dev/null @@ -1,241 +0,0 @@ -{ - "sourceLanguage" : "en", - "strings" : { - "AUTH_CERT" : { - "comment" : "Localizable.strings\n CryptoTokenKit", - "extractionState" : "manual", - "localizations" : { - "en" : { - "stringUnit" : { - "state" : "translated", - "value" : "Certificate For Card Authentication" - } - }, - "et" : { - "stringUnit" : { - "state" : "translated", - "value" : "Certificate For Card Authentication" - } - }, - "ru" : { - "stringUnit" : { - "state" : "translated", - "value" : "Certificate For Card Authentication" - } - } - } - }, - "AUTH_KEY" : { - "extractionState" : "manual", - "localizations" : { - "en" : { - "stringUnit" : { - "state" : "translated", - "value" : "Key For Card Authentication" - } - }, - "et" : { - "stringUnit" : { - "state" : "translated", - "value" : "Key For Card Authentication" - } - }, - "ru" : { - "stringUnit" : { - "state" : "translated", - "value" : "Key For Card Authentication" - } - } - } - }, - "ENTER_PINPAD" : { - "localizations" : { - "en" : { - "stringUnit" : { - "state" : "translated", - "value" : "Please enter PIN code on PinPAD" - } - }, - "et" : { - "stringUnit" : { - "state" : "translated", - "value" : "Palun sisestada PIN kaardilugeja sõrmistikult" - } - }, - "ru" : { - "stringUnit" : { - "state" : "translated", - "value" : "Please enter PIN code on PinPAD" - } - } - } - }, - "INVALID_PIN" : { - "localizations" : { - "en" : { - "stringUnit" : { - "state" : "translated", - "value" : "Invalid PIN entered" - } - }, - "et" : { - "stringUnit" : { - "state" : "translated", - "value" : "Sisestati ebakorrektne PIN" - } - }, - "ru" : { - "stringUnit" : { - "state" : "translated", - "value" : "Invalid PIN entered" - } - } - } - }, - "SIGN_CERT" : { - "extractionState" : "manual", - "localizations" : { - "en" : { - "stringUnit" : { - "state" : "translated", - "value" : "Certificate For Digital Signature" - } - }, - "et" : { - "stringUnit" : { - "state" : "translated", - "value" : "Certificate For Digital Signature" - } - }, - "ru" : { - "stringUnit" : { - "state" : "translated", - "value" : "Certificate For Digital Signature" - } - } - } - }, - "SIGN_KEY" : { - "extractionState" : "manual", - "localizations" : { - "en" : { - "stringUnit" : { - "state" : "translated", - "value" : "Key For Digital Signature" - } - }, - "et" : { - "stringUnit" : { - "state" : "translated", - "value" : "Key For Digital Signature" - } - }, - "ru" : { - "stringUnit" : { - "state" : "translated", - "value" : "Key For Digital Signature" - } - } - } - }, - "VERIFY_TRY_LEFT" : { - "localizations" : { - "en" : { - "variations" : { - "plural" : { - "one" : { - "stringUnit" : { - "state" : "translated", - "value" : "PIN Incorrect.\nPIN will be locked next failed attempt." - } - }, - "other" : { - "stringUnit" : { - "state" : "translated", - "value" : "PIN Incorrect.\n%d tries left" - } - }, - "zero" : { - "stringUnit" : { - "state" : "translated", - "value" : "PIN locked.\nUnblock to reuse PIN." - } - } - } - } - }, - "et" : { - "variations" : { - "plural" : { - "one" : { - "stringUnit" : { - "state" : "translated", - "value" : "Vale PIN.\nJärgmise vale koodi sisestamisel PIN lukustub." - } - }, - "other" : { - "stringUnit" : { - "state" : "translated", - "value" : "Vale PIN.\n%d katset jäänud" - } - }, - "zero" : { - "stringUnit" : { - "state" : "translated", - "value" : "PIN on lukus.\nTühista blokeering, et PIN-i taas kasutada." - } - } - } - } - }, - "ru" : { - "variations" : { - "plural" : { - "one" : { - "stringUnit" : { - "state" : "translated", - "value" : "Неверный PIN.\nPIN будет заблокирован при следующей неудачной попытке" - } - }, - "other" : { - "stringUnit" : { - "state" : "translated", - "value" : "Неправильный PIN.\nОсталось %d попыток" - } - }, - "zero" : { - "stringUnit" : { - "state" : "translated", - "value" : "PIN заблокирован.\nРазблокируйте его для повторного использования PIN." - } - } - } - } - } - } - }, - "WRONG_CONSTR" : { - "localizations" : { - "en" : { - "stringUnit" : { - "state" : "translated", - "value" : "Unexpected constraint" - } - }, - "et" : { - "stringUnit" : { - "state" : "translated", - "value" : "Unexpected constraint" - } - }, - "ru" : { - "stringUnit" : { - "state" : "translated", - "value" : "Unexpected constraint" - } - } - } - } - }, - "version" : "1.0" -} \ No newline at end of file diff --git a/EstEIDToken/TokenSession.m b/EstEIDToken/TokenSession.m index c60f021..6a269e5 100644 --- a/EstEIDToken/TokenSession.m +++ b/EstEIDToken/TokenSession.m @@ -244,7 +244,6 @@ - (BOOL)tokenSession:(TKTokenSession *)session supportsOperation:(TKTokenOperati switch (operation) { case TKTokenOperationSignData: supports = keyItem.canSign && ( - [algorithm isAlgorithm:kSecKeyAlgorithmRSASignatureRaw] || [algorithm isAlgorithm:kSecKeyAlgorithmECDSASignatureRFC4754] || [algorithm isAlgorithm:kSecKeyAlgorithmECDSASignatureDigestX962] || [algorithm isAlgorithm:kSecKeyAlgorithmECDSASignatureDigestX962SHA1] || @@ -253,9 +252,6 @@ - (BOOL)tokenSession:(TKTokenSession *)session supportsOperation:(TKTokenOperati [algorithm isAlgorithm:kSecKeyAlgorithmECDSASignatureDigestX962SHA384] || [algorithm isAlgorithm:kSecKeyAlgorithmECDSASignatureDigestX962SHA512]); break; - case TKTokenOperationDecryptData: - //supports = keyItem.canDecrypt && [algorithm isAlgorithm:kSecKeyAlgorithmRSAEncryptionRaw]; // FIXME: implement decryption - break; case TKTokenOperationPerformKeyExchange: //supports = keyItem.canPerformKeyExchange && [algorithm isAlgorithm:kSecKeyAlgorithmECDHKeyExchangeStandard]; // FIXME: implement derive break; @@ -283,18 +279,8 @@ - (NSData *)tokenSession:(TKTokenSession *)session signData:(NSData *)dataToSign return nil; } - NSData *sign = dataToSign; - if ([algorithm isAlgorithm:kSecKeyAlgorithmRSASignatureRaw]) { - NSLog(@"TokenSession Remove PKCS1 1.5 padding"); - // 00 01 FF FF 00 .... - const char *string = dataToSign.bytes; - char *e = strchr(&string[3], '\0'); // Start at pos 3 - NSUInteger pos = (NSUInteger)(e - string) + 1; - sign = [dataToSign subdataWithRange:NSMakeRange(pos, dataToSign.length - pos)]; - } - UInt16 sw = 0; - NSData *response = [self.smartCard sendIns:0x88 p1:0x00 p2:0x00 data:sign le:@0 sw:&sw error:error]; + NSData *response = [self.smartCard sendIns:0x88 p1:0x00 p2:0x00 data:dataToSign le:@0 sw:&sw error:error]; // Deauth and release session [self closeSession]; switch (sw) diff --git a/EstEIDToken/en.lproj/Localizable.strings b/EstEIDToken/en.lproj/Localizable.strings new file mode 100644 index 0000000..ced769d --- /dev/null +++ b/EstEIDToken/en.lproj/Localizable.strings @@ -0,0 +1,12 @@ +/* + Localizable.strings + CryptoTokenKit + */ + +"AUTH_CERT" = "Certificate For Card Authentication"; +"SIGN_CERT" = "Certificate For Digital Signature"; +"AUTH_KEY" = "Key For Card Authentication"; +"SIGN_KEY" = "Key For Digital Signature"; +"WRONG_CONSTR" = "Unexpected constraint"; +"ENTER_PINPAD" = "Please enter PIN code on PinPAD"; +"INVALID_PIN" = "Invalid PIN entered"; diff --git a/EstEIDToken/en.lproj/Localizable.stringsdict b/EstEIDToken/en.lproj/Localizable.stringsdict new file mode 100644 index 0000000..c6f7536 --- /dev/null +++ b/EstEIDToken/en.lproj/Localizable.stringsdict @@ -0,0 +1,27 @@ + + + + + VERIFY_TRY_LEFT + + NSStringLocalizedFormatKey + %1$#@tries@ + tries + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + d + zero + PIN locked. +Unblock to reuse PIN. + one + PIN Incorrect. +PIN will be locked next failed attempt. + other + PIN Incorrect. +%d tries left + + + + diff --git a/EstEIDToken/et.lproj/Localizable.strings b/EstEIDToken/et.lproj/Localizable.strings new file mode 100644 index 0000000..c28e969 --- /dev/null +++ b/EstEIDToken/et.lproj/Localizable.strings @@ -0,0 +1,12 @@ +/* + Localizable.strings + CryptoTokenKit + */ + +"AUTH_CERT" = "Certificate For Card Authentication"; +"SIGN_CERT" = "Certificate For Digital Signature"; +"AUTH_KEY" = "Key For Card Authentication"; +"SIGN_KEY" = "Key For Digital Signature"; +"WRONG_CONSTR" = "Unexpected constraint"; +"ENTER_PINPAD" = "Palun sisestada PIN kaardilugeja sõrmistikult"; +"INVALID_PIN" = "Sisestati ebakorrektne PIN"; diff --git a/EstEIDToken/et.lproj/Localizable.stringsdict b/EstEIDToken/et.lproj/Localizable.stringsdict new file mode 100644 index 0000000..4d534a7 --- /dev/null +++ b/EstEIDToken/et.lproj/Localizable.stringsdict @@ -0,0 +1,27 @@ + + + + + VERIFY_TRY_LEFT + + NSStringLocalizedFormatKey + %1$#@tries@ + tries + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + d + zero + PIN on lukus. +Tühista blokeering, et PIN-i taas kasutada. + one + Vale PIN. +Järgmise vale koodi sisestamisel PIN lukustub. + other + Vale PIN. +%d katset jäänud + + + + diff --git a/EstEIDToken/ru.lproj/Localizable.strings b/EstEIDToken/ru.lproj/Localizable.strings new file mode 100644 index 0000000..ced769d --- /dev/null +++ b/EstEIDToken/ru.lproj/Localizable.strings @@ -0,0 +1,12 @@ +/* + Localizable.strings + CryptoTokenKit + */ + +"AUTH_CERT" = "Certificate For Card Authentication"; +"SIGN_CERT" = "Certificate For Digital Signature"; +"AUTH_KEY" = "Key For Card Authentication"; +"SIGN_KEY" = "Key For Digital Signature"; +"WRONG_CONSTR" = "Unexpected constraint"; +"ENTER_PINPAD" = "Please enter PIN code on PinPAD"; +"INVALID_PIN" = "Invalid PIN entered"; diff --git a/EstEIDToken/ru.lproj/Localizable.stringsdict b/EstEIDToken/ru.lproj/Localizable.stringsdict new file mode 100644 index 0000000..f278df5 --- /dev/null +++ b/EstEIDToken/ru.lproj/Localizable.stringsdict @@ -0,0 +1,27 @@ + + + + + VERIFY_TRY_LEFT + + NSStringLocalizedFormatKey + %1$#@tries@ + tries + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + d + zero + PIN заблокирован. +Разблокируйте его для повторного использования PIN. + one + Неверный PIN. +PIN будет заблокирован при следующей неудачной попытке + other + Неправильный PIN. +Осталось %d попыток + + + + diff --git a/EstEIDTokenApp.xcodeproj/project.pbxproj b/EstEIDTokenApp.xcodeproj/project.pbxproj index 9925c0e..a9381c2 100644 --- a/EstEIDTokenApp.xcodeproj/project.pbxproj +++ b/EstEIDTokenApp.xcodeproj/project.pbxproj @@ -27,7 +27,8 @@ 2F3883B91CF46C9D00F114A7 /* Token.m in Sources */ = {isa = PBXBuildFile; fileRef = 2F3883B81CF46C9D00F114A7 /* Token.m */; }; 2F3883BF1CF46C9D00F114A7 /* EstEIDToken.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 2F3883B01CF46C9D00F114A7 /* EstEIDToken.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 2F3883C51CF46D6F00F114A7 /* TokenSession.m in Sources */ = {isa = PBXBuildFile; fileRef = 2F3883C41CF46D6F00F114A7 /* TokenSession.m */; }; - 4E77CCA42B5E85AB00518F62 /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = 4E77CCA32B5E85AB00518F62 /* Localizable.xcstrings */; }; + 2F7767771CF5E0A00062B0A8 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 2F7767731CF5E0A00062B0A8 /* Localizable.strings */; }; + 2F7767781CF5E0A00062B0A8 /* Localizable.stringsdict in Resources */ = {isa = PBXBuildFile; fileRef = 2F7767751CF5E0A00062B0A8 /* Localizable.stringsdict */; }; 4E77CCCB2B5EFD8B00518F62 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E77CCAB2B5EFCF400518F62 /* AppDelegate.swift */; }; 4EEEB3E22B6AEC9B00138C48 /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = 4EEEB3E12B6AEC9B00138C48 /* Localizable.xcstrings */; }; 4EF3231920AC184000809D13 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4EF3231720AC184000809D13 /* Main.storyboard */; }; @@ -83,8 +84,15 @@ 2F3883B81CF46C9D00F114A7 /* Token.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Token.m; sourceTree = ""; }; 2F3883BC1CF46C9D00F114A7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 2F3883C41CF46D6F00F114A7 /* TokenSession.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TokenSession.m; sourceTree = ""; }; - 4E77CCA32B5E85AB00518F62 /* Localizable.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; path = Localizable.xcstrings; sourceTree = ""; }; + 2F7767741CF5E0A00062B0A8 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; + 2F7767761CF5E0A00062B0A8 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = en; path = en.lproj/Localizable.stringsdict; sourceTree = ""; }; 4E77CCAB2B5EFCF400518F62 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 4EAFE85B212C20BE00DD6D87 /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/Localizable.strings; sourceTree = ""; }; + 4EAFE85C212C20BE00DD6D87 /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = ru; path = ru.lproj/Localizable.stringsdict; sourceTree = ""; }; + 4EAFE85F212C20F200DD6D87 /* et */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = et; path = et.lproj/Localizable.strings; sourceTree = ""; }; + 4EAFE860212C20F200DD6D87 /* et */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = et; path = et.lproj/Localizable.stringsdict; sourceTree = ""; }; + 4EAFE864212C21E900DD6D87 /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/Main.strings; sourceTree = ""; }; + 4EAFE866212C21E900DD6D87 /* et */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = et; path = et.lproj/Main.strings; sourceTree = ""; }; 4EEEB3E12B6AEC9B00138C48 /* Localizable.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; path = Localizable.xcstrings; sourceTree = ""; }; 4EF3230D20AC183E00809D13 /* EstEIDTokenNotify.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = EstEIDTokenNotify.app; sourceTree = BUILT_PRODUCTS_DIR; }; 4EF3231820AC184000809D13 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; @@ -162,7 +170,8 @@ 2F7767721CF5E08E0062B0A8 /* en.lproj */ = { isa = PBXGroup; children = ( - 4E77CCA32B5E85AB00518F62 /* Localizable.xcstrings */, + 2F7767731CF5E0A00062B0A8 /* Localizable.strings */, + 2F7767751CF5E0A00062B0A8 /* Localizable.stringsdict */, ); name = en.lproj; sourceTree = ""; @@ -304,7 +313,8 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4E77CCA42B5E85AB00518F62 /* Localizable.xcstrings in Resources */, + 2F7767771CF5E0A00062B0A8 /* Localizable.strings in Resources */, + 2F7767781CF5E0A00062B0A8 /* Localizable.stringsdict in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -384,6 +394,26 @@ /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ + 2F7767731CF5E0A00062B0A8 /* Localizable.strings */ = { + isa = PBXVariantGroup; + children = ( + 2F7767741CF5E0A00062B0A8 /* en */, + 4EAFE85B212C20BE00DD6D87 /* ru */, + 4EAFE85F212C20F200DD6D87 /* et */, + ); + name = Localizable.strings; + sourceTree = ""; + }; + 2F7767751CF5E0A00062B0A8 /* Localizable.stringsdict */ = { + isa = PBXVariantGroup; + children = ( + 2F7767761CF5E0A00062B0A8 /* en */, + 4EAFE85C212C20BE00DD6D87 /* ru */, + 4EAFE860212C20F200DD6D87 /* et */, + ); + name = Localizable.stringsdict; + sourceTree = ""; + }; 4EF3231720AC184000809D13 /* Main.storyboard */ = { isa = PBXVariantGroup; children = ( @@ -453,8 +483,8 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - LOCALIZATION_PREFERS_STRING_CATALOGS = YES; - MACOSX_DEPLOYMENT_TARGET = 11.0; + LOCALIZATION_PREFERS_STRING_CATALOGS = NO; + MACOSX_DEPLOYMENT_TARGET = 12.0; MARKETING_VERSION = 1.4.0; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; @@ -515,8 +545,8 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - LOCALIZATION_PREFERS_STRING_CATALOGS = YES; - MACOSX_DEPLOYMENT_TARGET = 11.0; + LOCALIZATION_PREFERS_STRING_CATALOGS = NO; + MACOSX_DEPLOYMENT_TARGET = 12.0; MARKETING_VERSION = 1.4.0; OTHER_CODE_SIGN_FLAGS = "--timestamp --options=runtime"; SDKROOT = macosx; diff --git a/EstEIDTokenApp/EstEidTokenApp.swift b/EstEIDTokenApp/EstEidTokenApp.swift index e034bbb..7ef02c5 100644 --- a/EstEIDTokenApp/EstEidTokenApp.swift +++ b/EstEIDTokenApp/EstEidTokenApp.swift @@ -53,7 +53,7 @@ struct ContentView: View { var body: some View { VStack { - Text("In case of questions please contact our support via id.ee") + Text("In case of questions please contact our support via https://www.id.ee") Text("Version: \(version)") TextEditor(text: .constant(text)) } diff --git a/EstEIDTokenApp/Localizable.xcstrings b/EstEIDTokenApp/Localizable.xcstrings index cbb31eb..a4965cc 100644 --- a/EstEIDTokenApp/Localizable.xcstrings +++ b/EstEIDTokenApp/Localizable.xcstrings @@ -1,18 +1,18 @@ { "sourceLanguage" : "en", "strings" : { - "In case of questions please contact our support via id.ee" : { + "In case of questions please contact our support via https://www.id.ee" : { "localizations" : { "et" : { "stringUnit" : { "state" : "translated", - "value" : "Küsimuste korral pöörduge id.ee" + "value" : "Küsimuste korral pöörduge https://www.id.ee" } }, "ru" : { "stringUnit" : { "state" : "translated", - "value" : "Если у вас возникнут вопросы, пожалуйста, обратитесь на id.ee" + "value" : "Если у вас возникнут вопросы, пожалуйста, обратитесь на https://www.id.ee" } } }