diff --git a/EstEIDToken/Info.plist b/EstEIDToken/Info.plist index e543821..2feef93 100644 --- a/EstEIDToken/Info.plist +++ b/EstEIDToken/Info.plist @@ -17,11 +17,11 @@ CFBundlePackageType XPC! CFBundleShortVersionString - $(VERSION) + $(MARKETING_VERSION) CFBundleSignature ???? CFBundleVersion - $(BUILD_NUMBER) + $(CURRENT_PROJECT_VERSION) LSMinimumSystemVersion $(MACOSX_DEPLOYMENT_TARGET) NSExtension diff --git a/EstEIDToken/TokenSession.m b/EstEIDToken/TokenSession.m index 8ac82e0..e1484fe 100644 --- a/EstEIDToken/TokenSession.m +++ b/EstEIDToken/TokenSession.m @@ -31,6 +31,12 @@ @implementation AuthOperation { TokenSession *session; } +- (BOOL)isAllDigits:(NSString*)data { + NSCharacterSet* nonNumbers = [[NSCharacterSet decimalDigitCharacterSet] invertedSet]; + NSRange r = [data rangeOfCharacterFromSet: nonNumbers]; + return r.location == NSNotFound && data.length > 0; +} + - (nullable instancetype)initWithSmartCard:(TKSmartCard *)smartCard tokenSession:(TokenSession *)esteidsession { if (self = [super init]) { self.smartCard = smartCard; @@ -42,6 +48,16 @@ - (nullable instancetype)initWithSmartCard:(TKSmartCard *)smartCard tokenSession - (BOOL)finishWithError:(NSError **)error { NSLog(@"AuthOperation finishWithError %@", *error); + if (self.PIN.length < self.PINFormat.minPINLength || self.PIN.length > self.PINFormat.maxPINLength || + ![self isAllDigits:self.PIN]) { + NSLog(@"AuthOperation finishWithError invalid PIN lenght: %lu min: %lu max: %lu", self.PIN.length, self.PINFormat.minPINLength, self.PINFormat.maxPINLength); + [EstEIDTokenDriver showNotification:[NSString localizedStringWithFormat:NSLocalizedString(@"INVALID_PIN", nil)]]; + if (error != nil) { + *error = [NSError errorWithDomain:TKErrorDomain code:TKErrorCodeAuthenticationFailed userInfo: + @{NSLocalizedDescriptionKey:[NSString localizedStringWithFormat:NSLocalizedString(@"INVALID_PIN", nil)]}]; + } + return NO; + } UInt16 sw = 0; [self.smartCard sendIns:0x20 p1:0x00 p2:0x01 data:[session pinTemplate:self.PIN] le:nil sw:&sw error:error]; NSLog(@"AuthOperation finishWithError %@", *error); diff --git a/EstEIDToken/en.lproj/Localizable.strings b/EstEIDToken/en.lproj/Localizable.strings index 0cc2ee0..ced769d 100644 --- a/EstEIDToken/en.lproj/Localizable.strings +++ b/EstEIDToken/en.lproj/Localizable.strings @@ -9,3 +9,4 @@ "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/et.lproj/Localizable.strings b/EstEIDToken/et.lproj/Localizable.strings index 0cc2ee0..c28e969 100644 --- a/EstEIDToken/et.lproj/Localizable.strings +++ b/EstEIDToken/et.lproj/Localizable.strings @@ -8,4 +8,5 @@ "AUTH_KEY" = "Key For Card Authentication"; "SIGN_KEY" = "Key For Digital Signature"; "WRONG_CONSTR" = "Unexpected constraint"; -"ENTER_PINPAD" = "Please enter PIN code on PinPAD"; +"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 index 47adb61..910feff 100644 --- a/EstEIDToken/et.lproj/Localizable.stringsdict +++ b/EstEIDToken/et.lproj/Localizable.stringsdict @@ -13,11 +13,11 @@ NSStringFormatValueTypeKey d zero - PIN verification failed, PIN blocked + PIN on lukus one - PIN verification failed, one try left + Vale PIN, järgmise vale koodi sisestamisel PIN lukustub other - PIN verification failed, %d tries left + Vale PIN, %d katset jäänud diff --git a/EstEIDToken/ru.lproj/Localizable.strings b/EstEIDToken/ru.lproj/Localizable.strings index 0cc2ee0..ced769d 100644 --- a/EstEIDToken/ru.lproj/Localizable.strings +++ b/EstEIDToken/ru.lproj/Localizable.strings @@ -9,3 +9,4 @@ "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/EstEIDTokenApp.xcodeproj/project.pbxproj b/EstEIDTokenApp.xcodeproj/project.pbxproj index 0805566..3b24133 100644 --- a/EstEIDTokenApp.xcodeproj/project.pbxproj +++ b/EstEIDTokenApp.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 50; + objectVersion = 51; objects = { /* Begin PBXAggregateTarget section */ @@ -90,7 +90,7 @@ 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 = ""; }; 2F7767741CF5E0A00062B0A8 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; - 2F7767761CF5E0A00062B0A8 /* en */ = {isa = PBXFileReference; explicitFileType = text.plist.xml; name = en; path = en.lproj/Localizable.stringsdict; sourceTree = ""; }; + 2F7767761CF5E0A00062B0A8 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = en; path = en.lproj/Localizable.stringsdict; sourceTree = ""; }; 4EAFE859212C20BE00DD6D87 /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/MainMenu.strings; 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 = ""; }; @@ -261,7 +261,7 @@ 2F3883901CF46C6E00F114A7 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1010; + LastUpgradeCheck = 1120; ORGANIZATIONNAME = ""; TargetAttributes = { 2F3883971CF46C6E00F114A7 = { @@ -286,8 +286,8 @@ }; }; buildConfigurationList = 2F3883931CF46C6E00F114A7 /* Build configuration list for PBXProject "EstEIDTokenApp" */; - compatibilityVersion = "Xcode 9.3"; - developmentRegion = English; + compatibilityVersion = "Xcode 10.0"; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, @@ -483,8 +483,9 @@ CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "Mac Developer"; + CODE_SIGN_IDENTITY = "-"; COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 0; DEBUG_INFORMATION_FORMAT = dwarf; DEVELOPMENT_TEAM = 4F425HHPH8; ENABLE_STRICT_OBJC_MSGSEND = YES; @@ -504,9 +505,10 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.12; + MARKETING_VERSION = 1.3.1; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; - VERSION = 1.3.0; + VERSION = 1.3.1; }; name = Debug; }; @@ -547,6 +549,7 @@ CODE_SIGN_IDENTITY = "Developer ID Application"; CODE_SIGN_INJECT_BASE_ENTITLEMENTS = NO; COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 0; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = 4F425HHPH8; ENABLE_NS_ASSERTIONS = NO; @@ -560,9 +563,10 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.12; + MARKETING_VERSION = 1.3.1; OTHER_CODE_SIGN_FLAGS = "--timestamp --options=runtime"; SDKROOT = macosx; - VERSION = 1.3.0; + VERSION = 1.3.1; }; name = Release; }; diff --git a/EstEIDTokenApp/Info.plist b/EstEIDTokenApp/Info.plist index 4cc64fb..8263a61 100644 --- a/EstEIDTokenApp/Info.plist +++ b/EstEIDTokenApp/Info.plist @@ -17,9 +17,9 @@ CFBundlePackageType APPL CFBundleShortVersionString - $(VERSION) + $(MARKETING_VERSION) CFBundleVersion - $(BUILD_NUMBER) + $(CURRENT_PROJECT_VERSION) LSApplicationCategoryType public.app-category.utilities LSMinimumSystemVersion diff --git a/EstEIDTokenNotify/Info.plist b/EstEIDTokenNotify/Info.plist index 35c9a03..a5f5e0d 100644 --- a/EstEIDTokenNotify/Info.plist +++ b/EstEIDTokenNotify/Info.plist @@ -17,9 +17,9 @@ CFBundlePackageType APPL CFBundleShortVersionString - $(VERSION) + $(MARKETING_VERSION) CFBundleVersion - $(BUILD_NUMBER) + $(CURRENT_PROJECT_VERSION) LSBackgroundOnly LSMinimumSystemVersion