Skip to content
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch: # allow manually-triggered runs

jobs:
build:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch: # allow manually-triggered runs

jobs:
build:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch: # allow manually-triggered runs

jobs:
build:
Expand Down
4 changes: 3 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ let package = Package(
)
],
targets: [
.target(name: "CryptoSwift", resources: [.copy("PrivacyInfo.xcprivacy")]),
.target(name: "CryptoSwiftResources", resources: [ Resource.copy("PrivacyInfo.xcprivacy") ]),
.target(name: "CryptoSwift",
dependencies: [ .target(name: "CryptoSwiftResources", condition: .when(platforms: [ .iOS, .macOS, .tvOS, .watchOS, .macCatalyst, .visionOS ])) ]),
.testTarget(name: "CryptoSwiftTests", dependencies: ["CryptoSwift"])
],
swiftLanguageVersions: [.v5]
Expand Down
4 changes: 4 additions & 0 deletions Sources/CryptoSwift/AEAD/AEADXChaCha20Poly1305.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
// - This notice may not be removed or altered from any source or binary distribution.
//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

/// This class implements the XChaCha20-Poly1305 Authenticated Encryption with
/// Associated Data (AEAD_XCHACHA20_POLY1305) construction, providing both encryption and authentication.
Expand Down
4 changes: 4 additions & 0 deletions Sources/CryptoSwift/ASN1/ASN1.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@
//
// ASN1 Code inspired by Asn1Parser.swift from SwiftyRSA

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

/// A Partial ASN.1 (Abstract Syntax Notation 1) Encoder & Decoder Implementation.
///
Expand Down
4 changes: 4 additions & 0 deletions Sources/CryptoSwift/ASN1/ASN1Decoder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@
//
// ASN1 Code inspired by Asn1Parser.swift from SwiftyRSA

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

