Przeglądaj źródła

fix tests not passing after #1076

NathanFallet 1 miesiąc temu
rodzic
commit
57d79e7f6f

+ 3 - 3
Tests/CryptoSwiftTests/ASN1Tests.swift

@@ -204,7 +204,7 @@ final class ASN1Tests: XCTestCase {
 
     // Ensure the re-encoded data matches the original exactly
     XCTAssertEqual(Data(encoded), publicDERData)
-    XCTAssertEqual(encoded, publicDERData.bytes)
+    XCTAssertEqual(encoded, publicDERData.byteArray)
     XCTAssertEqual(encoded.toBase64(), publicDER)
   }
 
@@ -328,7 +328,7 @@ final class ASN1Tests: XCTestCase {
 
     // Ensure the re-encoded data matches the original data exactly
     XCTAssertEqual(Data(encodedData), privateDERData)
-    XCTAssertEqual(encodedData, privateDERData.bytes)
+    XCTAssertEqual(encodedData, privateDERData.byteArray)
     XCTAssertEqual(encodedData.toBase64(), privateDER.replacingOccurrences(of: "\n", with: ""))
   }
 
@@ -506,7 +506,7 @@ final class ASN1Tests: XCTestCase {
 
     // Ensure the re-encoded data matches the original data exactly
     XCTAssertEqual(Data(encodedData), pemData)
-    XCTAssertEqual(encodedData, pemData.bytes)
+    XCTAssertEqual(encodedData, pemData.byteArray)
     XCTAssertEqual(encodedData.toBase64(), encryptedPEMFormat.replacingOccurrences(of: "\n", with: ""))
   }
 

+ 7 - 7
Tests/CryptoSwiftTests/RSASecKeyTests.swift

@@ -282,33 +282,33 @@
 
         let skSignature = try secKeySign(messageToSign.bytes, variant: .rsaSignatureMessagePKCS1v15SHA256, withKey: rsaSecKey)
 
-        XCTAssertEqual(csSignature, skSignature.bytes, "Signatures don't match!")
+        XCTAssertEqual(csSignature, skSignature.byteArray, "Signatures don't match!")
 
         // Ensure we can verify each signature using the opposite library
-        XCTAssertTrue(try rsaCryptoSwift.verify(signature: skSignature.bytes, for: messageToSign.bytes, variant: .message_pkcs1v15_SHA256))
+        XCTAssertTrue(try rsaCryptoSwift.verify(signature: skSignature.byteArray, for: messageToSign.bytes, variant: .message_pkcs1v15_SHA256))
         XCTAssertTrue(try self.secKeyVerify(csSignature, forBytes: messageToSign.bytes, usingVariant: .rsaSignatureMessagePKCS1v15SHA256, withKey: rsaSecKey))
 
         // Encrypt with SecKey
         let skEncryption = try secKeyEncrypt(messageToSign.bytes, usingVariant: .rsaEncryptionRaw, withKey: rsaSecKey)
         // Decrypt with CryptoSwift Key
-        XCTAssertEqual(try rsaCryptoSwift.decrypt(skEncryption.bytes, variant: .raw), messageToSign.bytes, "CryptoSwift Decryption of SecKey Encryption Failed")
+        XCTAssertEqual(try rsaCryptoSwift.decrypt(skEncryption.byteArray, variant: .raw), messageToSign.bytes, "CryptoSwift Decryption of SecKey Encryption Failed")
 
         // Encrypt with CryptoSwift
         let csEncryption = try rsaCryptoSwift.encrypt(messageToSign.bytes, variant: .raw)
         // Decrypt with SecKey
-        XCTAssertEqual(try self.secKeyDecrypt(csEncryption, usingVariant: .rsaEncryptionRaw, withKey: rsaSecKey).bytes, messageToSign.bytes, "SecKey Decryption of CryptoSwift Encryption Failed")
+        XCTAssertEqual(try self.secKeyDecrypt(csEncryption, usingVariant: .rsaEncryptionRaw, withKey: rsaSecKey).byteArray, messageToSign.bytes, "SecKey Decryption of CryptoSwift Encryption Failed")
 
-        XCTAssertEqual(csEncryption, skEncryption.bytes, "Encrypted Data Does Not Match")
+        XCTAssertEqual(csEncryption, skEncryption.byteArray, "Encrypted Data Does Not Match")
 
         // Encrypt with SecKey
         let skEncryption2 = try secKeyEncrypt(messageToSign.bytes, usingVariant: .rsaEncryptionPKCS1, withKey: rsaSecKey)
         // Decrypt with CryptoSwift Key
-        XCTAssertEqual(try rsaCryptoSwift.decrypt(skEncryption2.bytes, variant: .pksc1v15), messageToSign.bytes, "CryptoSwift Decryption of SecKey Encryption Failed")
+        XCTAssertEqual(try rsaCryptoSwift.decrypt(skEncryption2.byteArray, variant: .pksc1v15), messageToSign.bytes, "CryptoSwift Decryption of SecKey Encryption Failed")
 
         // Encrypt with CryptoSwift
         let csEncryption2 = try rsaCryptoSwift.encrypt(messageToSign.bytes, variant: .pksc1v15)
         // Decrypt with SecKey
-        XCTAssertEqual(try self.secKeyDecrypt(csEncryption2, usingVariant: .rsaEncryptionPKCS1, withKey: rsaSecKey).bytes, messageToSign.bytes, "SecKey Decryption of CryptoSwift Encryption Failed")
+        XCTAssertEqual(try self.secKeyDecrypt(csEncryption2, usingVariant: .rsaEncryptionPKCS1, withKey: rsaSecKey).byteArray, messageToSign.bytes, "SecKey Decryption of CryptoSwift Encryption Failed")
       }
     }