-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from Sajjon/tests
Remove legacy configurations and plists, add test for GCM
- Loading branch information
Showing
14 changed files
with
85 additions
and
90 deletions.
There are no files selected for viewing
2 changes: 0 additions & 2 deletions
2
Sources/EllipticCurveKit/Configurations/EllipticCurveKit-Mac.xcconfig
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
Sources/EllipticCurveKit/Configurations/EllipticCurveKit-Shared.xcconfig
This file was deleted.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
Sources/EllipticCurveKit/Configurations/EllipticCurveKit-iOS.xcconfig
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 0 additions & 24 deletions
24
Sources/EllipticCurveKit/SupportingFiles/EllipticCurveKit-Info.plist
This file was deleted.
Oops, something went wrong.
19 changes: 0 additions & 19 deletions
19
Sources/EllipticCurveKit/SupportingFiles/EllipticCurveKit.h
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
Tests/EllipticCurveKitTests/Configurations/EllipticCurveKit-Tests-Mac.xcconfig
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
Tests/EllipticCurveKitTests/Configurations/EllipticCurveKit-Tests-Shared.xcconfig
This file was deleted.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
Tests/EllipticCurveKitTests/Configurations/EllipticCurveKit-Tests-iOS.xcconfig
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// | ||
// File.swift | ||
// | ||
// | ||
// Created by Alexander Cyon on 2021-03-09. | ||
// | ||
|
||
import Foundation | ||
import XCTest | ||
@testable import EllipticCurveKit | ||
import CryptoKit | ||
|
||
final class AESGCMTests: XCTestCase { | ||
func testAESGCM() throws { | ||
|
||
|
||
let nonce = try AES.GCM.Nonce( | ||
data: Data(hex: "bf9e592c50183db30afff24d") | ||
) | ||
|
||
let ciphertext = Data(hex: "d2d309e9d7c9c5f5ca692b3e51e4f84670e8ee3dfce4d183389e6fcea2f46a707101e38a6aff1754e57c533b6bea0f620d5bac85ec9a2f86352111e2fc2879c839b6ae0d931c30364d5245bcad69") | ||
|
||
let authTag = Data(hex: "baa17313cf02d4f34d135c34643426c8") | ||
|
||
let sealedBox = try AES.GCM.SealedBox( | ||
nonce: nonce, | ||
ciphertext: ciphertext, | ||
tag: authTag | ||
) | ||
|
||
let symmetricKeyData = Data(hex: "fbe8c9f0dcbdbf52ee3038b18ca378255c35583bae12eb50151d7458d43dc3e1") | ||
|
||
let additionalAuthData = Data(hex: "03B7F98F3FB16527A8F779C326A7A57261F1341EAC191011F7A916D01D668F4549") | ||
|
||
let decrypted = try AES.GCM.open( | ||
sealedBox, | ||
using: .init(data: symmetricKeyData), | ||
authenticating: additionalAuthData | ||
) | ||
|
||
let plaintext = String(data: decrypted, encoding: .utf8)! | ||
XCTAssertEqual(plaintext, "Guten tag Joe! My nukes are 100 miles south west of Münich, don't tell anyone") | ||
} | ||
|
||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 0 additions & 22 deletions
22
Tests/EllipticCurveKitTests/SupportingFiles/EllipticCurveKitTests-Info.plist
This file was deleted.
Oops, something went wrong.