588 Commits
Author SHA1 Message Date
Gonçalo Frade 8bcf97a8ae Merge branch 'main' into fix/rsa_private_key 2025-02-17 13:03:13 +00:00
sunxunle 03d3470ec3 chore: fix some typos in comment
Signed-off-by: sunxunle <sunxunle@ampere.tech>
2025-01-20 16:12:04 +08:00
Marc Prud'hommeaux 1e30a615e5 Add Android support 2025-01-04 21:42:28 -05:00
Marcin Krzyzanowski 68e5d06af3 Update copyright years to 2025
The copyright years in source files and tests have been updated from 2022 to 2025 across the project.
2024-12-23 13:20:39 +01:00
Goncalo Frade cd7d4abee2 fix: externalRepresentation condition to validate if key is private should be d not prime
I got to this issue recently where the library was giving me a public key DER when the key had a d and no primes,
this is misleading since an RSA key can have d and no primes.
This function should acess if the key is private through the d, if it requires the primes it should return an error.

As part of this PR I also made the primes public, they are already a let, making them public makes the API more
accessible to deal for example if I want to build a JWK with primes included.
2024-12-06 12:52:45 +00:00
YinYuGuang 7c68455671 Support for Static Linux SDK Based on Musl Instead of Glibc 2024-12-05 11:59:39 +08:00
Marcin Krzyzanowski 47ed1f38ab Merge pull request #1050 from dropbigfish/main
chore: fix some comments
2024-10-15 17:47:53 +02:00
dropbigfish c1d9917087 chore: fix some comments
Signed-off-by: dropbigfish <fillfish@foxmail.com>
2024-09-01 00:42:15 +08:00
Elias Rad 4c6875be6b fix GCM.swift
Signed-off-by: Elias Rad <146735585+nnsW3@users.noreply.github.com>
2024-08-24 14:40:55 +03:00
Elias Rad 1f54c16f4c fix ASN1.swift
Signed-off-by: Elias Rad <146735585+nnsW3@users.noreply.github.com>
2024-08-24 14:27:20 +03:00
Marcin Krzyzanowski 03dedca982 Remove space 2024-06-13 15:20:45 +02:00
Adin Cebic c23c2659c4 Remove whitespaces from file names 2024-05-03 12:54:03 +02:00
Marcin Krzyzanowski aa90fb447c Throw error instead of fatal error 2024-01-08 00:41:15 +01:00
Marcin Krzyzanowski 037646a371 Merge pull request #1027 from LabMobi/RSA-PKCS1-SHA3-signature-verification
Rsa pkcs1 sha3 signature verification
2024-01-08 00:19:21 +01:00
Marcin Krzyzanowski d7de7d73e8 Add PrivacyInfo.xcprivacy 2024-01-08 00:11:52 +01:00
WFrost3 6a52aa2954 Update publicKeyDER to support exponent of any byte length
Signed-off-by: WFrost3 <134406901+WFrost3@users.noreply.github.com>
2023-11-15 08:50:19 +00:00
Katrin Annuk ba651dbef6 Update formatting 2023-11-13 19:00:47 +02:00
Katrin Annuk bb205b1499 Update formatting 2023-11-13 18:57:56 +02:00
Katrin Annuk 5175133f53 Add unit tests for SHA3 signature verification 2023-11-13 18:37:18 +02:00
Katrin Annuk ada999a6e8 Add signature verification for PKCS1 SHA3 variants 2023-11-07 10:48:19 +02:00
Matthias Geihs fe41a8f52f address review comment 2023-10-30 12:34:17 +01:00
Matthias Geihs 2b7cb90a85 PKCS7Padding: Remove unreachable if branch
`padding` could never be zero as blockSize > 0 and bytes.count %
blockSize < blockSize.
2023-09-11 16:08:52 +08:00
Zsombor Szabo 45c1a5ea5d Merge branch 'main' into feat/draft-irtf-cfrg-xchacha-03 2023-06-23 15:30:18 -07:00
Marcin Krzyzanowski c80bcc0fa7 Address compiler warning 2023-06-07 23:23:16 +01:00
Zsombor Szabo b82ce81f5b Merge branch 'main' into feat/draft-irtf-cfrg-xchacha-03 2023-05-04 13:19:20 -07:00
Zsombor Szabo c7da0d1108 Validate input 2023-05-04 12:58:57 -07:00
Zsombor Szabo 8c8aff8daa Merge branch 'krzyzanowskim:main' into main 2023-05-03 15:31:35 -07:00
Zsombor Szabo a097b752bb Update access level of RSA(n:e:d:p:q:) initializer to public 2023-05-03 15:30:19 -07:00
JP Simard 6b6e4a34ea Fix warnings with Swift 5.8
There are a few warnings when compiling `main` with Swift 5.8:

