我正在编写一个phonegap插件,可以在app keychain中安装CA根证书和用户证书.
以下是用于安装证书的代码:
NSData *PKCS12Data = [[NSData alloc] initWithContentsOfFile:certpath];
CFDataRef inPKCS12Data = (CFDataRef)PKCS12Data;
CFStringRef password = (CFStringRef)certPassword;
const void *keys[] = { kSecImportExportPassphrase };
const void *values[] = { password };
CFDictionaryRef optionsDictionary = CFDictionaryCreate(NULL, keys, values, 1, NULL, NULL);
CFArrayRef items = CFArrayCreate(NULL, 0, 0, NULL);
OSStatus securityError = SecPKCS12Import(inPKCS12Data, optionsDictionary, &items);
if (securityError == 0) {
NSLog(@" *** Certificate install Success ***");
} else {
NSLog(@" *** Certificate install Failure ***");
}
Run Code Online (Sandbox Code Playgroud)
上面的代码工作正常(securityError等于0).但是,我正在获取这些错误:
unknown apsd[59] <Warning>: <APSCourier: 0xee1ba80>: …Run Code Online (Sandbox Code Playgroud) 我正在尝试在给定模式之前插入文件内容
这是我的代码:
sed -i "" "/pattern/ {
i\\
r $scriptPath/adapters/default/permissions.xml"
}" "$manifestFile"
Run Code Online (Sandbox Code Playgroud)
它添加路径而不是文件的内容.
有任何想法吗 ?
我正在尝试访问受NTLM身份验证保护并需要客户端证书的服务器.我正在使用NSURLConnection的委托方法进行身份验证,并使用UIWebview检索结果.
当服务器需要客户端证书时,我设法为NTLM身份验证和身份验证开发代码:
- (void) connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge {
authMethod = challenge.protectionSpace.authenticationMethod;
if ( [challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust] )
{
[challenge.sender useCredential:[NSURLCredential credentialForTrust: challenge.protectionSpace.serverTrust] forAuthenticationChallenge: challenge];
return;
}
if ( [challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodClientCertificate] )
{
[... code to extract certificate ...]
NSURLCredential *credential = [NSURLCredential credentialWithIdentity:myIdentity certificates:(NSArray*)certsArray persistence:NSURLCredentialPersistencePermanent];
[challenge.sender useCredential:credential forAuthenticationChallenge:challenge];
return;
}
if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodNTLM])
{
NSURLCredential *credential;
credential = [NSURLCredential
credentialWithUser:@"user"
password:@"password"
persistence:NSURLCredentialPersistencePermanent];
[challenge.sender useCredential:credential forAuthenticationChallenge:challenge];
return;
}
[[challenge sender] performDefaultHandlingForAuthenticationChallenge:challenge];
}
Run Code Online (Sandbox Code Playgroud)
当服务器单独需要NTLM身份验证或客户端证书时,一切正常.当需要在一起时,服务器端都会收到证书信息和NTLM凭据,但IIS7会返回403页面,要求提供客户端证书...
您可能需要知道的是willSendRequestForAuthenticationChallenge按此顺序调用四次:
willSendRequestForAuthenticationChallenge: NSURLAuthenticationMethodServerTrust
willSendRequestForAuthenticationChallenge: NSURLAuthenticationMethodClientCertificate
willSendRequestForAuthenticationChallenge: NSURLAuthenticationMethodNTLM
willSendRequestForAuthenticationChallenge: …Run Code Online (Sandbox Code Playgroud) 我正在尝试为Android编译我的cordova应用程序,但我收到此错误:
[javac] Compiling 104 source files to /Volumes/Work/workspace/android/poc/CordovaLib/bin/classes
[javac] /Volumes/Work/workspace/android/poc/CordovaLib/src/com/plugin/gcm/CordovaGCMBroadcastReceiver.java:5: package com.google.android.gcm does not exist
[javac] import com.google.android.gcm.GCMBroadcastReceiver;
[javac] ^
[javac] /Volumes/Work/workspace/android/poc/CordovaLib/src/com/plugin/gcm/CordovaGCMBroadcastReceiver.java:6: package com.google.android.gcm does not exist
[javac] import static com.google.android.gcm.GCMConstants.DEFAULT_INTENT_SERVICE_CLASS_NAME;
[javac] ^
[javac] /Volumes/Work/workspace/android/poc/CordovaLib/src/com/plugin/gcm/CordovaGCMBroadcastReceiver.java:6: static import only from classes and interfaces
[javac] import static com.google.android.gcm.GCMConstants.DEFAULT_INTENT_SERVICE_CLASS_NAME;
[javac] ^
[javac] /Volumes/Work/workspace/android/poc/CordovaLib/src/com/plugin/gcm/CordovaGCMBroadcastReceiver.java:12: cannot find symbol
[javac] symbol: class GCMBroadcastReceiver
[javac] public class CordovaGCMBroadcastReceiver extends GCMBroadcastReceiver {
[javac] ^
[javac] /Volumes/Work/workspace/android/poc/CordovaLib/src/com/plugin/gcm/GCMIntentService.java:5: package com.google.android.gcm does not exist
[javac] import com.google.android.gcm.GCMBaseIntentService;
[javac] ^
[javac] /Volumes/Work/workspace/android/poc/CordovaLib/src/com/plugin/gcm/GCMIntentService.java:18: …Run Code Online (Sandbox Code Playgroud) 我是詹金斯的新手.我正在尝试在单个作业中实现特定方案,以使用Jenkins构建移动应用程序.
在单个作业中,我想按顺序启动多个任务:任务1(Windows)--->任务2(Windows)--->任务3(Windows)--->任务4(Mac OSX)
每项工作都将专注于一个项目.可以通过工作空间将任务中的结果传递给另一个任务,但似乎所有工作任务都必须在同一环境中运行.是否有任何插件可以让我在特定的奴隶中运行一些工作任务?
提前致谢