Respond to CR.
This commit is contained in:
parent
ad37d1318a
commit
0e5d4f2b3c
@ -22,7 +22,7 @@ import Foundation
|
||||
|
||||
// https://github.com/signalapp/libsignal-protocol-java/blob/master/java/src/main/java/org/whispersystems/libsignal/ecc/Curve.java#L30
|
||||
public init(serializedKeyData: Data) throws {
|
||||
let parser = DataParser(data: serializedKeyData)
|
||||
let parser = OWSDataParser(data: serializedKeyData)
|
||||
|
||||
let typeByte = try parser.nextByte(name: "type byte")
|
||||
guard typeByte == ECPublicKey.keyTypeDJB else {
|
||||
|
||||
@ -333,7 +333,7 @@ private class SMKStaticKeys: NSObject {
|
||||
throw SMKError.assertionError(description: "\(logTag) derived ephemeral has unexpected length: \(ephemeralDerived.count).")
|
||||
}
|
||||
|
||||
let ephemeralDerivedParser = DataParser(data: ephemeralDerived)
|
||||
let ephemeralDerivedParser = OWSDataParser(data: ephemeralDerived)
|
||||
let chainKey = try ephemeralDerivedParser.nextData(length: 32, name: "chain key")
|
||||
let cipherKey = try ephemeralDerivedParser.nextData(length: 32, name: "cipher key")
|
||||
let macKey = try ephemeralDerivedParser.nextData(length: 32, name: "mac key")
|
||||
@ -374,7 +374,7 @@ private class SMKStaticKeys: NSObject {
|
||||
}
|
||||
|
||||
// byte[][] staticDerivedParts = ByteUtil.split(staticDerived, 32, 32, 32);
|
||||
let staticDerivedParser = DataParser(data: staticDerived)
|
||||
let staticDerivedParser = OWSDataParser(data: staticDerived)
|
||||
_ = try staticDerivedParser.nextData(length: 32)
|
||||
let cipherKey = try staticDerivedParser.nextData(length: 32)
|
||||
let macKey = try staticDerivedParser.nextData(length: 32)
|
||||
@ -480,7 +480,7 @@ private class SMKStaticKeys: NSObject {
|
||||
}
|
||||
|
||||
// byte[][] ciphertextParts = ByteUtil.split(ciphertext, ciphertext.count - 10, 10);
|
||||
let cipherTextWithMacParser = DataParser(data: cipherTextWithMac)
|
||||
let cipherTextWithMacParser = OWSDataParser(data: cipherTextWithMac)
|
||||
let cipherTextLength = UInt(cipherTextWithMac.count) - kSMKSecretSessionCipherMacLength
|
||||
let cipherText = try cipherTextWithMacParser.nextData(length: cipherTextLength, name: "cipher text")
|
||||
let theirMac = try cipherTextWithMacParser.nextData(length: kSMKSecretSessionCipherMacLength, name: "their mac")
|
||||
|
||||
@ -37,7 +37,7 @@ import Foundation
|
||||
// public UnidentifiedSenderMessage(byte[] serialized)
|
||||
// throws InvalidMetadataMessageException, InvalidMetadataVersionException
|
||||
|
||||
let parser = DataParser(data: dataAndPrefix)
|
||||
let parser = OWSDataParser(data: dataAndPrefix)
|
||||
|
||||
// this.version = ByteUtil.highBitsToInt(serialized[0]);
|
||||
let versionByte = try parser.nextByte(name: "version byte")
|
||||
|
||||
@ -6,14 +6,15 @@
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface SMKObjCTest : XCTestCase
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark -
|
||||
|
||||
@implementation SMKObjCTest
|
||||
|
||||
@end
|
||||
// Cocoapods-generated test targets (like this one)
|
||||
// fail to link if:
|
||||
//
|
||||
// * They only contain Swift tests.
|
||||
// * They depend on pods that use Obj-C.
|
||||
//
|
||||
// The work around is to add (this) empty Obj-C file
|
||||
// to our test target.
|
||||
//
|
||||
// See: https://github.com/CocoaPods/CocoaPods/issues/7170
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@ -2,9 +2,12 @@
|
||||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
import SignalMetadataKit
|
||||
|
||||
// https://github.com/signalapp/libsignal-metadata-java/blob/master/tests/src/test/java/org/signal/libsignal/metadata/SecretSessionCipherTest.java
|
||||
// public class SecretSessionCipherTest extends TestCase {
|
||||
class SMKSecretSessionCipherTest: SignalBaseTest {
|
||||
class SMKSecretSessionCipherTest: XCTestCase {
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
@ -121,9 +124,10 @@ class SMKSecretSessionCipherTest: SignalBaseTest {
|
||||
timestamp: 31335,
|
||||
protocolContext: nil)
|
||||
XCTFail("Decryption should have failed.")
|
||||
} catch {
|
||||
} catch _ as SMKCertificateError {
|
||||
// Decryption is expected to fail.
|
||||
XCTAssertTrue(error is SMKError)
|
||||
} catch {
|
||||
XCTFail("Unexpected error: \(error)")
|
||||
}
|
||||
}
|
||||
|
||||
@ -177,9 +181,10 @@ class SMKSecretSessionCipherTest: SignalBaseTest {
|
||||
timestamp: 31338,
|
||||
protocolContext: nil)
|
||||
XCTFail("Decryption should have failed.")
|
||||
} catch {
|
||||
} catch _ as SMKCertificateError {
|
||||
// Decryption is expected to fail.
|
||||
XCTAssertTrue(error is SMKError)
|
||||
} catch {
|
||||
XCTFail("Unexpected error: \(error)")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,10 +2,13 @@
|
||||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
import SignalMetadataKit
|
||||
|
||||
// See: https://github.com/signalapp/libsignal-metadata-java/blob/master/tests/src/test/java/org/signal/libsignal/metadata/certificate/SenderCertificateTest.java
|
||||
//
|
||||
//public class SenderCertificateTest extends TestCase {
|
||||
class SMKSenderCertificateTest: SignalBaseTest {
|
||||
class SMKSenderCertificateTest: XCTestCase {
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
|
||||
@ -2,12 +2,14 @@
|
||||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
import SwiftProtobuf
|
||||
import SignalMetadataKit
|
||||
|
||||
// See: https://github.com/signalapp/libsignal-metadata-java/blob/master/tests/src/test/java/org/signal/libsignal/metadata/certificate/ServerCertificateTest.java
|
||||
//
|
||||
// public class ServerCertificateTest extends TestCase {
|
||||
class SMKServerCertificateTest: SignalBaseTest {
|
||||
class SMKServerCertificateTest: XCTestCase {
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# SignalServiceKit Protobufs
|
||||
|
||||
These protobuf definitions are copied from Signal-Android, but modified
|
||||
These protobuf definitions are copied from libsignal-metadata-java, but modified
|
||||
to match some iOS conventions.
|
||||
|
||||
## Prequisites
|
||||
@ -17,6 +17,7 @@ files.
|
||||
|
||||
## Building Protobuf
|
||||
|
||||
cd ~/src/WhisperSystems/SignalServiceKit/protobuf
|
||||
// Make sure that Signal-iOS is checked out alongside this repo, at the path: [repo root]/../Signal-iOS
|
||||
cd [repo root]/protobuf
|
||||
make
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user