From be7f8da3d4d00d88ede6069e09e8d9163330a557 Mon Sep 17 00:00:00 2001 From: CryptoSax Date: Thu, 28 Oct 2021 14:55:59 -0500 Subject: [PATCH] removed prints --- Sources/ShadowSwift/DarkStar.swift | 5 ----- Sources/ShadowSwift/DarkStarCipher.swift | 5 ----- Sources/ShadowSwift/DarkStarClient.swift | 3 --- Sources/ShadowSwift/DarkStarServer.swift | 27 ++---------------------- 4 files changed, 2 insertions(+), 38 deletions(-) diff --git a/Sources/ShadowSwift/DarkStar.swift b/Sources/ShadowSwift/DarkStar.swift index 99186bd..0b73fee 100644 --- a/Sources/ShadowSwift/DarkStar.swift +++ b/Sources/ShadowSwift/DarkStar.swift @@ -39,11 +39,6 @@ public struct DarkStar guard let serverIdentifier = DarkStar.makeServerIdentifier(endpoint) else {return nil} let serverEphemeralPublicKeyData = serverEphemeralPublicKey.compactRepresentation! let clientEphemeralPublicKeyData = clientEphemeralPublicKey.compactRepresentation! - - print("SCC1: \(symmetricKeyToData(key: clientSharedKey).hex)") - print("SCC2: \(serverIdentifier.hex)") - print("SCC3: \(serverEphemeralPublicKeyData.hex)") - print("SCC4: \(clientEphemeralPublicKeyData.hex)") var hmac = HMAC(key: clientSharedKey) hmac.update(data: serverIdentifier) diff --git a/Sources/ShadowSwift/DarkStarCipher.swift b/Sources/ShadowSwift/DarkStarCipher.swift index 6d43ed8..50150a2 100644 --- a/Sources/ShadowSwift/DarkStarCipher.swift +++ b/Sources/ShadowSwift/DarkStarCipher.swift @@ -129,11 +129,6 @@ class DarkStarCipher let sealedBox = try AES.GCM.seal(plaintext, using: self.key, nonce: nonce) cipherText = sealedBox.ciphertext tag = sealedBox.tag - print("encrypt Key: \(DarkStar.symmetricKeyToData(key: self.key).hex)") - print("encrypt nonce: \(Data(nonce).hex)") - print("encrypt plaintext: \(plaintext.hex)") - print("encrypt cipherText: \(cipherText.hex)") - print("encrypt tag: \(tag.hex)") } catch let encryptError { diff --git a/Sources/ShadowSwift/DarkStarClient.swift b/Sources/ShadowSwift/DarkStarClient.swift index 7f6e83f..7eb8fa7 100644 --- a/Sources/ShadowSwift/DarkStarClient.swift +++ b/Sources/ShadowSwift/DarkStarClient.swift @@ -29,8 +29,6 @@ public class DarkStarClient { guard let data = DarkStar.generateClientConfirmationCode(connection: connection, theirPublicKey: theirPublicKey, myPrivateKey: myPrivateKey, endpoint: endpoint, serverPersistentPublicKey: serverPersistentPublicKey, clientEphemeralPublicKey: clientEphemeralPublicKey) else {return false} - print(data.hex) - return connection.write(data: data) } @@ -63,7 +61,6 @@ public class DarkStarClient let hashed = hash.finalize() let hashedData = Data(hashed) - print("shared key: \(hashedData.hex)") return SymmetricKey(data: hashedData) } diff --git a/Sources/ShadowSwift/DarkStarServer.swift b/Sources/ShadowSwift/DarkStarServer.swift index b3d0f73..47798f2 100644 --- a/Sources/ShadowSwift/DarkStarServer.swift +++ b/Sources/ShadowSwift/DarkStarServer.swift @@ -19,7 +19,6 @@ public class DarkStarServer static public func handleServerConfirmationCode(connection: Connection, sharedKey: SymmetricKey, endpoint: NWEndpoint, serverEphemeralPublicKey: P256.KeyAgreement.PublicKey, clientEphemeralPublicKey: P256.KeyAgreement.PublicKey) -> Bool { guard let data = DarkStar.generateServerConfirmationCode(clientSharedKey: sharedKey, endpoint: endpoint, serverEphemeralPublicKey: serverEphemeralPublicKey, clientEphemeralPublicKey: clientEphemeralPublicKey) else {return false} - print("server confirmation code: \(data.hex)") return connection.write(data: data) } @@ -29,36 +28,19 @@ public class DarkStarServer guard let code = generateClientConfirmationCode(connection: connection, theirPublicKey: theirPublicKey, myPrivateKey: myPrivateKey, endpoint: endpoint, serverPersistentPublicKey: serverPersistentPublicKey, clientEphemeralPublicKey: clientEphemeralPublicKey) else {return false} - print("server copy confirmation code: \(code.hex)") - print("client copy confirmation code: \(data!.hex)") - - return data == code } static public func generateClientConfirmationCode(connection: Connection, theirPublicKey: P256.KeyAgreement.PublicKey, myPrivateKey: P256.KeyAgreement.PrivateKey, endpoint: NWEndpoint, serverPersistentPublicKey: P256.KeyAgreement.PublicKey, clientEphemeralPublicKey: P256.KeyAgreement.PublicKey) -> Data? { - print(serverPersistentPublicKey.compactRepresentation!.hex) - print(clientEphemeralPublicKey.compactRepresentation!.hex) - print(theirPublicKey) - - guard let ecdh = try? myPrivateKey.sharedSecretFromKeyAgreement(with: theirPublicKey) else {return nil} let ecdhData = DarkStar.sharedSecretToData(secret: ecdh) - - print("(client confirmation) ecdhData: \(ecdhData.hex)") guard let serverIdentifier = DarkStar.makeServerIdentifier(endpoint) else {return nil} - - print("(client confirmation) serverIdentifier: \(serverIdentifier.hex)") - + let serverPersistentPublicKeyData = serverPersistentPublicKey.compactRepresentation! - - print("(client confirmation) SPPubKey: \(serverPersistentPublicKeyData.hex)") - + let clientEphemeralPublicKeyData = clientEphemeralPublicKey.compactRepresentation! - - print("(client confirmation) CEPubKey: \(clientEphemeralPublicKeyData.hex)") var hash = SHA256() hash.update(data: ecdhData) @@ -88,11 +70,6 @@ public class DarkStarServer let serverEphemeralPublicKeyData = serverEphemeralPublicKey.compactRepresentation! guard let serverIdentifier = DarkStar.makeServerIdentifier(serverEndpoint) else {return nil} - - print("ecdh1: \(ephemeralECDHData.hex)") - print("ecdh2: \(persistentECDHData.hex)") - print("SEPub: \(serverEphemeralPublicKeyData.hex)") - print("ServerIdentifier: \(serverIdentifier)") var hash = SHA256() hash.update(data: ephemeralECDHData)