Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 0 additions & 48 deletions platform/mac/AndroidAppBuildController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -895,54 +895,6 @@ -(BOOL)areKeystoreAndAliasPasswordsValid:(const char *)keyStore keyPW:(const cha
platformServices->Platform().PathForFile( NULL, Rtt::MPlatform::kResourceDir, Rtt::MPlatform::kDefaultPathFlags, resourcesDir );

return listKeyStore.AreKeyStoreAndAliasPasswordsValid(keyStore, keyPW, alias, aliasPW, resourcesDir.GetString());

#if 0
Rtt::String resourcesDir;

self.authorizer->GetServices().Platform().PathForFile( NULL, Rtt::MPlatform::kResourceDir, Rtt::MPlatform::kDefaultPathFlags, resourcesDir );

NSString *resourceDir = [NSString stringWithExternalString:resourcesDir.GetString()];
// NSString *buildFilePath = [resourceDir stringByAppendingPathComponent:@"build.xml"];
NSString *tmpDir = NSTemporaryDirectory();
NSString *srcTestJar = [resourceDir stringByAppendingPathComponent:@"_coronatest.jar"];
NSString *dstTestJar = [tmpDir stringByAppendingPathComponent:@"_coronatest.jar"];

// Escape quotes in the strings by replacing single quotes with "'\''" and then enclosing in single quotes when we build the command
NSString *keyStoreStr = [[NSString stringWithExternalString:keyStore] stringByReplacingOccurrencesOfString:@"'" withString:@"'\''"];
NSString *keyPWStr = [[NSString stringWithExternalString:keyPW] stringByReplacingOccurrencesOfString:@"'" withString:@"'\''"];
NSString *aliasStr = [[NSString stringWithExternalString:alias] stringByReplacingOccurrencesOfString:@"'" withString:@"'\''"];
NSString *aliasPWStr = [[NSString stringWithExternalString:aliasPW] stringByReplacingOccurrencesOfString:@"'" withString:@"'\''"];

NSString *script = [[NSString alloc] initWithFormat:
@"cp -f '%@' '%@'; JAVA_TOOL_OPTIONS='-Duser.language=en' jarsigner -tsa http://timestamp.digicert.com -keystore '%@' -storepass '%@' -keypass '%@' '%@' '%@'; exit $?",
srcTestJar, tmpDir, keyStoreStr, keyPWStr, aliasPWStr, dstTestJar, aliasStr];

// NSLog( @"tmp dir(%@)", tmpDir );
// NSLog( @"<script>\n%@\n</script>", script );

// The command we run to test the password emits the string "jar signed", this makes that look sensible
printf("Testing credentials for '%s': ", keyStore);

NSArray *arguments = [[NSArray alloc] initWithObjects:@"-c", script, nil];
[script release];

NSTask* task = [[NSTask alloc] init];
[task setLaunchPath:@"/bin/sh"];
[task setArguments:arguments];
[arguments release];
// NSFileHandle* devNull = [NSFileHandle fileHandleWithNullDevice];
// [task setStandardOutput:devNull];
// [task setStandardError:devNull];
[task launch];
[task waitUntilExit];
int exitCode = [task terminationStatus];
// [task setStandardOutput:[NSFileHandle fileHandleWithStandardOutput]];
// [task setStandardError:[NSFileHandle fileHandleWithStandardOutput]];
[task release];
// Rtt_TRACE_SIM( ( "ERROR: Failed to verify alias password. Error code(%d)\n", exitCode ) );
// NSLog( @"alias password. exit code(%d)\n", exitCode );
return ( 0 == exitCode );
#endif
}

- (NSString*)appExtension
Expand Down
4 changes: 2 additions & 2 deletions platform/shared/ListKeyStore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ ListKeyStore::AreKeyStoreAndAliasPasswordsValid( const char *keyStore, const cha

#if defined(Rtt_MAC_ENV) || defined(Rtt_LINUX_ENV)

const char kCmdFormat[] = "JAVA_TOOL_OPTIONS='-Duser.language=en' /usr/bin/jarsigner -tsa http://timestamp.digicert.com -keystore %s -storepass %s -keypass %s %s %s; exit $?";
const char kCmdFormat[] = "JAVA_TOOL_OPTIONS='-Duser.language=en' /usr/bin/jarsigner -keystore %s -storepass %s -keypass %s %s %s; exit $?";

snprintf(cmdBuf, sizeof(cmdBuf), kCmdFormat, keyStoreStr.c_str(), keyPWStr.c_str(), aliasPWStr.c_str(), dstTestJarStr.c_str(), aliasStr.c_str() );

Expand All @@ -367,7 +367,7 @@ ListKeyStore::AreKeyStoreAndAliasPasswordsValid( const char *keyStore, const cha
keytoolPath = jdkPath + "\\bin\\jarsigner.exe";
_putenv_s("JAVA_TOOL_OPTIONS", "-Duser.language=en");

const char kCmdFormat[] = "\"%s\" -tsa http://timestamp.digicert.com -keystore %s -storepass %s -keypass %s %s %s";
const char kCmdFormat[] = "\"%s\" -keystore %s -storepass %s -keypass %s %s %s";

snprintf(cmdBuf, sizeof(cmdBuf), kCmdFormat, keytoolPath.c_str(), keyStoreStr.c_str(), keyPWStr.c_str(), aliasPWStr.c_str(), dstTestJarStr.c_str(), aliasStr.c_str() );

Expand Down