Skip to content

Commit

Permalink
fix: Build issue
Browse files Browse the repository at this point in the history
  • Loading branch information
amosavian committed Dec 25, 2023
1 parent 7f3268f commit 0558a4e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions Sources/JWSETKit/Cryptography/RSA/JWK-RSA.swift
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,14 @@ public struct JSONWebRSAPrivateKey: MutableJSONWebKey, JSONWebSigningKey, JSONWe
}

public init(algorithm _: any JSONWebAlgorithm) throws {
try self.init(bitCount: .bits2048)
try self.init(keySize: .bits2048)
}

public init(bitCount: KeySize) throws {
public init(keySize: KeySize) throws {
#if canImport(CommonCrypto)
self.storage = try SecKey(rsaBitCounts: bitCount.bitCount).storage
self.storage = try SecKey(rsaBitCounts: keySize.bitCount).storage
#elseif canImport(_CryptoExtras)
self.storage = try _RSA.Signing.PrivateKey(keySize: .init(bitCount: bitCount)).storage
self.storage = try _RSA.Signing.PrivateKey(keySize: .init(bitCount: keySize.bitCount)).storage
#else
// This should never happen as CommonCrypto is available on Darwin platforms
// and CryptoExtras is used on non-Darwin platform.
Expand Down
4 changes: 2 additions & 2 deletions Tests/JWSETKitTests/Cryptography/RSATests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ final class RSATests: XCTestCase {
}

func testSigning_RSA3072_PSS_SHA256() throws {
let privateKey = try JSONWebRSAPrivateKey(bitCount: .bits3072)
let privateKey = try JSONWebRSAPrivateKey(keySize: .bits3072)
let publicKey = privateKey.publicKey

let signature = try privateKey.signature(plaintext, using: .rsaSignaturePSSSHA256)
Expand All @@ -190,7 +190,7 @@ final class RSATests: XCTestCase {
}

func testSigning_RSA4096_PSS_SHA256() throws {
let privateKey = try JSONWebRSAPrivateKey(bitCount: .bits4096)
let privateKey = try JSONWebRSAPrivateKey(keySize: .bits4096)
let publicKey = privateKey.publicKey

let signature = try privateKey.signature(plaintext, using: .rsaSignaturePSSSHA256)
Expand Down

0 comments on commit 0558a4e

Please sign in to comment.