Skip to content

Commit e77873c

Browse files
authored
Merge pull request #1077 from krzyzanowskim/fix/tests-bytes
fix tests not passing after #1076
2 parents 2c06f88 + 57d79e7 commit e77873c

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

Tests/CryptoSwiftTests/ASN1Tests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ final class ASN1Tests: XCTestCase {
204204

205205
// Ensure the re-encoded data matches the original exactly
206206
XCTAssertEqual(Data(encoded), publicDERData)
207-
XCTAssertEqual(encoded, publicDERData.bytes)
207+
XCTAssertEqual(encoded, publicDERData.byteArray)
208208
XCTAssertEqual(encoded.toBase64(), publicDER)
209209
}
210210

@@ -328,7 +328,7 @@ final class ASN1Tests: XCTestCase {
328328

329329
// Ensure the re-encoded data matches the original data exactly
330330
XCTAssertEqual(Data(encodedData), privateDERData)
331-
XCTAssertEqual(encodedData, privateDERData.bytes)
331+
XCTAssertEqual(encodedData, privateDERData.byteArray)
332332
XCTAssertEqual(encodedData.toBase64(), privateDER.replacingOccurrences(of: "\n", with: ""))
333333
}
334334

@@ -506,7 +506,7 @@ final class ASN1Tests: XCTestCase {
506506

507507
// Ensure the re-encoded data matches the original data exactly
508508
XCTAssertEqual(Data(encodedData), pemData)
509-
XCTAssertEqual(encodedData, pemData.bytes)
509+
XCTAssertEqual(encodedData, pemData.byteArray)
510510
XCTAssertEqual(encodedData.toBase64(), encryptedPEMFormat.replacingOccurrences(of: "\n", with: ""))
511511
}
512512

Tests/CryptoSwiftTests/RSASecKeyTests.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -282,33 +282,33 @@
282282

283283
let skSignature = try secKeySign(messageToSign.bytes, variant: .rsaSignatureMessagePKCS1v15SHA256, withKey: rsaSecKey)
284284

285-
XCTAssertEqual(csSignature, skSignature.bytes, "Signatures don't match!")
285+
XCTAssertEqual(csSignature, skSignature.byteArray, "Signatures don't match!")
286286

287287
// Ensure we can verify each signature using the opposite library
288-
XCTAssertTrue(try rsaCryptoSwift.verify(signature: skSignature.bytes, for: messageToSign.bytes, variant: .message_pkcs1v15_SHA256))
288+
XCTAssertTrue(try rsaCryptoSwift.verify(signature: skSignature.byteArray, for: messageToSign.bytes, variant: .message_pkcs1v15_SHA256))
289289
XCTAssertTrue(try self.secKeyVerify(csSignature, forBytes: messageToSign.bytes, usingVariant: .rsaSignatureMessagePKCS1v15SHA256, withKey: rsaSecKey))
290290

291291
// Encrypt with SecKey
292292
let skEncryption = try secKeyEncrypt(messageToSign.bytes, usingVariant: .rsaEncryptionRaw, withKey: rsaSecKey)
293293
// Decrypt with CryptoSwift Key
294-
XCTAssertEqual(try rsaCryptoSwift.decrypt(skEncryption.bytes, variant: .raw), messageToSign.bytes, "CryptoSwift Decryption of SecKey Encryption Failed")
294+
XCTAssertEqual(try rsaCryptoSwift.decrypt(skEncryption.byteArray, variant: .raw), messageToSign.bytes, "CryptoSwift Decryption of SecKey Encryption Failed")
295295

296296
// Encrypt with CryptoSwift
297297
let csEncryption = try rsaCryptoSwift.encrypt(messageToSign.bytes, variant: .raw)
298298
// Decrypt with SecKey
299-
XCTAssertEqual(try self.secKeyDecrypt(csEncryption, usingVariant: .rsaEncryptionRaw, withKey: rsaSecKey).bytes, messageToSign.bytes, "SecKey Decryption of CryptoSwift Encryption Failed")
299+
XCTAssertEqual(try self.secKeyDecrypt(csEncryption, usingVariant: .rsaEncryptionRaw, withKey: rsaSecKey).byteArray, messageToSign.bytes, "SecKey Decryption of CryptoSwift Encryption Failed")
300300

301-
XCTAssertEqual(csEncryption, skEncryption.bytes, "Encrypted Data Does Not Match")
301+
XCTAssertEqual(csEncryption, skEncryption.byteArray, "Encrypted Data Does Not Match")
302302

303303
// Encrypt with SecKey
304304
let skEncryption2 = try secKeyEncrypt(messageToSign.bytes, usingVariant: .rsaEncryptionPKCS1, withKey: rsaSecKey)
305305
// Decrypt with CryptoSwift Key
306-
XCTAssertEqual(try rsaCryptoSwift.decrypt(skEncryption2.bytes, variant: .pksc1v15), messageToSign.bytes, "CryptoSwift Decryption of SecKey Encryption Failed")
306+
XCTAssertEqual(try rsaCryptoSwift.decrypt(skEncryption2.byteArray, variant: .pksc1v15), messageToSign.bytes, "CryptoSwift Decryption of SecKey Encryption Failed")
307307

308308
// Encrypt with CryptoSwift
309309
let csEncryption2 = try rsaCryptoSwift.encrypt(messageToSign.bytes, variant: .pksc1v15)
310310
// Decrypt with SecKey
311-
XCTAssertEqual(try self.secKeyDecrypt(csEncryption2, usingVariant: .rsaEncryptionPKCS1, withKey: rsaSecKey).bytes, messageToSign.bytes, "SecKey Decryption of CryptoSwift Encryption Failed")
311+
XCTAssertEqual(try self.secKeyDecrypt(csEncryption2, usingVariant: .rsaEncryptionPKCS1, withKey: rsaSecKey).byteArray, messageToSign.bytes, "SecKey Decryption of CryptoSwift Encryption Failed")
312312
}
313313
}
314314

0 commit comments

Comments
 (0)