adium 5588:91e8ae66ed76: Inspecting the server's certificate now...
commits at adium.im
commits at adium.im
Tue Jun 25 18:28:01 UTC 2013
details: http://hg.adium.im/adium/rev/91e8ae66ed76
revision: 5588:91e8ae66ed76
branch: adium-1.6
author: Thijs Alkemade <me at thijsalkema.de>
date: Tue Jun 25 20:27:07 2013 +0200
Inspecting the server's certificate now first shows a window with details about the encryption currently used (issuer, TLS version, cipher, MAC algorithm and key exchange algorithm).
diffs (892 lines):
diff -r 590779dec396 -r 91e8ae66ed76 Frameworks/Adium Framework/Resources/TextAndButtonsWindow.xib
--- a/Frameworks/Adium Framework/Resources/TextAndButtonsWindow.xib Tue Jun 25 13:25:27 2013 +0200
+++ b/Frameworks/Adium Framework/Resources/TextAndButtonsWindow.xib Tue Jun 25 20:27:07 2013 +0200
@@ -2,25 +2,25 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1060</int>
- <string key="IBDocument.SystemVersion">11D50b</string>
- <string key="IBDocument.InterfaceBuilderVersion">2182</string>
- <string key="IBDocument.AppKitVersion">1138.32</string>
- <string key="IBDocument.HIToolboxVersion">568.00</string>
+ <string key="IBDocument.SystemVersion">12D78</string>
+ <string key="IBDocument.InterfaceBuilderVersion">3084</string>
+ <string key="IBDocument.AppKitVersion">1187.37</string>
+ <string key="IBDocument.HIToolboxVersion">626.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="NS.object.0">2182</string>
+ <string key="NS.object.0">3084</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
- <string>NSView</string>
- <string>NSScroller</string>
- <string>NSScrollView</string>
- <string>NSWindowTemplate</string>
- <string>NSTextView</string>
+ <string>NSButton</string>
<string>NSButtonCell</string>
+ <string>NSCustomObject</string>
<string>NSImageCell</string>
<string>NSImageView</string>
- <string>NSButton</string>
- <string>NSCustomObject</string>
+ <string>NSScrollView</string>
+ <string>NSScroller</string>
+ <string>NSTextView</string>
+ <string>NSView</string>
+ <string>NSWindowTemplate</string>
</array>
<array key="IBDocument.PluginDependencies">
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -42,7 +42,7 @@
<object class="NSWindowTemplate" id="666209776">
<int key="NSWindowStyleMask">7</int>
<int key="NSWindowBacking">2</int>
- <string key="NSWindowRect">{{12, 725}, {420, 131}}</string>
+ <string key="NSWindowRect">{{855, 483}, {420, 131}}</string>
<int key="NSWTFlags">1618477056</int>
<string key="NSWindowTitle"/>
<string key="NSWindowClass">NSWindow</string>
@@ -52,7 +52,7 @@
<nil key="NSUserInterfaceItemIdentifier"/>
<string key="NSWindowContentMinSize">{94, 7}</string>
<object class="NSView" key="NSWindowView" id="804687557">
- <nil key="NSNextResponder"/>
+ <reference key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<array class="NSMutableArray" key="NSSubviews">
<object class="NSButton" id="206213576">
@@ -60,9 +60,11 @@
<int key="NSvFlags">289</int>
<string key="NSFrame">{{224, 12}, {90, 32}}</string>
<reference key="NSSuperview" ref="804687557"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="67677223"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="884421962">
- <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags">67108864</int>
<int key="NSCellFlags2">134217728</int>
<string key="NSContents">Cancel</string>
<object class="NSFont" key="NSSupport" id="619923228">
@@ -71,7 +73,7 @@
<int key="NSfFlags">1558</int>
</object>
<reference key="NSControlView" ref="206213576"/>
- <int key="NSButtonFlags">-2038284033</int>
+ <int key="NSButtonFlags">-2038284288</int>
<int key="NSButtonFlags2">1</int>
<reference key="NSAlternateImage" ref="619923228"/>
<string key="NSAlternateContents"/>
@@ -79,20 +81,23 @@
<int key="NSPeriodicDelay">200</int>
<int key="NSPeriodicInterval">25</int>
</object>
+ <bool key="NSAllowsLogicalLayoutDirection">NO</bool>
</object>
<object class="NSButton" id="724795384">
<reference key="NSNextResponder" ref="804687557"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{98, 12}, {90, 32}}</string>
<reference key="NSSuperview" ref="804687557"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="206213576"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="154746717">
- <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags">67108864</int>
<int key="NSCellFlags2">134217728</int>
<string key="NSContents">No</string>
<reference key="NSSupport" ref="619923228"/>
<reference key="NSControlView" ref="724795384"/>
- <int key="NSButtonFlags">-2038284033</int>
+ <int key="NSButtonFlags">-2038284288</int>
<int key="NSButtonFlags2">1</int>
<reference key="NSAlternateImage" ref="619923228"/>
<string key="NSAlternateContents"/>
@@ -102,20 +107,23 @@
<int key="NSPeriodicDelay">200</int>
<int key="NSPeriodicInterval">25</int>
</object>
+ <bool key="NSAllowsLogicalLayoutDirection">NO</bool>
</object>
<object class="NSButton" id="67677223">
<reference key="NSNextResponder" ref="804687557"/>
<int key="NSvFlags">289</int>
<string key="NSFrame">{{312, 12}, {90, 32}}</string>
<reference key="NSSuperview" ref="804687557"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="222422940">
- <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags">67108864</int>
<int key="NSCellFlags2">134217728</int>
<string key="NSContents">Yes</string>
<reference key="NSSupport" ref="619923228"/>
<reference key="NSControlView" ref="67677223"/>
- <int key="NSButtonFlags">-2035924737</int>
+ <int key="NSButtonFlags">-2035924992</int>
<int key="NSButtonFlags2">1</int>
<reference key="NSAlternateImage" ref="619923228"/>
<string key="NSAlternateContents"/>
@@ -125,6 +133,7 @@
<int key="NSPeriodicDelay">200</int>
<int key="NSPeriodicInterval">25</int>
</object>
+ <bool key="NSAllowsLogicalLayoutDirection">NO</bool>
</object>
<object class="NSImageView" id="664450443">
<reference key="NSNextResponder" ref="804687557"/>
@@ -144,9 +153,11 @@
</set>
<string key="NSFrame">{{24, 51}, {64, 64}}</string>
<reference key="NSSuperview" ref="804687557"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="473831366"/>
<bool key="NSEnabled">YES</bool>
<object class="NSImageCell" key="NSCell" id="46445738">
- <int key="NSCellFlags">130560</int>
+ <int key="NSCellFlags">134217728</int>
<int key="NSCellFlags2">33554432</int>
<object class="NSCustomResource" key="NSContents">
<string key="NSClassName">NSImage</string>
@@ -157,6 +168,7 @@
<int key="NSStyle">0</int>
<bool key="NSAnimates">NO</bool>
</object>
+ <bool key="NSAllowsLogicalLayoutDirection">NO</bool>
<bool key="NSEditable">NO</bool>
</object>
<object class="NSScrollView" id="469263123">
@@ -185,6 +197,8 @@
</set>
<string key="NSFrameSize">{296, 15}</string>
<reference key="NSSuperview" ref="635900321"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="837234664"/>
<object class="NSTextContainer" key="NSTextContainer" id="1062677528">
<object class="NSLayoutManager" key="NSLayoutManager">
<object class="NSTextStorage" key="NSTextStorage">
@@ -210,7 +224,7 @@
<array class="NSMutableArray" key="NSTextContainers">
<reference ref="1062677528"/>
</array>
- <int key="NSLMFlags">6</int>
+ <int key="NSLMFlags">38</int>
<nil key="NSDelegate"/>
</object>
<reference key="NSTextView" ref="756387554"/>
@@ -218,7 +232,7 @@
<int key="NSTCFlags">1</int>
</object>
<object class="NSTextViewSharedData" key="NSSharedData">
- <int key="NSFlags">100666337</int>
+ <int key="NSFlags">67111905</int>
<int key="NSTextCheckingTypes">0</int>
<nil key="NSMarkedAttributes"/>
<object class="NSColor" key="NSBackgroundColor" id="724447651">
@@ -268,6 +282,7 @@
</array>
<string key="NSFrameSize">{296, 15}</string>
<reference key="NSSuperview" ref="469263123"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="756387554"/>
<reference key="NSDocView" ref="756387554"/>
<reference key="NSBGColor" ref="724447651"/>
@@ -302,6 +317,9 @@
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{-100, -100}, {15, 40}}</string>
<reference key="NSSuperview" ref="469263123"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="972516650"/>
+ <bool key="NSAllowsLogicalLayoutDirection">NO</bool>
<reference key="NSTarget" ref="469263123"/>
<string key="NSAction">_doScroller:</string>
<double key="NSCurValue">1</double>
@@ -311,6 +329,9 @@
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{-100, -100}, {87, 18}}</string>
<reference key="NSSuperview" ref="469263123"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="635900321"/>
+ <bool key="NSAllowsLogicalLayoutDirection">NO</bool>
<int key="NSsFlags">1</int>
<reference key="NSTarget" ref="469263123"/>
<string key="NSAction">_doScroller:</string>
@@ -320,11 +341,15 @@
</array>
<string key="NSFrame">{{104, 76}, {296, 15}}</string>
<reference key="NSSuperview" ref="804687557"/>
- <reference key="NSNextKeyView" ref="635900321"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="1014865810"/>
<int key="NSsFlags">133120</int>
<reference key="NSVScroller" ref="1014865810"/>
<reference key="NSHScroller" ref="972516650"/>
<reference key="NSContentView" ref="635900321"/>
+ <double key="NSMinMagnification">0.25</double>
+ <double key="NSMaxMagnification">4</double>
+ <double key="NSMagnification">1</double>
</object>
<object class="NSScrollView" id="473831366">
<reference key="NSNextResponder" ref="804687557"/>
@@ -352,6 +377,8 @@
</set>
<string key="NSFrameSize">{296, 16}</string>
<reference key="NSSuperview" ref="546717"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="469263123"/>
<object class="NSTextContainer" key="NSTextContainer" id="954916342">
<object class="NSLayoutManager" key="NSLayoutManager">
<object class="NSTextStorage" key="NSTextStorage">
@@ -375,7 +402,7 @@
<array class="NSMutableArray" key="NSTextContainers">
<reference ref="954916342"/>
</array>
- <int key="NSLMFlags">6</int>
+ <int key="NSLMFlags">38</int>
<nil key="NSDelegate"/>
</object>
<reference key="NSTextView" ref="917237317"/>
@@ -383,7 +410,7 @@
<int key="NSTCFlags">1</int>
</object>
<object class="NSTextViewSharedData" key="NSSharedData">
- <int key="NSFlags">100666336</int>
+ <int key="NSFlags">67111904</int>
<int key="NSTextCheckingTypes">0</int>
<nil key="NSMarkedAttributes"/>
<reference key="NSBackgroundColor" ref="724447651"/>
@@ -408,6 +435,7 @@
</array>
<string key="NSFrameSize">{296, 16}</string>
<reference key="NSSuperview" ref="473831366"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="917237317"/>
<reference key="NSDocView" ref="917237317"/>
<reference key="NSBGColor" ref="724447651"/>
@@ -422,6 +450,9 @@
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{-100, -100}, {15, 40}}</string>
<reference key="NSSuperview" ref="473831366"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="469258289"/>
+ <bool key="NSAllowsLogicalLayoutDirection">NO</bool>
<reference key="NSTarget" ref="473831366"/>
<string key="NSAction">_doScroller:</string>
<double key="NSCurValue">1</double>
@@ -431,6 +462,9 @@
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{-100, -100}, {87, 18}}</string>
<reference key="NSSuperview" ref="473831366"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="546717"/>
+ <bool key="NSAllowsLogicalLayoutDirection">NO</bool>
<int key="NSsFlags">1</int>
<reference key="NSTarget" ref="473831366"/>
<string key="NSAction">_doScroller:</string>
@@ -440,20 +474,26 @@
</array>
<string key="NSFrame">{{104, 99}, {296, 16}}</string>
<reference key="NSSuperview" ref="804687557"/>
- <reference key="NSNextKeyView" ref="546717"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="337293416"/>
<int key="NSsFlags">133120</int>
<reference key="NSVScroller" ref="337293416"/>
<reference key="NSHScroller" ref="469258289"/>
<reference key="NSContentView" ref="546717"/>
+ <double key="NSMinMagnification">0.25</double>
+ <double key="NSMaxMagnification">4</double>
+ <double key="NSMagnification">1</double>
</object>
<object class="NSButton" id="837234664">
<reference key="NSNextResponder" ref="804687557"/>
<int key="NSvFlags">266</int>
<string key="NSFrame">{{107, 52}, {295, 18}}</string>
<reference key="NSSuperview" ref="804687557"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="724795384"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="279941262">
- <int key="NSCellFlags">-2080244224</int>
+ <int key="NSCellFlags">-2080374784</int>
<int key="NSCellFlags2">0</int>
<string key="NSContents">awefweff</string>
<object class="NSFont" key="NSSupport">
@@ -462,7 +502,7 @@
<int key="NSfFlags">1044</int>
</object>
<reference key="NSControlView" ref="837234664"/>
- <int key="NSButtonFlags">1211912703</int>
+ <int key="NSButtonFlags">1211912448</int>
<int key="NSButtonFlags2">2</int>
<object class="NSCustomResource" key="NSNormalImage">
<string key="NSClassName">NSImage</string>
@@ -476,11 +516,15 @@
<int key="NSPeriodicDelay">200</int>
<int key="NSPeriodicInterval">25</int>
</object>
+ <bool key="NSAllowsLogicalLayoutDirection">NO</bool>
</object>
</array>
<string key="NSFrameSize">{420, 131}</string>
+ <reference key="NSSuperview"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="664450443"/>
</object>
- <string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
+ <string key="NSScreenRect">{{0, 0}, {1920, 1058}}</string>
<string key="NSMinSize">{94, 29}</string>
<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
<bool key="NSWindowIsRestorable">YES</bool>
@@ -914,6 +958,8 @@
<string key="66.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="67.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="71.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <boolean value="YES" key="72.IBNSWindowAutoPositionCentersHorizontal"/>
+ <boolean value="YES" key="72.IBNSWindowAutoPositionCentersVertical"/>
<string key="72.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="72.IBWindowTemplateEditedContentRect">{{198, 749}, {420, 131}}</string>
<string key="73.CustomClassName">AILocalizationButton</string>
@@ -1048,6 +1094,24 @@
<string key="minorKey">./Classes/ESTextAndButtonsWindowController.h</string>
</object>
</object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="NSMutableDictionary" key="actions">
+ <string key="NS.key.0">selectServiceType:</string>
+ <string key="NS.object.0">id</string>
+ </object>
+ <object class="NSMutableDictionary" key="actionInfosByName">
+ <string key="NS.key.0">selectServiceType:</string>
+ <object class="IBActionInfo" key="NS.object.0">
+ <string key="name">selectServiceType:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ </object>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">./Classes/NSObject.h</string>
+ </object>
+ </object>
</array>
</object>
<int key="IBDocument.localizationMode">0</int>
diff -r 590779dec396 -r 91e8ae66ed76 Plugins/Purple Service/CBPurpleAccount.m
--- a/Plugins/Purple Service/CBPurpleAccount.m Tue Jun 25 13:25:27 2013 +0200
+++ b/Plugins/Purple Service/CBPurpleAccount.m Tue Jun 25 20:27:07 2013 +0200
@@ -46,6 +46,7 @@
#import <Adium/AIContentControllerProtocol.h>
#import <Adium/AIInterfaceControllerProtocol.h>
#import <Adium/AIStatusControllerProtocol.h>
+#import <Adium/ESTextAndButtonsWindowController.h>
#import <AIUtilities/AIAttributedStringAdditions.h>
#import <AIUtilities/AIDictionaryAdditions.h>
#import <AIUtilities/AIMenuAdditions.h>
@@ -2908,7 +2909,7 @@
[menuItemArray addObject:[NSMenuItem separatorItem]];
}
- NSMenuItem *showCertificateMenuItem = [[[NSMenuItem alloc] initWithTitle:AILocalizedString(@"Show Server Certificate",nil)
+ NSMenuItem *showCertificateMenuItem = [[[NSMenuItem alloc] initWithTitle:AILocalizedString(@"Show Encryption Details",nil)
target:self
action:@selector(showServerCertificate)
keyEquivalent:@""] autorelease];
@@ -2928,10 +2929,70 @@
{
CFArrayRef certificates = [[self purpleAdapter] copyServerCertificates:[self secureConnection]];
- [AIPurpleCertificateViewer displayCertificateChain:certificates forAccount:self];
+ SecCertificateRef root = NULL;
+ if (CFArrayGetCount(certificates) > 0) {
+ root = (SecCertificateRef)CFArrayGetValueAtIndex(certificates, CFArrayGetCount(certificates) - 1);
+ }
+
+ NSMutableAttributedString *details = [[NSMutableAttributedString alloc] init];
+
+ if (root) {
+ CFStringRef issuer;
+
+ SecCertificateCopyCommonName(root, &issuer);
+
+ if (CFArrayGetCount(certificates) == 1) {
+ [details appendString:[NSString stringWithFormat:AILocalizedString(@"The server uses a self-signed cetificate for %@.\n\n", nil),
+ (NSString *)issuer] withAttributes:@{}];
+ } else {
+ [details appendString:[NSString stringWithFormat:AILocalizedString(@"The server uses a cetificate issued by %@.\n\n", nil),
+ (NSString *)issuer] withAttributes:@{}];
+ }
+
+ CFRelease(issuer);
+ }
+
+ NSDictionary *cipherDetails = [[self purpleAdapter] getCipherDetails:[self secureConnection]];
+
+ if (cipherDetails) {
+ [details appendString:[NSString stringWithFormat:AILocalizedString(@"The connection is using %@ with %@ encryption, using %@ for message authentication and %@ key exchange.", nil),
+ [cipherDetails objectForKey:@"SSL Version"],
+ [cipherDetails objectForKey:@"Cipher Name"],
+ [cipherDetails objectForKey:@"MAC"],
+ [cipherDetails objectForKey:@"Key Exchange"]] withAttributes:@{}];
+ }
+
+ ESTextAndButtonsWindowController *detailsController = [[ESTextAndButtonsWindowController alloc] initWithTitle:AILocalizedString(@"Encryption Details", nil)
+ defaultButton:AILocalizedString(@"OK", nil)
+ alternateButton:AILocalizedString(@"Show Certificate", nil)
+ otherButton:nil
+ suppression:nil
+ withMessageHeader:[NSString stringWithFormat:AILocalizedString(@"Connection details for %@", nil), self.formattedUID]
+ andMessage:details
+ image:nil
+ target:self
+ userInfo:nil];
+ [detailsController showOnWindow:nil];
+
+ [details release];
CFRelease(certificates);
}
+
+- (BOOL)textAndButtonsWindowDidEnd:(NSWindow *)window returnCode:(AITextAndButtonsReturnCode)returnCode suppression:(BOOL)suppression userInfo:(id)userInfo
+{
+ if (returnCode == AITextAndButtonsAlternateReturn) {
+ CFArrayRef certificates = [[self purpleAdapter] copyServerCertificates:[self secureConnection]];
+
+ [AIPurpleCertificateViewer displayCertificateChain:certificates
+ forAccount:self];
+
+ CFRelease(certificates);
+ }
+
+ return TRUE;
+}
+
#endif
//Action of a dynamically-generated contact menu item
diff -r 590779dec396 -r 91e8ae66ed76 Plugins/Purple Service/SLPurpleCocoaAdapter.h
--- a/Plugins/Purple Service/SLPurpleCocoaAdapter.h Tue Jun 25 13:25:27 2013 +0200
+++ b/Plugins/Purple Service/SLPurpleCocoaAdapter.h Tue Jun 25 20:27:07 2013 +0200
@@ -99,6 +99,7 @@
#ifdef HAVE_CDSA
- (CFArrayRef)copyServerCertificates:(PurpleSslConnection*)gsc;
+- (NSDictionary *)getCipherDetails:(PurpleSslConnection*)gsc;
#endif
@end
diff -r 590779dec396 -r 91e8ae66ed76 Plugins/Purple Service/SLPurpleCocoaAdapter.m
--- a/Plugins/Purple Service/SLPurpleCocoaAdapter.m Tue Jun 25 13:25:27 2013 +0200
+++ b/Plugins/Purple Service/SLPurpleCocoaAdapter.m Tue Jun 25 20:27:07 2013 +0200
@@ -1652,6 +1652,24 @@
return result;
}
+- (NSDictionary *)getCipherDetails:(PurpleSslConnection*)gsc {
+ PurplePlugin *cdsa_plugin = purple_plugins_find_with_name("CDSA");
+ if(!cdsa_plugin)
+ return nil;
+ const char *ssl_info;
+ const char *name;
+ const char *mac;
+ const char *key_exchange;
+ gboolean ok = NO;
+ purple_plugin_ipc_call(cdsa_plugin, "get_cipher_details", &ok, gsc, &ssl_info, &name, &mac, &key_exchange);
+
+ if (!ok) return nil;
+
+ return @{ @"SSL Version": [NSString stringWithUTF8String:ssl_info],
+ @"Cipher Name": [NSString stringWithUTF8String:name],
+ @"MAC": [NSString stringWithUTF8String:mac],
+ @"Key Exchange": [NSString stringWithUTF8String:key_exchange] };
+}
#endif
@end
diff -r 590779dec396 -r 91e8ae66ed76 Plugins/Purple Service/libpurple_extensions/ssl-cdsa.c
--- a/Plugins/Purple Service/libpurple_extensions/ssl-cdsa.c Tue Jun 25 13:25:27 2013 +0200
+++ b/Plugins/Purple Service/libpurple_extensions/ssl-cdsa.c Tue Jun 25 20:27:07 2013 +0200
@@ -48,6 +48,11 @@
static GList *connections = NULL;
+static const char* SSLVersionToString(SSLProtocol protocol);
+static const char* SSLKeyExchangeName(SSLCipherSuite suite);
+static const char* SSLCipherName(SSLCipherSuite suite);
+static const char* SSLMACName(SSLCipherSuite suite);
+
#define PURPLE_SSL_CDSA_DATA(gsc) ((PurpleSslCDSAData *)gsc->private_data)
#define PURPLE_SSL_CONNECTION_IS_VALID(gsc) (g_list_find(connections, (gsc)) != NULL)
@@ -548,12 +553,29 @@
static gboolean copy_certificate_chain(PurpleSslConnection *gsc /* IN */, CFArrayRef *result /* OUT */) {
PurpleSslCDSAData *cdsa_data = PURPLE_SSL_CDSA_DATA(gsc);
-#if MAC_OS_X_VERSION_10_5 > MAC_OS_X_VERSION_MAX_ALLOWED
- // this function was declared deprecated in 10.5
- return SSLGetPeerCertificates(cdsa_data->ssl_ctx, result) == noErr;
-#else
return SSLCopyPeerCertificates(cdsa_data->ssl_ctx, result) == noErr;
-#endif
+}
+
+static gboolean get_cipher_details(PurpleSslConnection *gsc /* IN */, const char **ssl_info /* OUT */, const char **name /* OUT */, const char **mac /* OUT */, const char **key_exchange /* OUT */) {
+ PurpleSslCDSAData *cdsa_data = PURPLE_SSL_CDSA_DATA(gsc);
+ OSStatus err;
+ SSLCipherSuite cipher;
+ SSLProtocol protocol;
+
+ err = SSLGetNegotiatedCipher(cdsa_data->ssl_ctx, &cipher);
+
+ if (err != noErr) return FALSE;
+
+ err = SSLGetNegotiatedProtocolVersion(cdsa_data->ssl_ctx, &protocol);
+
+ if (err != noErr) return FALSE;
+
+ *ssl_info = SSLVersionToString(protocol);
+ *name = SSLCipherName(cipher);
+ *mac = SSLMACName(cipher);
+ *key_exchange = SSLKeyExchangeName(cipher);
+
+ return TRUE;
}
static PurpleSslOps ssl_ops = {
@@ -592,6 +614,14 @@
purple_value_new(PURPLE_TYPE_BOOLEAN),
2, purple_value_new(PURPLE_TYPE_POINTER), purple_value_new(PURPLE_TYPE_POINTER));
+ purple_plugin_ipc_register(plugin,
+ "get_cipher_details",
+ PURPLE_CALLBACK(get_cipher_details),
+ purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER,
+ purple_value_new(PURPLE_TYPE_BOOLEAN),
+ 5, purple_value_new(PURPLE_TYPE_POINTER), purple_value_new(PURPLE_TYPE_POINTER),
+ purple_value_new(PURPLE_TYPE_POINTER), purple_value_new(PURPLE_TYPE_POINTER), purple_value_new(PURPLE_TYPE_POINTER));
+
return (TRUE);
#else
return (FALSE);
@@ -648,3 +678,317 @@
}
PURPLE_INIT_PLUGIN(ssl_cdsa, init_plugin, info)
+
+#pragma mark -
+
+// The following code is (loosely) based on code taken from Chromium.
+// https://code.google.com/p/chromium/codesearch#chromium/src/net/ssl/ssl_cipher_suite_names.cc&sq=package:chromium
+
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+static const char* SSLVersionToString(SSLProtocol protocol) {
+ switch (protocol) {
+ case kSSLProtocol2:
+ return "SSL 2.0";
+ case kSSLProtocol3:
+ return "SSL 3.0";
+ case kTLSProtocol1:
+ return "TLS 1.0";
+ case kTLSProtocol11:
+ return "TLS 1.1";
+ case kTLSProtocol12:
+ return "TLS 1.2";
+ case kDTLSProtocol1:
+ return "DTLS 1.0";
+ default:
+ return "???";
+ }
+}
+
+typedef struct {
+ uint16 cipher_suite, encoded;
+} CipherSuite;
+
+static const CipherSuite kCipherSuites[] = {
+ {0x0, 0x0}, // TLS_NULL_WITH_NULL_NULL
+ {0x1, 0x101}, // TLS_RSA_WITH_NULL_MD5
+ {0x2, 0x102}, // TLS_RSA_WITH_NULL_SHA
+ {0x3, 0x209}, // TLS_RSA_EXPORT_WITH_RC4_40_MD5
+ {0x4, 0x111}, // TLS_RSA_WITH_RC4_128_MD5
+ {0x5, 0x112}, // TLS_RSA_WITH_RC4_128_SHA
+ {0x6, 0x219}, // TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5
+ {0x7, 0x122}, // TLS_RSA_WITH_IDEA_CBC_SHA
+ {0x8, 0x22a}, // TLS_RSA_EXPORT_WITH_DES40_CBC_SHA
+ {0x9, 0x132}, // TLS_RSA_WITH_DES_CBC_SHA
+ {0xa, 0x13a}, // TLS_RSA_WITH_3DES_EDE_CBC_SHA
+ {0xb, 0x32a}, // TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA
+ {0xc, 0x432}, // TLS_DH_DSS_WITH_DES_CBC_SHA
+ {0xd, 0x43a}, // TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA
+ {0xe, 0x52a}, // TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA
+ {0xf, 0x632}, // TLS_DH_RSA_WITH_DES_CBC_SHA
+ {0x10, 0x63a}, // TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA
+ {0x11, 0x72a}, // TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA
+ {0x12, 0x832}, // TLS_DHE_DSS_WITH_DES_CBC_SHA
+ {0x13, 0x83a}, // TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA
+ {0x14, 0x92a}, // TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA
+ {0x15, 0xa32}, // TLS_DHE_RSA_WITH_DES_CBC_SHA
+ {0x16, 0xa3a}, // TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA
+ {0x17, 0xb09}, // TLS_DH_anon_EXPORT_WITH_RC4_40_MD5
+ {0x18, 0xc11}, // TLS_DH_anon_WITH_RC4_128_MD5
+ {0x19, 0xb2a}, // TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA
+ {0x1a, 0xc32}, // TLS_DH_anon_WITH_DES_CBC_SHA
+ {0x1b, 0xc3a}, // TLS_DH_anon_WITH_3DES_EDE_CBC_SHA
+ {0x2f, 0x142}, // TLS_RSA_WITH_AES_128_CBC_SHA
+ {0x30, 0x442}, // TLS_DH_DSS_WITH_AES_128_CBC_SHA
+ {0x31, 0x642}, // TLS_DH_RSA_WITH_AES_128_CBC_SHA
+ {0x32, 0x842}, // TLS_DHE_DSS_WITH_AES_128_CBC_SHA
+ {0x33, 0xa42}, // TLS_DHE_RSA_WITH_AES_128_CBC_SHA
+ {0x34, 0xc42}, // TLS_DH_anon_WITH_AES_128_CBC_SHA
+ {0x35, 0x14a}, // TLS_RSA_WITH_AES_256_CBC_SHA
+ {0x36, 0x44a}, // TLS_DH_DSS_WITH_AES_256_CBC_SHA
+ {0x37, 0x64a}, // TLS_DH_RSA_WITH_AES_256_CBC_SHA
+ {0x38, 0x84a}, // TLS_DHE_DSS_WITH_AES_256_CBC_SHA
+ {0x39, 0xa4a}, // TLS_DHE_RSA_WITH_AES_256_CBC_SHA
+ {0x3a, 0xc4a}, // TLS_DH_anon_WITH_AES_256_CBC_SHA
+ {0x3b, 0x103}, // TLS_RSA_WITH_NULL_SHA256
+ {0x3c, 0x143}, // TLS_RSA_WITH_AES_128_CBC_SHA256
+ {0x3d, 0x14b}, // TLS_RSA_WITH_AES_256_CBC_SHA256
+ {0x3e, 0x443}, // TLS_DH_DSS_WITH_AES_128_CBC_SHA256
+ {0x3f, 0x643}, // TLS_DH_RSA_WITH_AES_128_CBC_SHA256
+ {0x40, 0x843}, // TLS_DHE_DSS_WITH_AES_128_CBC_SHA256
+ {0x41, 0x152}, // TLS_RSA_WITH_CAMELLIA_128_CBC_SHA
+ {0x42, 0x452}, // TLS_DH_DSS_WITH_CAMELLIA_128_CBC_SHA
+ {0x43, 0x652}, // TLS_DH_RSA_WITH_CAMELLIA_128_CBC_SHA
+ {0x44, 0x852}, // TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA
+ {0x45, 0xa52}, // TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA
+ {0x46, 0xc52}, // TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA
+ {0x67, 0xa43}, // TLS_DHE_RSA_WITH_AES_128_CBC_SHA256
+ {0x68, 0x44b}, // TLS_DH_DSS_WITH_AES_256_CBC_SHA256
+ {0x69, 0x64b}, // TLS_DH_RSA_WITH_AES_256_CBC_SHA256
+ {0x6a, 0x84b}, // TLS_DHE_DSS_WITH_AES_256_CBC_SHA256
+ {0x6b, 0xa4b}, // TLS_DHE_RSA_WITH_AES_256_CBC_SHA256
+ {0x6c, 0xc43}, // TLS_DH_anon_WITH_AES_128_CBC_SHA256
+ {0x6d, 0xc4b}, // TLS_DH_anon_WITH_AES_256_CBC_SHA256
+ {0x84, 0x15a}, // TLS_RSA_WITH_CAMELLIA_256_CBC_SHA
+ {0x85, 0x45a}, // TLS_DH_DSS_WITH_CAMELLIA_256_CBC_SHA
+ {0x86, 0x65a}, // TLS_DH_RSA_WITH_CAMELLIA_256_CBC_SHA
+ {0x87, 0x85a}, // TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA
+ {0x88, 0xa5a}, // TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA
+ {0x89, 0xc5a}, // TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA
+ {0x96, 0x162}, // TLS_RSA_WITH_SEED_CBC_SHA
+ {0x97, 0x462}, // TLS_DH_DSS_WITH_SEED_CBC_SHA
+ {0x98, 0x662}, // TLS_DH_RSA_WITH_SEED_CBC_SHA
+ {0x99, 0x862}, // TLS_DHE_DSS_WITH_SEED_CBC_SHA
+ {0x9a, 0xa62}, // TLS_DHE_RSA_WITH_SEED_CBC_SHA
+ {0x9b, 0xc62}, // TLS_DH_anon_WITH_SEED_CBC_SHA
+ {0x9c, 0x16f}, // TLS_RSA_WITH_AES_128_GCM_SHA256
+ {0x9d, 0x177}, // TLS_RSA_WITH_AES_256_GCM_SHA384
+ {0x9e, 0xa6f}, // TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
+ {0x9f, 0xa77}, // TLS_DHE_RSA_WITH_AES_256_GCM_SHA384
+ {0xa0, 0x66f}, // TLS_DH_RSA_WITH_AES_128_GCM_SHA256
+ {0xa1, 0x677}, // TLS_DH_RSA_WITH_AES_256_GCM_SHA384
+ {0xa2, 0x86f}, // TLS_DHE_DSS_WITH_AES_128_GCM_SHA256
+ {0xa3, 0x877}, // TLS_DHE_DSS_WITH_AES_256_GCM_SHA384
+ {0xa4, 0x46f}, // TLS_DH_DSS_WITH_AES_128_GCM_SHA256
+ {0xa5, 0x477}, // TLS_DH_DSS_WITH_AES_256_GCM_SHA384
+ {0xa6, 0xc6f}, // TLS_DH_anon_WITH_AES_128_GCM_SHA256
+ {0xa7, 0xc77}, // TLS_DH_anon_WITH_AES_256_GCM_SHA384
+ {0xba, 0x153}, // TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256
+ {0xbb, 0x453}, // TLS_DH_DSS_WITH_CAMELLIA_128_CBC_SHA256
+ {0xbc, 0x653}, // TLS_DH_RSA_WITH_CAMELLIA_128_CBC_SHA256
+ {0xbd, 0x853}, // TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256
+ {0xbe, 0xa53}, // TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256
+ {0xbf, 0xc53}, // TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA256
+ {0xc0, 0x15b}, // TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256
+ {0xc1, 0x45b}, // TLS_DH_DSS_WITH_CAMELLIA_256_CBC_SHA256
+ {0xc2, 0x65b}, // TLS_DH_RSA_WITH_CAMELLIA_256_CBC_SHA256
+ {0xc3, 0x85b}, // TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256
+ {0xc4, 0xa5b}, // TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256
+ {0xc5, 0xc5b}, // TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA256
+ {0xc001, 0xd02}, // TLS_ECDH_ECDSA_WITH_NULL_SHA
+ {0xc002, 0xd12}, // TLS_ECDH_ECDSA_WITH_RC4_128_SHA
+ {0xc003, 0xd3a}, // TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA
+ {0xc004, 0xd42}, // TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA
+ {0xc005, 0xd4a}, // TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA
+ {0xc006, 0xe02}, // TLS_ECDHE_ECDSA_WITH_NULL_SHA
+ {0xc007, 0xe12}, // TLS_ECDHE_ECDSA_WITH_RC4_128_SHA
+ {0xc008, 0xe3a}, // TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA
+ {0xc009, 0xe42}, // TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA
+ {0xc00a, 0xe4a}, // TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA
+ {0xc00b, 0xf02}, // TLS_ECDH_RSA_WITH_NULL_SHA
+ {0xc00c, 0xf12}, // TLS_ECDH_RSA_WITH_RC4_128_SHA
+ {0xc00d, 0xf3a}, // TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA
+ {0xc00e, 0xf42}, // TLS_ECDH_RSA_WITH_AES_128_CBC_SHA
+ {0xc00f, 0xf4a}, // TLS_ECDH_RSA_WITH_AES_256_CBC_SHA
+ {0xc010, 0x1002}, // TLS_ECDHE_RSA_WITH_NULL_SHA
+ {0xc011, 0x1012}, // TLS_ECDHE_RSA_WITH_RC4_128_SHA
+ {0xc012, 0x103a}, // TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA
+ {0xc013, 0x1042}, // TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
+ {0xc014, 0x104a}, // TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA
+ {0xc015, 0x1102}, // TLS_ECDH_anon_WITH_NULL_SHA
+ {0xc016, 0x1112}, // TLS_ECDH_anon_WITH_RC4_128_SHA
+ {0xc017, 0x113a}, // TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA
+ {0xc018, 0x1142}, // TLS_ECDH_anon_WITH_AES_128_CBC_SHA
+ {0xc019, 0x114a}, // TLS_ECDH_anon_WITH_AES_256_CBC_SHA
+ {0xc023, 0xe43}, // TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256
+ {0xc024, 0xe4c}, // TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384
+ {0xc025, 0xd43}, // TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256
+ {0xc026, 0xd4c}, // TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384
+ {0xc027, 0x1043}, // TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
+ {0xc028, 0x104c}, // TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384
+ {0xc029, 0xf43}, // TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256
+ {0xc02a, 0xf4c}, // TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384
+ {0xc02b, 0xe6f}, // TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
+ {0xc02c, 0xe77}, // TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
+ {0xc02d, 0xd6f}, // TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256
+ {0xc02e, 0xd77}, // TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384
+ {0xc02f, 0x106f}, // TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
+ {0xc030, 0x1077}, // TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
+ {0xc031, 0xf6f}, // TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256
+ {0xc032, 0xf77}, // TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384
+ {0xc072, 0xe53}, // TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256
+ {0xc073, 0xe5c}, // TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384
+ {0xc074, 0xd53}, // TLS_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256
+ {0xc075, 0xd5c}, // TLS_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384
+ {0xc076, 0x1053}, // TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256
+ {0xc077, 0x105c}, // TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384
+ {0xc078, 0xf53}, // TLS_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256
+ {0xc079, 0xf5c}, // TLS_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384
+ {0xc07a, 0x17f}, // TLS_RSA_WITH_CAMELLIA_128_GCM_SHA256
+ {0xc07b, 0x187}, // TLS_RSA_WITH_CAMELLIA_256_GCM_SHA384
+ {0xc07c, 0xa7f}, // TLS_DHE_RSA_WITH_CAMELLIA_128_GCM_SHA256
+ {0xc07d, 0xa87}, // TLS_DHE_RSA_WITH_CAMELLIA_256_GCM_SHA384
+ {0xc07e, 0x67f}, // TLS_DH_RSA_WITH_CAMELLIA_128_GCM_SHA256
+ {0xc07f, 0x687}, // TLS_DH_RSA_WITH_CAMELLIA_256_GCM_SHA384
+ {0xc080, 0x87f}, // TLS_DHE_DSS_WITH_CAMELLIA_128_GCM_SHA256
+ {0xc081, 0x887}, // TLS_DHE_DSS_WITH_CAMELLIA_256_GCM_SHA384
+ {0xc082, 0x47f}, // TLS_DH_DSS_WITH_CAMELLIA_128_GCM_SHA256
+ {0xc083, 0x487}, // TLS_DH_DSS_WITH_CAMELLIA_256_GCM_SHA384
+ {0xc084, 0xc7f}, // TLS_DH_anon_WITH_CAMELLIA_128_GCM_SHA256
+ {0xc085, 0xc87}, // TLS_DH_anon_WITH_CAMELLIA_256_GCM_SHA384
+ {0xc086, 0xe7f}, // TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_GCM_SHA256
+ {0xc087, 0xe87}, // TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_GCM_SHA384
+ {0xc088, 0xd7f}, // TLS_ECDH_ECDSA_WITH_CAMELLIA_128_GCM_SHA256
+ {0xc089, 0xd87}, // TLS_ECDH_ECDSA_WITH_CAMELLIA_256_GCM_SHA384
+ {0xc08a, 0x107f}, // TLS_ECDHE_RSA_WITH_CAMELLIA_128_GCM_SHA256
+ {0xc08b, 0x1087}, // TLS_ECDHE_RSA_WITH_CAMELLIA_256_GCM_SHA384
+ {0xc08c, 0xf7f}, // TLS_ECDH_RSA_WITH_CAMELLIA_128_GCM_SHA256
+ {0xc08d, 0xf87}, // TLS_ECDH_RSA_WITH_CAMELLIA_256_GCM_SHA384
+};
+
+static const char *kKeyExchangeNames[] = {
+ "NULL",
+ "RSA",
+ "RSA_EXPORT",
+ "DH_DSS_EXPORT",
+ "DH_DSS",
+ "DH_RSA_EXPORT",
+ "DH_RSA",
+ "DHE_DSS_EXPORT",
+ "DHE_DSS",
+ "DHE_RSA_EXPORT",
+ "DHE_RSA",
+ "DH_anon_EXPORT",
+ "DH_anon",
+ "ECDH_ECDSA",
+ "ECDHE_ECDSA",
+ "ECDH_RSA",
+ "ECDHE_RSA",
+ "ECDH_anon",
+};
+
+static const char *kCipherNames[] = {
+ "NULL",
+ "RC4_40",
+ "RC4_128",
+ "RC2_CBC_40",
+ "IDEA_CBC",
+ "DES40_CBC",
+ "DES_CBC",
+ "3DES_EDE_CBC",
+ "AES_128_CBC",
+ "AES_256_CBC",
+ "CAMELLIA_128_CBC",
+ "CAMELLIA_256_CBC",
+ "SEED_CBC",
+ "AES_128_GCM",
+ "AES_256_GCM",
+ "CAMELLIA_128_GCM",
+ "CAMELLIA_256_GCM",
+};
+
+static const char *kMacNames[] = {
+ "NULL",
+ "MD5",
+ "SHA1",
+ "SHA256",
+ "SHA384",
+};
+
+static const char* SSLKeyExchangeName(SSLCipherSuite suite) {
+ int i;
+
+ for (i = 0; i < sizeof(kCipherSuites) / sizeof(CipherSuite); i++) {
+ if (kCipherSuites[i].cipher_suite == suite) {
+ int key_exchange = kCipherSuites[i].encoded >> 8;
+
+ return kKeyExchangeNames[key_exchange];
+ }
+ }
+
+ return "???";
+}
+
+static const char* SSLCipherName(SSLCipherSuite suite) {
+ int i;
+
+ for (i = 0; i < sizeof(kCipherSuites) / sizeof(CipherSuite); i++) {
+ if (kCipherSuites[i].cipher_suite == suite) {
+ int cipher = (kCipherSuites[i].encoded >> 3) & 0x1f;
+
+ return kCipherNames[cipher];
+ }
+ }
+
+ return "???";
+}
+
+static const char* SSLMACName(SSLCipherSuite suite) {
+ int i;
+
+ for (i = 0; i < sizeof(kCipherSuites) / sizeof(CipherSuite); i++) {
+ if (kCipherSuites[i].cipher_suite == suite) {
+ int mac = kCipherSuites[i].encoded & 0x07;
+
+ return kMacNames[mac];
+ }
+ }
+
+ return "???";
+}
More information about the commits
mailing list