WebSocket Public Key Pinning.
This commit is contained in:
parent
54dae0639c
commit
8435a800d4
|
@ -83,7 +83,7 @@ EXTERNAL SOURCES:
|
|||
|
||||
CHECKOUT OPTIONS:
|
||||
JSQMessagesViewController:
|
||||
:commit: 7c2cec63f9e05ac7859df786e6ca31af2f0dc583
|
||||
:commit: 82482a1fc560fb4f716babbe49a20cf9c0bc7fc3
|
||||
:git: https://github.com/dtsbourg/JSQMessagesViewController
|
||||
SocketRocket:
|
||||
:commit: d0585af165
|
||||
|
|
2
Pods
2
Pods
|
@ -1 +1 @@
|
|||
Subproject commit bc9ebd5dc7fb4100c78e5bb4dda15cfcc3b6734a
|
||||
Subproject commit 0b6f683fbd2c3947a73ddb619ca4fe5ef4e6edcd
|
|
@ -392,6 +392,8 @@
|
|||
B6B096951A1D25ED008BFAA6 /* NSURLSessionDataTask+StatusCode.m in Sources */ = {isa = PBXBuildFile; fileRef = B6B096601A1D25ED008BFAA6 /* NSURLSessionDataTask+StatusCode.m */; };
|
||||
B6B1013C196D213F007E3930 /* SignalKeyingStorage.m in Sources */ = {isa = PBXBuildFile; fileRef = B6B1013B196D213F007E3930 /* SignalKeyingStorage.m */; };
|
||||
B6B9ECFC198B31BA00C620D3 /* PushManager.m in Sources */ = {isa = PBXBuildFile; fileRef = B6B9ECFB198B31BA00C620D3 /* PushManager.m */; };
|
||||
B6C6AE551A305ED1006BAF8F /* redphone.cer in Resources */ = {isa = PBXBuildFile; fileRef = B6C6AE531A305ED1006BAF8F /* redphone.cer */; };
|
||||
B6C6AE561A305ED1006BAF8F /* textsecure.cer in Resources */ = {isa = PBXBuildFile; fileRef = B6C6AE541A305ED1006BAF8F /* textsecure.cer */; };
|
||||
B6C93C4E199567AD00EDF894 /* DebugLogger.m in Sources */ = {isa = PBXBuildFile; fileRef = B6C93C4D199567AD00EDF894 /* DebugLogger.m */; };
|
||||
B6CBF53F1A254BD1000D4184 /* ContactDetailCell.m in Sources */ = {isa = PBXBuildFile; fileRef = B6CBF53E1A254BD1000D4184 /* ContactDetailCell.m */; };
|
||||
B90418E6183E9DD40038554A /* DateUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = B90418E5183E9DD40038554A /* DateUtil.m */; };
|
||||
|
@ -444,7 +446,6 @@
|
|||
E1370BF018A0689000826894 /* AppIcon60x60@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = E18AB3FA18A05734001A532A /* AppIcon60x60@2x.png */; };
|
||||
E1370BF118A0689000826894 /* AppIcon76x76.png in Resources */ = {isa = PBXBuildFile; fileRef = E18AB3FB18A05734001A532A /* AppIcon76x76.png */; };
|
||||
E1370BF218A0689000826894 /* AppIcon76x76@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = E18AB3FC18A05734001A532A /* AppIcon76x76@2x.png */; };
|
||||
E1370BF618A068A600826894 /* whisperReal.cer in Resources */ = {isa = PBXBuildFile; fileRef = E1C407C117F0C246007BEE65 /* whisperReal.cer */; };
|
||||
E14874F818A06951002CC4F3 /* ContactTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 76EB053A18170B33006006FC /* ContactTableViewCell.xib */; };
|
||||
E14874F918A06951002CC4F3 /* CountryCodeTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = B97CBFB018861023008E0DE9 /* CountryCodeTableViewCell.xib */; };
|
||||
E148750018A06966002CC4F3 /* CallAudioManagerDemo.xib in Resources */ = {isa = PBXBuildFile; fileRef = 76EB051D18170B33006006FC /* CallAudioManagerDemo.xib */; };
|
||||
|
@ -1040,6 +1041,8 @@
|
|||
B6B1013B196D213F007E3930 /* SignalKeyingStorage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SignalKeyingStorage.m; sourceTree = "<group>"; };
|
||||
B6B9ECFA198B31BA00C620D3 /* PushManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PushManager.h; sourceTree = "<group>"; };
|
||||
B6B9ECFB198B31BA00C620D3 /* PushManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PushManager.m; sourceTree = "<group>"; };
|
||||
B6C6AE531A305ED1006BAF8F /* redphone.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = redphone.cer; sourceTree = "<group>"; };
|
||||
B6C6AE541A305ED1006BAF8F /* textsecure.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = textsecure.cer; sourceTree = "<group>"; };
|
||||
B6C93C4C199567AD00EDF894 /* DebugLogger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DebugLogger.h; sourceTree = "<group>"; };
|
||||
B6C93C4D199567AD00EDF894 /* DebugLogger.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DebugLogger.m; sourceTree = "<group>"; };
|
||||
B6CBF53D1A254BD1000D4184 /* ContactDetailCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ContactDetailCell.h; path = "Signal/src/view controllers/ContactDetailCell.h"; sourceTree = SOURCE_ROOT; };
|
||||
|
@ -1145,7 +1148,6 @@
|
|||
E197B62618BBF63B00F073E5 /* SoundBoard.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SoundBoard.m; sourceTree = "<group>"; };
|
||||
E1A0AD8B16E13FDD0071E604 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; };
|
||||
E1B3DC731885EFA100B7F794 /* NotificationManifest.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NotificationManifest.h; sourceTree = "<group>"; };
|
||||
E1C407C117F0C246007BEE65 /* whisperReal.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = whisperReal.cer; sourceTree = "<group>"; };
|
||||
E1CD329418BCFF9900B1A496 /* SoundInstance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SoundInstance.h; sourceTree = "<group>"; };
|
||||
E1CD329518BCFF9900B1A496 /* SoundInstance.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SoundInstance.m; sourceTree = "<group>"; };
|
||||
FC15B7BE1A1F80F200F59801 /* defaultConctact_light@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "defaultConctact_light@2x.png"; sourceTree = "<group>"; };
|
||||
|
@ -2403,6 +2405,15 @@
|
|||
name = Translations;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B6C6AE521A305ED1006BAF8F /* Certificates */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B6C6AE531A305ED1006BAF8F /* redphone.cer */,
|
||||
B6C6AE541A305ED1006BAF8F /* textsecure.cer */,
|
||||
);
|
||||
path = Certificates;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
BF8C3D8119CE3B6A008F644C /* call */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -2478,6 +2489,7 @@
|
|||
D221A094169C9E5E00537ABF /* Supporting Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B6C6AE521A305ED1006BAF8F /* Certificates */,
|
||||
B6B6C3C419193F5B00C0B76B /* Translations */,
|
||||
E18AB40618A05754001A532A /* AudioFiles */,
|
||||
E18AB3F318A05734001A532A /* Icons */,
|
||||
|
@ -2486,7 +2498,6 @@
|
|||
D221A095169C9E5E00537ABF /* Signal-Info.plist */,
|
||||
D221A09B169C9E5E00537ABF /* Signal-Prefix.pch */,
|
||||
B661C211198EE2EA00548CA1 /* iOSVersions.h */,
|
||||
E1C407C117F0C246007BEE65 /* whisperReal.cer */,
|
||||
);
|
||||
name = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
|
@ -2717,6 +2728,7 @@
|
|||
ORGANIZATIONNAME = "Open Whisper Systems";
|
||||
TargetAttributes = {
|
||||
D221A088169C9E5E00537ABF = {
|
||||
DevelopmentTeam = U68MSDN6DR;
|
||||
SystemCapabilities = {
|
||||
com.apple.DataProtection = {
|
||||
enabled = 1;
|
||||
|
@ -2846,6 +2858,7 @@
|
|||
B633C59D1A1D190B0059AC12 /* endcall@2x.png in Resources */,
|
||||
B633C5B41A1D190B0059AC12 /* keypad@2x.png in Resources */,
|
||||
B633C5DA1A1D190B0059AC12 /* settings_dark@2x.png in Resources */,
|
||||
B6C6AE561A305ED1006BAF8F /* textsecure.cer in Resources */,
|
||||
FCA52AEC1A2B676C00CCADFA /* message_error@2x.png in Resources */,
|
||||
E14874F818A06951002CC4F3 /* ContactTableViewCell.xib in Resources */,
|
||||
B633C5BC1A1D190B0059AC12 /* message_bubble@2x.png in Resources */,
|
||||
|
@ -2892,6 +2905,7 @@
|
|||
B67EBF5D19194AC60084CCFD /* Settings.bundle in Resources */,
|
||||
E1370BE418A0686C00826894 /* outring.mp3 in Resources */,
|
||||
B633C5841A1D190B0059AC12 /* backspace@2x.png in Resources */,
|
||||
B6C6AE551A305ED1006BAF8F /* redphone.cer in Resources */,
|
||||
B633C5B71A1D190B0059AC12 /* logo_intro@2x.png in Resources */,
|
||||
E1370BE518A0686C00826894 /* r.caf in Resources */,
|
||||
B633C5981A1D190B0059AC12 /* delete_history@2x.png in Resources */,
|
||||
|
@ -2906,7 +2920,6 @@
|
|||
E148751418A06AFD002CC4F3 /* HelveticaNeueLTStd-Lt.otf in Resources */,
|
||||
E148751518A06AFD002CC4F3 /* HelveticaNeueLTStd-Md.otf in Resources */,
|
||||
FC3BD97B1A2CD385005B96BB /* call_dotted@2x.png in Resources */,
|
||||
E1370BF618A068A600826894 /* whisperReal.cer in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
Binary file not shown.
|
@ -38,7 +38,7 @@
|
|||
</dict>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>2.0</string>
|
||||
<string>2.0.1</string>
|
||||
<key>LOGS_EMAIL</key>
|
||||
<string>support@whispersystems.org</string>
|
||||
<key>LOGS_URL</key>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6250" systemVersion="14C68k" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="kts-vO-ui1">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6254" systemVersion="14B25" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6244"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6247"/>
|
||||
<capability name="Alignment constraints with different attributes" minToolsVersion="5.1"/>
|
||||
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
|
||||
</dependencies>
|
||||
|
@ -35,6 +35,9 @@
|
|||
</tableViewCell>
|
||||
</prototypes>
|
||||
<sections/>
|
||||
<variation key="heightClass=regular-widthClass=compact" misplaced="YES">
|
||||
<rect key="frame" x="0.0" y="-44" width="410" height="844"/>
|
||||
</variation>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="MY2-bB-USa" id="kop-Y6-6DR"/>
|
||||
<outlet property="delegate" destination="MY2-bB-USa" id="vmj-PA-2Od"/>
|
||||
|
@ -2419,7 +2422,8 @@ Licensed under the GPLv3</string>
|
|||
<exclude reference="yPj-mV-IsZ"/>
|
||||
</mask>
|
||||
</variation>
|
||||
<variation key="heightClass=regular-widthClass=compact">
|
||||
<variation key="heightClass=regular-widthClass=compact" misplaced="YES">
|
||||
<rect key="frame" x="15" y="30" width="36" height="21"/>
|
||||
<mask key="constraints">
|
||||
<include reference="s6d-wF-wNd"/>
|
||||
<include reference="yPj-mV-IsZ"/>
|
||||
|
@ -2571,7 +2575,8 @@ Licensed under the GPLv3</string>
|
|||
<exclude reference="huD-gF-Wt1"/>
|
||||
</mask>
|
||||
</variation>
|
||||
<variation key="heightClass=regular-widthClass=compact">
|
||||
<variation key="heightClass=regular-widthClass=compact" misplaced="YES">
|
||||
<rect key="frame" x="15" y="29" width="83" height="21"/>
|
||||
<mask key="constraints">
|
||||
<include reference="KcQ-uK-I5A"/>
|
||||
<include reference="huD-gF-Wt1"/>
|
||||
|
@ -2904,7 +2909,8 @@ Licensed under the GPLv3</string>
|
|||
<exclude reference="ZIm-Uq-bM8"/>
|
||||
</mask>
|
||||
</variation>
|
||||
<variation key="heightClass=regular-widthClass=compact">
|
||||
<variation key="heightClass=regular-widthClass=compact" misplaced="YES">
|
||||
<rect key="frame" x="0.0" y="20" width="400" height="100"/>
|
||||
<mask key="subviews">
|
||||
<include reference="gbm-B5-gCc"/>
|
||||
<include reference="Ul8-NY-i4c"/>
|
||||
|
@ -2958,6 +2964,9 @@ Licensed under the GPLv3</string>
|
|||
</tableViewCellContentView>
|
||||
</tableViewCell>
|
||||
</prototypes>
|
||||
<variation key="heightClass=regular-widthClass=compact" misplaced="YES">
|
||||
<rect key="frame" x="0.0" y="128" width="400" height="672"/>
|
||||
</variation>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="bDi-2Q-XOC" id="VPO-ms-bH1"/>
|
||||
<outlet property="delegate" destination="bDi-2Q-XOC" id="rKM-jX-C39"/>
|
||||
|
@ -3040,6 +3049,6 @@ Licensed under the GPLv3</string>
|
|||
<image name="signals_tab.png" width="24" height="24"/>
|
||||
</resources>
|
||||
<inferredMetricsTieBreakers>
|
||||
<segue reference="qCk-gl-KCX"/>
|
||||
<segue reference="QK8-XK-Wd3"/>
|
||||
</inferredMetricsTieBreakers>
|
||||
</document>
|
||||
|
|
|
@ -54,7 +54,7 @@ static unsigned char DH3K_PRIME[]={
|
|||
andMasterServerHostName:@"master.whispersystems.org"
|
||||
andDefaultRelayName:@"relay"
|
||||
andRelayServerHostNameSuffix:@"whispersystems.org"
|
||||
andCertificate:[Certificate certificateFromResourcePath:@"whisperReal" ofType:@"cer"]
|
||||
andCertificate:[Certificate certificateFromResourcePath:@"redphone" ofType:@"cer"]
|
||||
andCurrentRegionCodeForPhoneNumbers:[(NSLocale*)NSLocale.currentLocale objectForKey:NSLocaleCountryCode]
|
||||
andSupportedKeyAgreementProtocols:[self supportedKeyAgreementProtocols]
|
||||
andPhoneManager:[PhoneManager phoneManagerWithErrorHandler:errorNoter]
|
||||
|
@ -78,7 +78,7 @@ static unsigned char DH3K_PRIME[]={
|
|||
andMasterServerHostName:@"master.whispersystems.org"
|
||||
andDefaultRelayName:@"relay"
|
||||
andRelayServerHostNameSuffix:@"whispersystems.org"
|
||||
andCertificate:[Certificate certificateFromResourcePath:@"whisperReal" ofType:@"cer"]
|
||||
andCertificate:[Certificate certificateFromResourcePath:@"redphone" ofType:@"cer"]
|
||||
andCurrentRegionCodeForPhoneNumbers:@"US"
|
||||
andSupportedKeyAgreementProtocols:keyAgreementProtocols
|
||||
andPhoneManager:nil
|
||||
|
|
|
@ -38,7 +38,7 @@ MacrosSingletonImplemention
|
|||
self.operationManager = [[AFHTTPSessionManager alloc] initWithBaseURL:endPointURL sessionConfiguration:sessionConf];
|
||||
self.operationManager.securityPolicy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeNone];
|
||||
self.operationManager.securityPolicy.allowInvalidCertificates = YES;
|
||||
NSString *certPath = [NSBundle.mainBundle pathForResource:@"whisperReal" ofType:@"cer"];
|
||||
NSString *certPath = [NSBundle.mainBundle pathForResource:@"redphone" ofType:@"cer"];
|
||||
NSData *certData = [NSData dataWithContentsOfFile:certPath];
|
||||
SecCertificateRef cert = SecCertificateCreateWithData(NULL, (__bridge CFDataRef)(certData));
|
||||
self.operationManager.securityPolicy.pinnedCertificates = @[(__bridge_transfer NSData *)SecCertificateCopyData(cert)];
|
||||
|
|
|
@ -39,9 +39,9 @@
|
|||
if (self = [super init]) {
|
||||
NSURLSessionConfiguration *sessionConf = NSURLSessionConfiguration.ephemeralSessionConfiguration;
|
||||
self.operationManager = [[AFHTTPSessionManager alloc] initWithBaseURL:[[NSURL alloc] initWithString:textSecureServerURL] sessionConfiguration:sessionConf];
|
||||
AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeNone]; //TODO: pinging cert
|
||||
AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModePublicKey];
|
||||
policy.allowInvalidCertificates = YES;
|
||||
NSString *certPath = [NSBundle.mainBundle pathForResource:@"whisperReal" ofType:@"cer"];
|
||||
NSString *certPath = [NSBundle.mainBundle pathForResource:@"textsecure" ofType:@"cer"];
|
||||
NSData *certData = [NSData dataWithContentsOfFile:certPath];
|
||||
SecCertificateRef cert = SecCertificateCreateWithData(NULL, (__bridge CFDataRef)(certData));
|
||||
policy.pinnedCertificates = @[(__bridge_transfer NSData *)SecCertificateCopyData(cert)];
|
||||
|
|
|
@ -81,10 +81,19 @@ NSString * const SocketConnectingNotification = @"SocketConnectingNotification";
|
|||
}
|
||||
}
|
||||
|
||||
NSString *webSocketConnect = [textSecureWebSocketAPI stringByAppendingString:[[self sharedManager] webSocketAuthenticationString]];
|
||||
NSURL *webSocketConnectURL = [NSURL URLWithString:webSocketConnect];
|
||||
socket = [[SRWebSocket alloc] initWithURL:webSocketConnectURL];
|
||||
NSString* webSocketConnect = [textSecureWebSocketAPI stringByAppendingString:[[self sharedManager] webSocketAuthenticationString]];
|
||||
NSURL* webSocketConnectURL = [NSURL URLWithString:webSocketConnect];
|
||||
NSMutableURLRequest* request = [[NSMutableURLRequest alloc] initWithURL:webSocketConnectURL];
|
||||
NSString* cerPath = [[NSBundle mainBundle] pathForResource:@"textsecure" ofType:@"cer"];
|
||||
NSData* certData = [[NSData alloc] initWithContentsOfFile:cerPath];
|
||||
CFDataRef certDataRef = (__bridge CFDataRef)certData;
|
||||
SecCertificateRef certRef = SecCertificateCreateWithData(NULL, certDataRef);
|
||||
id certificate = (__bridge id)certRef;
|
||||
[request setSR_SSLPinnedCertificates:@[ certificate ]];
|
||||
|
||||
socket = [[SRWebSocket alloc] initWithURLRequest:request];
|
||||
socket.delegate = [self sharedManager];
|
||||
|
||||
[socket open];
|
||||
[[self sharedManager] setWebsocket:socket];
|
||||
}
|
||||
|
|
|
@ -2,8 +2,9 @@
|
|||
|
||||
@interface NSData (Base64)
|
||||
|
||||
+ (NSData *)dataFromBase64String:(NSString *)aString;
|
||||
+ (NSData*)dataFromBase64StringNoPadding:(NSString*)aString;
|
||||
+ (NSData*)dataFromBase64String:(NSString*)aString;
|
||||
|
||||
- (NSString *)base64EncodedString;
|
||||
- (NSString*)base64EncodedString;
|
||||
|
||||
@end
|
||||
|
|
|
@ -4,6 +4,19 @@
|
|||
|
||||
@implementation NSData (Base64)
|
||||
|
||||
+ (NSData*)dataFromBase64StringNoPadding:(NSString*)aString{
|
||||
int padding = aString.length%4;
|
||||
|
||||
NSMutableString *strResult = [aString mutableCopy];
|
||||
if (padding != 0) {
|
||||
int charsToAdd = 4 - padding;
|
||||
for (int i = 0; i < charsToAdd; i++) {
|
||||
[strResult appendString:@"="];
|
||||
}
|
||||
}
|
||||
return [self dataFromBase64String:strResult];
|
||||
}
|
||||
|
||||
//
|
||||
// dataFromBase64String:
|
||||
//
|
||||
|
@ -15,18 +28,9 @@
|
|||
//
|
||||
// returns the NSData representation of the base64 string
|
||||
//
|
||||
|
||||
+ (NSData *)dataFromBase64String:(NSString *)aString {
|
||||
int padding = aString.length%4;
|
||||
|
||||
NSMutableString *strResult = [aString mutableCopy];
|
||||
if (padding != 0) {
|
||||
int charsToAdd = 4 - padding;
|
||||
for (int i = 0; i < charsToAdd; i++) {
|
||||
[strResult appendString:@"="];
|
||||
}
|
||||
}
|
||||
|
||||
return [[NSData alloc] initWithBase64EncodedString:strResult options:NSDataBase64DecodingIgnoreUnknownCharacters];
|
||||
return [[NSData alloc] initWithBase64EncodedString:aString options:NSDataBase64DecodingIgnoreUnknownCharacters];
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
return nil;
|
||||
}
|
||||
|
||||
NSData *identityKey = [NSData dataFromBase64String:identityKeyString];
|
||||
NSData *identityKey = [NSData dataFromBase64StringNoPadding:identityKeyString];
|
||||
|
||||
for (NSDictionary *deviceDict in devicesArray) {
|
||||
NSNumber *registrationIdString = [deviceDict objectForKey:@"registrationId"];
|
||||
|
@ -50,7 +50,7 @@
|
|||
} else{
|
||||
prekeyId = [[preKey objectForKey:@"keyId"] intValue];
|
||||
NSString *preKeyPublicString = [preKey objectForKey:@"publicKey"];
|
||||
preKeyPublic = [NSData dataFromBase64String:preKeyPublicString];
|
||||
preKeyPublic = [NSData dataFromBase64StringNoPadding:preKeyPublicString];
|
||||
}
|
||||
|
||||
NSDictionary *signedPrekey = [deviceDict objectForKey:@"signedPreKey"];
|
||||
|
@ -71,8 +71,8 @@
|
|||
return nil;
|
||||
}
|
||||
|
||||
NSData *signedPrekeyPublic = [NSData dataFromBase64String:signedPublicKeyString];
|
||||
NSData *signedPreKeySignature = [NSData dataFromBase64String:signedSignatureString];
|
||||
NSData *signedPrekeyPublic = [NSData dataFromBase64StringNoPadding:signedPublicKeyString];
|
||||
NSData *signedPreKeySignature = [NSData dataFromBase64StringNoPadding:signedSignatureString];
|
||||
|
||||
if (!(signedPrekeyPublic && signedPreKeySignature)) {
|
||||
DDLogError(@"Failed to parse signed keying material");
|
||||
|
|
|
@ -93,12 +93,6 @@ typedef enum : NSUInteger {
|
|||
|
||||
self.senderId = ME_MESSAGE_IDENTIFIER
|
||||
self.senderDisplayName = ME_MESSAGE_IDENTIFIER
|
||||
|
||||
if (!isGroupConversation)
|
||||
{
|
||||
[self initializeObservers];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- (void)didPressBack{
|
||||
|
@ -112,12 +106,6 @@ typedef enum : NSUInteger {
|
|||
[super didReceiveMemoryWarning];
|
||||
}
|
||||
|
||||
-(void)dealloc
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillHideNotification object:nil];
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil];
|
||||
}
|
||||
|
||||
#pragma mark - Initiliazers
|
||||
|
||||
-(void)initializeNavigationBar
|
||||
|
@ -164,31 +152,6 @@ typedef enum : NSUInteger {
|
|||
|
||||
}
|
||||
|
||||
-(void)initializeObservers
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(keyboardWillShow:)
|
||||
name:UIKeyboardWillShowNotification
|
||||
object:nil];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(keyboardWillHide:)
|
||||
name:UIKeyboardWillHideNotification
|
||||
object:nil];
|
||||
|
||||
}
|
||||
|
||||
#pragma mark - Keyboard Handlers
|
||||
|
||||
-(void)keyboardWillShow:(id)sender
|
||||
{
|
||||
[self.inputToolbar.contentView setRightBarButtonItem:[JSQMessagesToolbarButtonFactory defaultSendButtonItem]];
|
||||
}
|
||||
|
||||
-(void)keyboardWillHide:(id)sender
|
||||
{
|
||||
[self.inputToolbar.contentView setRightBarButtonItem:[JSQMessagesToolbarButtonFactory signalCallButtonItem]];
|
||||
}
|
||||
|
||||
#pragma mark - Fingerprints
|
||||
|
||||
-(void)showFingerprint
|
||||
|
@ -236,11 +199,7 @@ typedef enum : NSUInteger {
|
|||
senderDisplayName:(NSString *)senderDisplayName
|
||||
date:(NSDate *)date
|
||||
{
|
||||
if ([button.titleLabel.text isEqualToString:@"Call"])
|
||||
{
|
||||
NSLog(@"Let's call !");
|
||||
|
||||
} else if (text.length > 0) {
|
||||
if (text.length > 0) {
|
||||
[JSQSystemSoundPlayer jsq_playMessageSentSound];
|
||||
|
||||
TSOutgoingMessage *message = [[TSOutgoingMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp] inThread:self.thread messageBody:text attachements:nil];
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
#define TEST_SERVER_HOST @"master.whispersystems.org"
|
||||
#define TEST_SERVER_PORT 31337
|
||||
#define TEST_SERVER_CERT_PATH @"whisperReal"
|
||||
#define TEST_SERVER_CERT_PATH @"redphone"
|
||||
#define TEST_SERVER_CERT_TYPE @"cer"
|
||||
|
||||
#define TEST_SERVER_INCORRECT_HOST_TO_SAME_IP @"96.126.120.52"
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
@implementation SecureEndPointTest
|
||||
|
||||
-(void) testCert {
|
||||
Certificate* r = [Certificate certificateFromResourcePath:@"whisperReal"
|
||||
Certificate* r = [Certificate certificateFromResourcePath:@"redphone"
|
||||
ofType:@"cer"];
|
||||
test(r != nil);
|
||||
}
|
||||
|
|
|
@ -58,8 +58,9 @@
|
|||
inThread:self.thread
|
||||
messageBody:body
|
||||
attachements:nil];
|
||||
[newMessage save];
|
||||
|
||||
[[TSStorageManager sharedManager].newDatabaseConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
|
||||
[newMessage saveWithTransaction:transaction];
|
||||
}];
|
||||
|
||||
TSIncomingMessage *fetchedMessage = [TSIncomingMessage fetchObjectWithUniqueID:[TSInteraction stringFromTimeStamp:timestamp]];
|
||||
|
||||
|
|
Loading…
Reference in New Issue