小编Man*_*Mac的帖子

使用带有AFNetworking的SSLSetEnabledCiphers来禁用弱密码

我试图禁用一些密码(弱),如单DES,单DES 40位等.

我尝试使用这段代码如何在Cocoa中使用CFSocket/CFStream时设置SSL密码?从邮件列表消息CFNetwork SSL和长阻塞延迟但我需要访问套接字数据来获取CFDataRef.

这是我试图在AFURLConnectionOperation类中的握手方法中插入的代码:

- (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge (NSURLAuthenticationChallenge *)challenge{
    CFReadStreamRef stream = [sock getCFReadStream];
    CFDataRef data = CFReadStreamCopyProperty(stream, kCFStreamPropertySocketSSLContext);

    // Extract the SSLContextRef from the CFData
    SSLContextRef sslContext;
    CFDataGetBytes(data, CFRangeMake(0, sizeof(SSLContextRef)), &sslContext);

    // Get all enabled ciphers
    size_t numCiphers;
    SSLGetNumberEnabledCiphers(sslContext,&numCiphers);
    SSLCipherSuite ciphers[numCiphers];
    SSLGetEnabledCiphers(sslContext,ciphers,&numCiphers);

    // Create a new cipher array with only non-DH ciphers, and set it
    SSLCipherSuite finalCiphers[numCiphers];
    int numFinalCiphers = 0;
    for(int i=0; i<numCiphers; i++) {
        SSLCipherSuite suite = …
Run Code Online (Sandbox Code Playgroud)

iphone ssl cfnetwork ios afnetworking

8
推荐指数
1
解决办法
1406
查看次数

应用程序窗口应在应用程序启动结束时具有根视图控制器

我的应用程序启动时出现上述错误.以下代码来自我的AppDelegate .h文件

#import <UIKit/UIKit.h>

@interface TableViewAppDelegate : NSObject <UIApplicationDelegate> {

UIWindow *window;
UINavigationController *navigationController;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UINavigationController *navigationController;

@end
Run Code Online (Sandbox Code Playgroud)

以下内容来自我的AppDelegate实现文件.m applicationdidfinishlaunchingwithoptions

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

//Configure and show the window
[window addSubview:[navigationController view]];

[window makeKeyAndVisible];

return YES;
}
Run Code Online (Sandbox Code Playgroud)

objective-c ios

2
推荐指数
1
解决办法
2万
查看次数

标签 统计

ios ×2

afnetworking ×1

cfnetwork ×1

iphone ×1

objective-c ×1

ssl ×1