MobileCoin-Swift/Tests/Unit/Crypto/VersionedCryptoBoxTests.swift
Kyle Fleming b4ac1178be Big bang
2021-03-15 22:58:02 -10:00

29 lines
857 B
Swift

//
// Copyright (c) 2020-2021 MobileCoin. All rights reserved.
//
@testable import MobileCoin
import XCTest
class VersionedCryptoBoxTests: XCTestCase {
func testEncrypt() throws {
let fixture = VersionedCryptoBox.Fixtures.Default()
let encrypted = try XCTUnwrapSuccess(VersionedCryptoBox.encrypt(
plaintext: fixture.plaintext,
publicKey: fixture.publicKey,
rng: fixture.rng,
rngContext: fixture.rngContext))
XCTAssertEqual(encrypted, fixture.ciphertext)
}
func testDecrypt() throws {
let fixture = VersionedCryptoBox.Fixtures.Default()
let decrypted = try XCTUnwrapSuccess(VersionedCryptoBox.decrypt(
ciphertext: fixture.ciphertext,
privateKey: fixture.privateKey))
XCTAssertEqual(decrypted, fixture.plaintext)
}
}