```
Sources/CryptoSwift/Scrypt.swift:124:7 'assign(from:count:)' is deprecated: renamed to 'update(from:count:)'
Sources/CryptoSwift/String+Extension.swift:21:5 Instance method 'data(using:allowLossyConversion:)' cannot be used in an '@inlinable' function because 'Foundation' was not imported by this file; this is an error in Swift 6
Sources/CryptoSwift/String+Extension.swift:21:24 Struct 'Encoding' cannot be used in an '@inlinable' function because 'Foundation' was not imported by this file; this is an error in Swift 6
Sources/CryptoSwift/String+Extension.swift:21:33 Static property 'utf8' cannot be used in an '@inlinable' function because 'Foundation' was not imported by this file; this is an error in Swift 6
```

This fixes them all while continuing to support previous Swift compiler
versions.
2023-04-21 09:34:29 -04:00
Zsombor Szabo 31f38545e4 Add XChaCha20 and XChaCha20-Poly1305 (IETF draft-irtf-cfrg-xchacha) 2023-04-19 15:37:05 -07:00
JP Simard 5627b911d7 Mark RSA.RSAEncryptionVariant as @frozen 2022-10-11 14:09:37 -04:00
JP Simard 782caf9690 Fix "Default will never be executed" warnings
when building without library evolution enabled.

Similar to 9850f4cb23.
2022-10-11 12:34:32 -04:00
Marcin Krzyzanowski d636cbf1c3 Add convenience callAsFunction API 2022-10-04 22:21:53 +02:00
Marcin Krzyzanowski aa126f3c45 Add options to base64 encode/decode functions 2022-10-04 22:07:40 +02:00
Marcin Krzyzanowski 6fec996043 Ignore unknown character for base64 decoding 2022-10-04 22:01:23 +02:00
Marcin Krzyzanowski bce847559b Backport upstream fix from https://github.com/attaswift/BigInt/commit/d2d29c1225d96d66c331712cce4eb4510322a243 2022-09-17 18:06:25 +02:00
Marcin Krzyzanowski 3cdf5e0470 README update 2022-09-17 17:58:26 +02:00
Marcin Krzyzanowski 7390485466 Return random values for unhandled/unexpected encryption variants 2022-09-17 17:33:49 +02:00
Brandon Toms 713f0e0ec5 Marked externalRepresentation as public and added the publicKeyExternalRepresentation function 2022-09-17 01:04:14 -07:00
Brandon Toms 306be21542 Added public init(rawRepresentation:) 2022-09-17 01:00:54 -07:00
Brandon Toms e577605744 Removed default implementations 2022-09-17 00:58:53 -07:00
Brandon Toms 70b3ae2073 Added documentation and formatting 2022-09-17 00:58:06 -07:00
Marcin Krzyzanowski bee7ed5f2d Merge pull request #979 from GoodNotes/swiftwasm-support
Make CryptoSwift compilable with SwiftWasm
2022-09-15 15:35:55 +02:00
Brandon Toms 94981bf064 Replaced the while loop with an explicitly defined zero byte array of correct size. 2022-09-01 15:22:44 -07:00
Brandon Toms b85c08698d SwiftFormat. Updated RSA Signature extension to use the new keySizeBytes param where appropriate. 2022-09-01 15:19:00 -07:00
Brandon Toms b628b84927 Replaced while loop with an explicit array addition of the correct size. 2022-09-01 15:16:04 -07:00
Brandon Toms d6f3449a03 SwiftFormat 2022-09-01 15:13:23 -07:00
Brandon Toms 3962cd256e Updated the RSA Cipher extension to use the new keySizeBytes parameter. 2022-09-01 15:12:17 -07:00
Brandon Toms 9a9a0e8a19 Added a keySizeBytes param that stores the minimum bytes needed to express the keys modulus. 2022-09-01 15:11:19 -07:00
Brandon Toms c95b9db830 A more correct implementation of zero prepended block formatting 2022-08-23 16:03:26 -07:00