Skip to content

Commit d7f1eb4

Browse files
committed
Release 2.4.0
1 parent c0e33a5 commit d7f1eb4

File tree

495 files changed

+959
-962
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

495 files changed

+959
-962
lines changed

Package.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ let package = Package(
1414
],
1515
dependencies: [
1616
// Dependencies declare other packages that this package depends on.
17-
.package(url: "https://github.com/leif-ibsen/BigInt", from: "1.15.0"),
18-
.package(url: "https://github.com/leif-ibsen/ASN1", from: "2.3.0"),
19-
.package(url: "https://github.com/leif-ibsen/Digest", from: "1.2.0"),
17+
.package(url: "https://github.com/leif-ibsen/BigInt", from: "1.16.0"),
18+
.package(url: "https://github.com/leif-ibsen/ASN1", from: "2.4.0"),
19+
.package(url: "https://github.com/leif-ibsen/Digest", from: "1.3.0"),
2020
],
2121
targets: [
2222
// Targets are the basic building blocks of a package. A target can define a module or a test suite.

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ including all four modes of operation:
1010

1111
SwiftHPKE requires Swift 5.0. It also requires that the `Int` and `UInt` types be 64 bit types.
1212

13-
Its documentation is build with the DocC tool and published on GitHub Pages at this location:
13+
Its documentation is build with the DocC plugin and published on GitHub Pages at this location:
1414

1515
https://leif-ibsen.github.io/SwiftHPKE/documentation/swifthpke
1616

Sources/SwiftHPKE/AEAD.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import CryptoKit
99

10-
/// AEAD encryption algorithms
10+
/// The AEAD encryption algorithms
1111
public enum AEAD: CustomStringConvertible, CaseIterable {
1212

1313
/// Textual description of `self`

Sources/SwiftHPKE/CipherSuite.swift

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ public typealias Byte = UInt8
1414
/// Array of unsigned 8 bit values
1515
public typealias Bytes = [UInt8]
1616

17-
/// The CipherSuite structure
1817
public struct CipherSuite: CustomStringConvertible {
1918

2019
let kemStructure: KEMStructure

Sources/SwiftHPKE/Exception.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// Created by Leif Ibsen on 18/02/2020.
66
//
77

8-
/// HPKE exceptions
8+
/// The HPKE exceptions
99
public enum HPKEException: Error, CustomStringConvertible {
1010

1111
/// Textual description of `self`

Sources/SwiftHPKE/KDF.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import Digest
99

10-
/// Key derivation functions
10+
/// The key derivation functions
1111
public enum KDF: CustomStringConvertible, CaseIterable {
1212

1313
/// Textual description of `self`

Sources/SwiftHPKE/KEM.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import Foundation
99
import BigInt
1010

11-
/// Key encapsulation mechanisms
11+
/// The key encapsulation mechanisms
1212
public enum KEM: CustomStringConvertible, CaseIterable {
1313

1414
/// Textual description of `self`

Sources/SwiftHPKE/PrivateKey.swift

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import ASN1
99
import BigInt
1010

11-
/// The PrivateKey structure
1211
public struct PrivateKey: CustomStringConvertible, Equatable {
1312

1413
let kem: KEM

Sources/SwiftHPKE/PublicKey.swift

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import ASN1
99
import BigInt
1010

11-
/// The PublicKey structure
1211
public struct PublicKey: CustomStringConvertible, Equatable {
1312

1413
let kem: KEM

Sources/SwiftHPKE/Recipient.swift

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
// Created by Leif Ibsen on 19/06/2023.
66
//
77

8-
/// The Recipient class
98
public class Recipient {
109

1110
let suite: CipherSuite

Sources/SwiftHPKE/Sender.swift

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
// Created by Leif Ibsen on 19/06/2023.
66
//
77

8-
/// The Sender class
98
public class Sender {
109

1110
let suite: CipherSuite

Sources/SwiftHPKE/SwiftHPKE.docc/Articles/Basics.md

-25
This file was deleted.

Sources/SwiftHPKE/SwiftHPKE.docc/Articles/CreateKeys.md

-31
This file was deleted.

Sources/SwiftHPKE/SwiftHPKE.docc/Articles/CryptoKit.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
# Apple CryptoKit Compatibility
1+
# CryptoKit Compatibility
2+
3+
SwiftHPKE is compatible with Apple’s CryptoKit framework
24

35
##
46

5-
The SwiftHPKE keys of type `.P256`, `.P384`, `.P521` and `.X25519` correspond to Apple
6-
CryptoKit keys of type `P256`, `P384`, `P521` and `Curve25519`. Keys of type `.X448` is not supported in CryptoKit.
7+
The SwiftHPKE keys of type `.P256`, `.P384`, `.P521` and `.X25519` correspond to CryptoKit keys of type `P256`, `P384`, `P521` and `Curve25519`. Keys of type `.X448` is not supported in CryptoKit.
78

89
To convert CryptoKit `P256` keys (similarly for `P384` and `P521`) - say `ckPriv` and `ckPub` to SwiftHPKE keys:
910

Sources/SwiftHPKE/SwiftHPKE.docc/Articles/Dependencies.md

-12
This file was deleted.

Sources/SwiftHPKE/SwiftHPKE.docc/Articles/EncryptDecrypt.md

-75
This file was deleted.

Sources/SwiftHPKE/SwiftHPKE.docc/Articles/LoadKeys.md Sources/SwiftHPKE/SwiftHPKE.docc/Articles/KeyManagement.md

+37-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,42 @@
1-
# Loading Existing Keys
1+
# Key Management
2+
3+
Creating new keys and loading exsisting keys
24

35
##
6+
7+
### Create new Keys
8+
9+
Given a ``SwiftHPKE/CipherSuite`` instance it is possible to generate new ``SwiftHPKE/PublicKey``'s and ``SwiftHPKE/PrivateKey``'s.
10+
11+
```swift
12+
import SwiftHPKE
13+
14+
let suite = CipherSuite(kem: .X25519, kdf: .KDF256, aead: .CHACHAPOLY)
15+
let (pubKey, privKey) = try suite.makeKeyPair()
16+
17+
// See the key ASN1 structures
18+
19+
print(pubKey)
20+
print(privKey)
21+
```
22+
giving (for example):
23+
```swift
24+
Sequence (2):
25+
Sequence (1):
26+
Object Identifier: 1.3.101.110
27+
Bit String (256): 11100111 11100111 00010111 11110101 10101000 10010101 01001010 00100010 00011010 10001001 11001011 11010001 11101101 10000101 01110101 11011111 11010110 00001101 01001110 10100100 00111011 00110100 01110000 01011000 00111111 01011011 10001010 11111010 01101000 10010011 10100001 00001101
28+
29+
Sequence (3):
30+
Integer: 0
31+
Sequence (1):
32+
Object Identifier: 1.3.101.110
33+
Octet String (34): 04 20 b0 e5 94 7d f8 72 04 8f 90 79 5f d5 b7 e4 6e ca 56 18 58 30 2e 4e 79 83 d6 46 bb 42 70 2a 34 68
34+
```
35+
36+
### Load existing Keys
37+
438
It is possible to load existing keys from their PEM encodings or DER encodings.
5-
### Example
39+
640
```swift
741
import SwiftHPKE
842

@@ -50,3 +84,4 @@ Sequence (3):
5084
Object Identifier: 1.3.132.0.34
5185
Octet String (167): 30 81 a4 02 01 01 04 30 66 a4 dc e2 49 89 86 a1 6c 25 ed aa 49 33 d6 5d 0c 1c 64 26 a9 b1 31 27 07 19 71 b8 e5 94 17 4a fe df 22 e2 65 b1 2c 31 2b be a7 52 28 8e ee 08 a0 07 06 05 2b 81 04 00 22 a1 64 03 62 00 04 41 6f cc 6a 13 30 31 31 63 c1 8f 79 b8 e1 1d 7c 15 42 ec 7a d0 85 31 86 4f 0c 62 3e 58 03 88 04 6a 0b ac ba 11 0d 40 8e 4b a1 7b 80 34 d9 63 a5 b5 16 10 45 72 b2 b7 3b 29 39 1d b9 51 f8 2d 6a 05 11 03 0c 55 15 8c d1 f5 c9 a2 e8 54 66 be fa bf 4e c8 a0 77 f7 40 8b 81 4d 8e 78 91 ef f3 e0
5286
```
87+

Sources/SwiftHPKE/SwiftHPKE.docc/Articles/Performance.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Performance
22

3+
Encryption and decryption speed
4+
35
##
46

57
SwiftHPKE's encryption and decryption performance was measured on an iMac 2021, Apple M1 chip.

Sources/SwiftHPKE/SwiftHPKE.docc/Articles/References.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
# References
22

3-
##
3+
Algorithms from the following books and papers have been used in the implementation
44

5-
Algorithms from the following books and papers have been used in the implementation.
6-
There are references in the source code where appropriate.
5+
##
76

87
* [FIPS 180-4] - FIPS PUB 180-4 - Secure Hash Standard (SHS), August 2015
98
* [GUIDE] - Hankerson, Menezes, Vanstone: Guide to Elliptic Curve Cryptography. Springer 2004

Sources/SwiftHPKE/SwiftHPKE.docc/Articles/SecretExport.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
# Secret Export
22

3+
Creating secret messages
4+
35
##
6+
47
Given the recipient's public key, a sender can generate a secret that only the recipient can know.
58

69
### Example 1
10+
711
```swift
812
import SwiftHPKE
913

@@ -29,6 +33,7 @@ Retrieved secret: [172, 169, 119, 121, 167, 53, 213, 12, 0, 29]
2933
```
3034

3135
### Example 2
36+
3237
```swift
3338
import SwiftHPKE
3439

Sources/SwiftHPKE/SwiftHPKE.docc/Articles/Usage.md

-11
This file was deleted.

Sources/SwiftHPKE/SwiftHPKE.docc/Extensions/Base64Ext.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# ``SwiftHPKE/Base64``
22

3+
The Base64 structure
4+
35
## Overview
46

57
Base64 exists to provide a namespace. It contains static methods for Base64 encoding and decoding. There is no Base64 instances.

0 commit comments

Comments
 (0)