Skip to content

Commit

Permalink
Don't use string catalogs
Browse files Browse the repository at this point in the history
IB-8186

Signed-off-by: Raul Metsma <[email protected]>
  • Loading branch information
metsma committed Sep 11, 2024
1 parent bcc7c11 commit 81f2da8
Show file tree
Hide file tree
Showing 11 changed files with 160 additions and 268 deletions.
241 changes: 0 additions & 241 deletions EstEIDToken/Localizable.xcstrings

This file was deleted.

16 changes: 1 addition & 15 deletions EstEIDToken/TokenSession.m
Original file line number Diff line number Diff line change
Expand Up @@ -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] ||
Expand All @@ -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;
Expand Down Expand Up @@ -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)
Expand Down
12 changes: 12 additions & 0 deletions EstEIDToken/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -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";
27 changes: 27 additions & 0 deletions EstEIDToken/en.lproj/Localizable.stringsdict
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>VERIFY_TRY_LEFT</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>%1$#@tries@</string>
<key>tries</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>d</string>
<key>zero</key>
<string>PIN locked.
Unblock to reuse PIN.</string>
<key>one</key>
<string>PIN Incorrect.
PIN will be locked next failed attempt.</string>
<key>other</key>
<string>PIN Incorrect.
%d tries left</string>
</dict>
</dict>
</dict>
</plist>
12 changes: 12 additions & 0 deletions EstEIDToken/et.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -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";
27 changes: 27 additions & 0 deletions EstEIDToken/et.lproj/Localizable.stringsdict
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>VERIFY_TRY_LEFT</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>%1$#@tries@</string>
<key>tries</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>d</string>
<key>zero</key>
<string>PIN on lukus.
Tühista blokeering, et PIN-i taas kasutada.</string>
<key>one</key>
<string>Vale PIN.
Järgmise vale koodi sisestamisel PIN lukustub.</string>
<key>other</key>
<string>Vale PIN.
%d katset jäänud</string>
</dict>
</dict>
</dict>
</plist>
12 changes: 12 additions & 0 deletions EstEIDToken/ru.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -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";
Loading

0 comments on commit 81f2da8

Please sign in to comment.