extension ASN1 {
/// A simple ASN1 parser that will recursively iterate over a root node and return a Node tree.
Expand Down
4 changes: 4 additions & 0 deletions Sources/CryptoSwift/ASN1/ASN1Encoder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@
//
// ASN1 Code inspired by Asn1Parser.swift from SwiftyRSA

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

extension ASN1 {
enum Encoder {
Expand Down
4 changes: 4 additions & 0 deletions Sources/CryptoSwift/ASN1/ASN1Scanner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@
//
// ASN1 Scanner code is from Asn1Parser.swift from SwiftyRSA

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

extension ASN1 {
/// Simple data scanner that consumes bytes from a raw data and keeps an updated position.
Expand Down
4 changes: 4 additions & 0 deletions Sources/CryptoSwift/CS_BigInt/Comparable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
// Copyright © 2016-2017 Károly Lőrentey.
//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

extension CS.BigUInt: Comparable {
//MARK: Comparison
Expand Down
4 changes: 4 additions & 0 deletions Sources/CryptoSwift/CS_BigInt/DataConversion.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
// Copyright © 2016-2017 Károly Lőrentey.
//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

extension CS.BigUInt {
//MARK: NSData Conversion
Expand Down
4 changes: 4 additions & 0 deletions Sources/CryptoSwift/Foundation/AES+Foundation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
// - This notice may not be removed or altered from any source or binary distribution.
//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

extension AES {
/// Initialize with CBC block mode.
Expand Down
4 changes: 4 additions & 0 deletions Sources/CryptoSwift/Foundation/Array+Foundation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
// - This notice may not be removed or altered from any source or binary distribution.
//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

public extension Array where Element == UInt8 {
func toBase64(options: Data.Base64EncodingOptions = []) -> String {
Expand Down
4 changes: 4 additions & 0 deletions Sources/CryptoSwift/Foundation/Blowfish+Foundation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
// - This notice may not be removed or altered from any source or binary distribution.
//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

extension Blowfish {
/// Initialize with CBC block mode.
Expand Down
4 changes: 4 additions & 0 deletions Sources/CryptoSwift/Foundation/ChaCha20+Foundation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
// - This notice may not be removed or altered from any source or binary distribution.
//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

extension ChaCha20 {
public convenience init(key: String, iv: String) throws {
Expand Down
4 changes: 4 additions & 0 deletions Sources/CryptoSwift/Foundation/Data+Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
// - This notice may not be removed or altered from any source or binary distribution.
//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

extension Data {
/// Two octet checksum as defined in RFC-4880. Sum of all octets, mod 65536
Expand Down
4 changes: 4 additions & 0 deletions Sources/CryptoSwift/Foundation/HMAC+Foundation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
// - This notice may not be removed or altered from any source or binary distribution.
//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

extension HMAC {
public convenience init(key: String, variant: HMAC.Variant = .md5) throws {
Expand Down
4 changes: 4 additions & 0 deletions Sources/CryptoSwift/Foundation/Rabbit+Foundation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
// - This notice may not be removed or altered from any source or binary distribution.
//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

extension Rabbit {
public convenience init(key: String) throws {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
// - This notice may not be removed or altered from any source or binary distribution.
//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

extension String {
/// Return Base64 back to String
Expand Down
4 changes: 4 additions & 0 deletions Sources/CryptoSwift/Foundation/Utils+Foundation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
// - This notice may not be removed or altered from any source or binary distribution.
//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

func perf(_ text: String, closure: () -> Void) {
let measurementStart = Date()
Expand Down
4 changes: 4 additions & 0 deletions Sources/CryptoSwift/Foundation/XChaCha20+Foundation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
// - This notice may not be removed or altered from any source or binary distribution.
//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

extension XChaCha20 {
/// Convenience initializer that creates an XChaCha20 instance with the given key and IV
Expand Down
4 changes: 4 additions & 0 deletions Sources/CryptoSwift/ISO10126Padding.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
// - This notice may not be removed or altered from any source or binary distribution.
//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

/// Padding with random bytes, ending with the number of added bytes.
/// Read the [Wikipedia](https://en.wikipedia.org/wiki/Padding_(cryptography)#ISO_10126)
Expand Down
4 changes: 4 additions & 0 deletions Sources/CryptoSwift/ISO78164Padding.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
// - This notice may not be removed or altered from any source or binary distribution.
//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

// First byte is 0x80, rest is zero padding
// http://www.crypto-it.net/eng/theory/padding.html
Expand Down
4 changes: 4 additions & 0 deletions Sources/CryptoSwift/PEM/DER.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
// - This notice may not be removed or altered from any source or binary distribution.
//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

/// Conform to this protocol if your type can both be instantiated and expressed as an ASN1 DER representation.
internal protocol DERCodable: DERDecodable, DEREncodable { }
Expand Down
4 changes: 4 additions & 0 deletions Sources/CryptoSwift/RSA/RSA+Cipher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
// - This notice may not be removed or altered from any source or binary distribution.
//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

// MARK: Cipher

Expand Down
4 changes: 4 additions & 0 deletions Sources/CryptoSwift/RSA/RSA+Signature.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
// - This notice may not be removed or altered from any source or binary distribution.
//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

// MARK: Signatures & Verification

Expand Down
4 changes: 4 additions & 0 deletions Sources/CryptoSwift/RSA/RSA.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@
//

// Foundation is required for `Data` to be found
#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

// Note: The `BigUInt` struct was copied from:
// https://github.com/attaswift/BigInt
Expand Down
4 changes: 4 additions & 0 deletions Sources/CryptoSwift/String+Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
// - This notice may not be removed or altered from any source or binary distribution.
//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

/** String extension */
extension String {
Expand Down
4 changes: 4 additions & 0 deletions Sources/CryptoSwift/UInt128.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
// - This notice may not be removed or altered from any source or binary distribution.
//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

struct UInt128: Equatable, ExpressibleByIntegerLiteral {
let i: (a: UInt64, b: UInt64)
Expand Down
1 change: 1 addition & 0 deletions Sources/CryptoSwiftResources/Empty.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

5 changes: 5 additions & 0 deletions Tests/CryptoSwiftTests/AESCCMTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@
// - This notice may not be removed or altered from any source or binary distribution.
//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

import XCTest
@testable import CryptoSwift

Expand Down
5 changes: 5 additions & 0 deletions Tests/CryptoSwiftTests/AESOCBTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@
// - This notice may not be removed or altered from any source or binary distribution.
//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

import XCTest
@testable import CryptoSwift

Expand Down
5 changes: 5 additions & 0 deletions Tests/CryptoSwiftTests/AESTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@
// - This notice may not be removed or altered from any source or binary distribution.
//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

import XCTest
@testable import CryptoSwift

Expand Down
5 changes: 5 additions & 0 deletions Tests/CryptoSwiftTests/AESTestsPerf.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@
// - This notice may not be removed or altered from any source or binary distribution.
//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

import XCTest
@testable import CryptoSwift

Expand Down
Loading