Skip to content

Commit 97d09f2

Browse files
committed
chore: update package version
Signed-off-by: Ricky Saechao <ricky@launchbadge.com>
1 parent e8263fb commit 97d09f2

File tree

8 files changed

+119
-80
lines changed

8 files changed

+119
-80
lines changed

Package.resolved

Lines changed: 84 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 15 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,6 @@
11
// swift-tools-version:5.6
22

3-
/*
4-
* ‌
5-
* Hedera Swift SDK
6-
* ​
7-
* Copyright (C) 2022 - 2024 Hedera Hashgraph, LLC
8-
* ​
9-
* Licensed under the Apache License, Version 2.0 (the "License");
10-
* you may not use this file except in compliance with the License.
11-
* You may obtain a copy of the License at
12-
*
13-
* http://www.apache.org/licenses/LICENSE-2.0
14-
*
15-
* Unless required by applicable law or agreed to in writing, software
16-
* distributed under the License is distributed on an "AS IS" BASIS,
17-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18-
* See the License for the specific language governing permissions and
19-
* limitations under the License.
20-
* ‍
21-
*/
3+
// SPDX-License-Identifier: Apache-2.0
224

235
import PackageDescription
246

@@ -84,26 +66,25 @@ let exampleTargets = [
8466
let package = Package(
8567
name: "Hiero",
8668
platforms: [
87-
.macOS(.v10_15),
69+
.macOS(.v11),
8870
.iOS(.v13),
8971
],
9072
products: [
9173
.library(name: "Hiero", targets: ["Hiero"])
9274
],
9375
dependencies: [
94-
.package(url: "https://github.com/objecthub/swift-numberkit.git", from: "2.5.1"),
95-
.package(url: "https://github.com/thebarndog/swift-dotenv.git", from: "1.0.0"),
96-
.package(url: "https://github.com/grpc/grpc-swift.git", from: "1.23.0"),
97-
.package(url: "https://github.com/apple/swift-protobuf.git", from: "1.29.0"),
98-
.package(url: "https://github.com/vsanthanam/AnyAsyncSequence.git", from: "1.0.0"),
99-
.package(url: "https://github.com/apple/swift-atomics.git", from: "1.1.0"),
100-
// swift-asn1 wants swift 5.7+ past 0.4
101-
.package(url: "https://github.com/apple/swift-asn1.git", .upToNextMinor(from: "0.3.0")),
102-
.package(url: "https://github.com/GigaBitcoin/secp256k1.swift.git", .upToNextMinor(from: "0.12.0")),
103-
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"),
104-
.package(url: "https://github.com/pointfreeco/swift-snapshot-testing.git", from: "1.0.0"),
105-
.package(url: "https://github.com/vapor/vapor.git", from: "4.101.3"),
106-
.package(url: "https://github.com/attaswift/BigInt.git", from: "5.2.0"),
76+
.package(url: "https://github.com/objecthub/swift-numberkit.git", from: "2.6.0"),
77+
.package(url: "https://github.com/thebarndog/swift-dotenv.git", from: "2.1.0"),
78+
.package(url: "https://github.com/grpc/grpc-swift.git", from: "1.24.2"),
79+
.package(url: "https://github.com/apple/swift-protobuf.git", from: "1.28.2"),
80+
.package(url: "https://github.com/vsanthanam/AnyAsyncSequence.git", from: "1.0.2"),
81+
.package(url: "https://github.com/apple/swift-atomics.git", from: "1.2.0"),
82+
.package(url: "https://github.com/apple/swift-asn1.git", from: "1.3.1"),
83+
.package(url: "https://github.com/GigaBitcoin/secp256k1.swift.git", from: "0.18.0"),
84+
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.4.3"),
85+
.package(url: "https://github.com/pointfreeco/swift-snapshot-testing.git", from: "1.18.0"),
86+
.package(url: "https://github.com/vapor/vapor.git", from: "4.112.0"),
87+
.package(url: "https://github.com/attaswift/BigInt.git", from: "5.5.1"),
10788
// Currently, only used for keccak256
10889
.package(url: "https://github.com/krzyzanowskim/OpenSSL-Package.git", from: "3.3.2000"),
10990
],
@@ -122,6 +103,7 @@ let package = Package(
122103
// weird name, but whatever, internal targets
123104
.target(
124105
name: "HieroExampleUtilities",
106+
dependencies: ["Hiero"],
125107
resources: [.process("Resources")]
126108
),
127109
.target(

Sources/Hiero/Crypto/Pkcs5.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,14 @@ extension Pkcs5.EncryptionScheme: DERImplicitlyTaggable {
6161
let algId = try Pkcs5.AlgorithmIdentifier(derEncoded: derEncoded, withIdentifier: identifier)
6262

6363
guard let parameters = algId.parameters else {
64-
throw ASN1Error.invalidASN1Object
64+
throw ASN1Error.invalidASN1Object(reason: "HMAC algorithm requires NULL parameters")
6565
}
6666

6767
switch algId.oid {
6868
case .AlgorithmIdentifier.pbes2:
6969
self = .pbes2(try Pkcs5.Pbes2Parameters(asn1Any: parameters))
7070
default:
71-
throw ASN1Error.invalidASN1Object
71+
throw ASN1Error.invalidASN1Object(reason: "unsupported algorithm identifier: \(algId.oid)")
7272
}
7373
}
7474

Sources/Hiero/Crypto/Pkcs5Pbes2.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ extension Pkcs5.Pbes2Kdf: DERImplicitlyTaggable {
4242
let algId = try Pkcs5.AlgorithmIdentifier(derEncoded: derEncoded, withIdentifier: identifier)
4343

4444
guard let params = algId.parameters else {
45-
throw ASN1Error.invalidASN1Object
45+
throw ASN1Error.invalidASN1Object(reason: "PBES2 requires key derivation and encryption parameters")
4646
}
4747

4848
switch algId.oid {
4949
case .AlgorithmIdentifier.pbkdf2:
5050
self = .pbkdf2(try Pkcs5.Pbkdf2Parameters(asn1Any: params))
5151
default:
52-
throw ASN1Error.invalidASN1Object
52+
throw ASN1Error.invalidASN1Object(reason: "unsupported algorithm identifier: \(algId.oid)")
5353
}
5454
}
5555

@@ -82,19 +82,19 @@ extension Pkcs5.Pbes2EncryptionScheme: DERImplicitlyTaggable {
8282
let algId = try Pkcs5.AlgorithmIdentifier(derEncoded: derEncoded, withIdentifier: identifier)
8383

8484
guard let params = algId.parameters else {
85-
throw ASN1Error.invalidASN1Object
85+
throw ASN1Error.invalidASN1Object(reason: "PBES2 requires key derivation and encryption parameters")
8686
}
8787

8888
switch algId.oid {
8989
case .AlgorithmIdentifier.aes128CbcPad:
9090
let params = try ASN1OctetString(asn1Any: params)
9191
guard params.bytes.count == 16 else {
92-
throw ASN1Error.invalidASN1Object
92+
throw ASN1Error.invalidASN1Object(reason: "AES-128-CBC requires a 16-byte initialization vector")
9393
}
9494

9595
self = .aes128Cbc(Data(params.bytes))
9696
default:
97-
throw ASN1Error.invalidASN1Object
97+
throw ASN1Error.invalidASN1Object(reason: "unsupported algorithm identifier: \(algId.oid)")
9898
}
9999
}
100100

Sources/Hiero/Crypto/Pkcs5Pbkdf2.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ extension Pkcs5.Pbkdf2Prf: DERImplicitlyTaggable {
172172

173173
// these specifically want `null` as in, not missing.
174174
guard let params = algId.parameters else {
175-
throw ASN1Error.invalidASN1Object
175+
throw ASN1Error.invalidASN1Object(reason: "HMAC algorithm requires NULL parameters")
176176
}
177177

178178
_ = try ASN1Null(asn1Any: params)
@@ -183,7 +183,7 @@ extension Pkcs5.Pbkdf2Prf: DERImplicitlyTaggable {
183183
case .DigestAlgorithm.hmacWithSha256: self = .hmacWithSha256
184184
case .DigestAlgorithm.hmacWithSha384: self = .hmacWithSha384
185185
case .DigestAlgorithm.hmacWithSha512: self = .hmacWithSha512
186-
default: throw ASN1Error.invalidASN1Object
186+
default: throw ASN1Error.invalidASN1Object(reason: "unsupported algorithm identifier: \(algId.oid)")
187187
}
188188
}
189189

@@ -210,7 +210,10 @@ extension Pkcs5.Pbkdf2Parameters: DERImplicitlyTaggable {
210210
guard
211211
let value = Self(salt: Data(salt.bytes), iterationCount: iterationCount, keyLength: keyLength, prf: prf)
212212
else {
213-
throw ASN1Error.invalidASN1Object
213+
throw ASN1Error.invalidASN1Object(
214+
reason:
215+
"Invalid PBKDF2 parameters: iteration count must be between 1 and 10,000,000, and key length must be at least 1 if specified"
216+
)
214217
}
215218

216219
return value

0 commit comments

Comments
 (0)