Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Tests/CryptoSwiftTests/RSATests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ final class RSATests: XCTestCase {
let fixture = TestFixtures.RSA_1024

guard let privateDERData = Data(base64Encoded: fixture.privateDER) else {
XCTFail("Invalid Base64String Public DER")
XCTFail("Invalid Base64String Private DER")
return
}

Expand Down Expand Up @@ -273,7 +273,7 @@ final class RSATests: XCTestCase {
let fixture = TestFixtures.RSA_1024

guard let privateDERData = Data(base64Encoded: fixture.privateDER) else {
XCTFail("Invalid Base64String Public DER")
XCTFail("Invalid Base64String Private DER")
return
}

Expand Down Expand Up @@ -324,14 +324,14 @@ final class RSATests: XCTestCase {
let fixture = TestFixtures.RSA_1024

guard let privateDERData = Data(base64Encoded: fixture.privateDER) else {
XCTFail("Invalid Base64String Public DER")
XCTFail("Invalid Base64String Private DER")
return
}

// Import RSA Key
let rsa = try RSA(rawRepresentation: privateDERData)

let message = Data("This is a long message that if not hashed, will be tool large to safely sign / encrypt, therefore it should throw an error instead of resulting in a signature".utf8).byteArray
let message = Data("This is a long message that if not hashed, will be too large to safely sign / encrypt, therefore it should throw an error instead of resulting in a signature".utf8).byteArray

// The unhashed message is too long to sign, we expect an error to be thrown...
XCTAssertThrowsError(try rsa.sign(message, variant: .digest_pkcs1v15_SHA1))
Expand Down Expand Up @@ -367,7 +367,7 @@ final class RSATests: XCTestCase {
/// - Ensure the key was imported correctly
/// - Ensure that we can export the public key in it's DER representation and that it matches the expected data
/// - Ensure that we are able to encrypt the messages and that we receive the same data when testing deterministic encryption variants
/// - Ensure that attempting to decrypt a message without a private key throws and error
/// - Ensure that attempting to decrypt a message without a private key throws an error
/// - Ensure that attempting to sign data without a private key throws an error
/// - Ensure that we can verify that the signed data was in fact signed with this public keys corresponding private key
/// 2) Importing the RSA Private DER Representation
Expand Down Expand Up @@ -548,7 +548,7 @@ final class RSATests: XCTestCase {
continue
}

// Our Message is too long for some of our hashing / padding schemes. When this happens we should encouter an error and our test value should be empty.
// Our Message is too long for some of our hashing / padding schemes. When this happens we should encounter an error and our test value should be empty.
if test.value == "" {
XCTAssertThrowsError(try rsa.sign(message.key.bytes, variant: variant), "Signature<\(test.key)>::Did not throw error")
} else {
Expand Down