Skip to content

Commit

Permalink
Release 2.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
leif-ibsen committed Apr 29, 2024
1 parent d7f1eb4 commit 27f656f
Show file tree
Hide file tree
Showing 494 changed files with 1,264 additions and 491 deletions.
6 changes: 3 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ let package = Package(
],
dependencies: [
// Dependencies declare other packages that this package depends on.
.package(url: "https://github.com/leif-ibsen/BigInt", from: "1.16.0"),
.package(url: "https://github.com/leif-ibsen/ASN1", from: "2.4.0"),
.package(url: "https://github.com/leif-ibsen/Digest", from: "1.3.0"),
.package(url: "https://github.com/leif-ibsen/BigInt", from: "1.17.0"),
.package(url: "https://github.com/leif-ibsen/ASN1", from: "2.5.0"),
.package(url: "https://github.com/leif-ibsen/Digest", from: "1.6.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
Expand Down
2 changes: 1 addition & 1 deletion Sources/SwiftHPKE/KEM.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ struct KEMStructure {
self.bitmask = 0xff
case .P384:
let suite_id = Bytes("KEM".utf8) + [0x00, 0x11]
self.kdfStructure = KDFStructure(.KDF256, suite_id)
self.kdfStructure = KDFStructure(.KDF384, suite_id)
self.Nsecret = 48
self.Npk = CurveP384.publicKeySize
self.Nsk = CurveP384.privateKeySize
Expand Down
6 changes: 6 additions & 0 deletions Sources/SwiftHPKE/SwiftHPKE.docc/Articles/CryptoKit.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,9 @@ To convert SwiftHPKE `.X25519` keys - say `hpkePriv` and `hpkePub` to CryptoKit
let ckPriv = try CryptoKit.Curve25519.KeyAgreement.PrivateKey(rawRepresentation: hpkePriv.bytes)
let ckPub = try CryptoKit.Curve25519.KeyAgreement.PublicKey(rawRepresentation: hpkePub.bytes)
```

Messages sealed by CryptoKit in Base mode, Preshared Key mode, Authenticated mode or Authenticated, Preshared Key mode
can be opened by SwiftHPKE in the same mode using the SwiftHPKE version of the keys.

Likewise, messages sealed by SwiftHPKE in Base mode, Preshared Key mode, Authenticated mode or Authenticated, Preshared Key mode
can be opened by CryptoKit in the same mode using the CryptoKit version of the keys.
12 changes: 6 additions & 6 deletions Sources/SwiftHPKE/SwiftHPKE.docc/SwiftHPKE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Hybrid Public Key Encryption

SwiftHPKE implements the Hybrid Public Key Encryption standard as defined in [RFC 9180].

The basic concepts in SwiftHPKE are CipherSuite, Sender and Recipient, represented by the ``SwiftHPKE/CipherSuite`` structure and the ``SwiftHPKE/Sender`` and ``SwiftHPKE/Recipient`` classes.
The basic concepts in SwiftHPKE are `CipherSuite`, `Sender` and `Recipient`, represented by the ``SwiftHPKE/CipherSuite`` structure and the ``SwiftHPKE/Sender`` and ``SwiftHPKE/Recipient`` classes.

A CipherSuite combines a *Key Encapsulation Mechanism* (``SwiftHPKE/KEM``), a *Key Derivation Function* (``SwiftHPKE/KDF``)
and a *Authenticated Encryption with Associated Data* (``SwiftHPKE/AEAD``) algorithm.
Expand Down Expand Up @@ -48,7 +48,7 @@ giving:
Hi, there
```

### Statefull Multi-message API
### Stateful Multi-message API

A `Sender` is based on a specific `CipherSuite` and a `Sender` instance can encrypt (seal)
a sequence of plaintexts in one of the four modes shown above.
Expand Down Expand Up @@ -108,17 +108,17 @@ To use SwiftHPKE, in your project *Package.swift* file add a dependency like

```swift
dependencies: [
.package(url: "https://github.com/leif-ibsen/SwiftHPKE", from: "2.4.0"),
.package(url: "https://github.com/leif-ibsen/SwiftHPKE", from: "2.5.0"),
]
```

SwiftHPKE itself depends on the ASN1, BigInt and Digest packages

```swift
dependencies: [
.package(url: "https://github.com/leif-ibsen/ASN1", from: "2.4.0"),
.package(url: "https://github.com/leif-ibsen/BigInt", from: "1.16.0"),
.package(url: "https://github.com/leif-ibsen/Digest", from: "1.3.0"),
.package(url: "https://github.com/leif-ibsen/ASN1", from: "2.5.0"),
.package(url: "https://github.com/leif-ibsen/BigInt", from: "1.17.0"),
.package(url: "https://github.com/leif-ibsen/Digest", from: "1.6.0"),
],
```

Expand Down
2 changes: 1 addition & 1 deletion SwiftHPKE.doccarchive/data/documentation/swifthpke.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"hierarchy":{"paths":[["doc:\/\/SwiftHPKE\/documentation\/SwiftHPKE"]]},"abstract":[{"type":"text","text":"The AEAD encryption algorithms"}],"topicSections":[{"identifiers":["doc:\/\/SwiftHPKE\/documentation\/SwiftHPKE\/AEAD\/AESGCM128","doc:\/\/SwiftHPKE\/documentation\/SwiftHPKE\/AEAD\/AESGCM256","doc:\/\/SwiftHPKE\/documentation\/SwiftHPKE\/AEAD\/CHACHAPOLY","doc:\/\/SwiftHPKE\/documentation\/SwiftHPKE\/AEAD\/EXPORTONLY"],"title":"Enumeration Cases"},{"title":"Instance Properties","identifiers":["doc:\/\/SwiftHPKE\/documentation\/SwiftHPKE\/AEAD\/description"]},{"title":"Default Implementations","generated":true,"identifiers":["doc:\/\/SwiftHPKE\/documentation\/SwiftHPKE\/AEAD\/Equatable-Implementations"]}],"relationshipsSections":[{"title":"Conforms To","identifiers":["doc:\/\/SwiftHPKE\/s12CaseIterableP","doc:\/\/SwiftHPKE\/s23CustomStringConvertibleP","doc:\/\/SwiftHPKE\/SQ","doc:\/\/SwiftHPKE\/SH"],"kind":"relationships","type":"conformsTo"}],"metadata":{"fragments":[{"text":"enum","kind":"keyword"},{"kind":"text","text":" "},{"kind":"identifier","text":"AEAD"}],"title":"AEAD","navigatorTitle":[{"text":"AEAD","kind":"identifier"}],"modules":[{"name":"SwiftHPKE"}],"role":"symbol","roleHeading":"Enumeration","externalID":"s:9SwiftHPKE4AEADO","symbolKind":"enum"},"sections":[],"schemaVersion":{"patch":0,"minor":3,"major":0},"identifier":{"interfaceLanguage":"swift","url":"doc:\/\/SwiftHPKE\/documentation\/SwiftHPKE\/AEAD"},"seeAlsoSections":[{"identifiers":["doc:\/\/SwiftHPKE\/documentation\/SwiftHPKE\/KDF","doc:\/\/SwiftHPKE\/documentation\/SwiftHPKE\/KEM","doc:\/\/SwiftHPKE\/documentation\/SwiftHPKE\/HPKEException"],"title":"Enumerations","generated":true}],"primaryContentSections":[{"kind":"declarations","declarations":[{"tokens":[{"text":"enum","kind":"keyword"},{"text":" ","kind":"text"},{"kind":"identifier","text":"AEAD"}],"languages":["swift"],"platforms":["macOS"]}]}],"variants":[{"traits":[{"interfaceLanguage":"swift"}],"paths":["\/documentation\/swifthpke\/aead"]}],"kind":"symbol","references":{"doc://SwiftHPKE/s23CustomStringConvertibleP":{"identifier":"doc:\/\/SwiftHPKE\/s23CustomStringConvertibleP","type":"unresolvable","title":"Swift.CustomStringConvertible"},"doc://SwiftHPKE/documentation/SwiftHPKE/AEAD/AESGCM256":{"kind":"symbol","type":"topic","abstract":[{"type":"text","text":"AES-256-GCM"}],"url":"\/documentation\/swifthpke\/aead\/aesgcm256","title":"AEAD.AESGCM256","identifier":"doc:\/\/SwiftHPKE\/documentation\/SwiftHPKE\/AEAD\/AESGCM256","fragments":[{"text":"case","kind":"keyword"},{"kind":"text","text":" "},{"text":"AESGCM256","kind":"identifier"}],"role":"symbol"},"doc://SwiftHPKE/documentation/SwiftHPKE/KDF":{"role":"symbol","fragments":[{"text":"enum","kind":"keyword"},{"text":" ","kind":"text"},{"text":"KDF","kind":"identifier"}],"abstract":[{"text":"The key derivation functions","type":"text"}],"kind":"symbol","identifier":"doc:\/\/SwiftHPKE\/documentation\/SwiftHPKE\/KDF","navigatorTitle":[{"kind":"identifier","text":"KDF"}],"url":"\/documentation\/swifthpke\/kdf","type":"topic","title":"KDF"},"doc://SwiftHPKE/documentation/SwiftHPKE/KEM":{"kind":"symbol","url":"\/documentation\/swifthpke\/kem","identifier":"doc:\/\/SwiftHPKE\/documentation\/SwiftHPKE\/KEM","navigatorTitle":[{"text":"KEM","kind":"identifier"}],"abstract":[{"type":"text","text":"The key encapsulation mechanisms"}],"title":"KEM","type":"topic","role":"symbol","fragments":[{"kind":"keyword","text":"enum"},{"text":" ","kind":"text"},{"text":"KEM","kind":"identifier"}]},"doc://SwiftHPKE/documentation/SwiftHPKE/AEAD/EXPORTONLY":{"url":"\/documentation\/swifthpke\/aead\/exportonly","identifier":"doc:\/\/SwiftHPKE\/documentation\/SwiftHPKE\/AEAD\/EXPORTONLY","abstract":[{"type":"text","text":"Export Only"}],"kind":"symbol","title":"AEAD.EXPORTONLY","role":"symbol","type":"topic","fragments":[{"text":"case","kind":"keyword"},{"kind":"text","text":" "},{"kind":"identifier","text":"EXPORTONLY"}]},"doc://SwiftHPKE/documentation/SwiftHPKE/AEAD/description":{"url":"\/documentation\/swifthpke\/aead\/description","identifier":"doc:\/\/SwiftHPKE\/documentation\/SwiftHPKE\/AEAD\/description","abstract":[{"text":"Textual description of ","type":"text"},{"type":"codeVoice","code":"self"}],"kind":"symbol","title":"description","role":"symbol","type":"topic","fragments":[{"text":"var","kind":"keyword"},{"kind":"text","text":" "},{"text":"description","kind":"identifier"},{"text":": ","kind":"text"},{"preciseIdentifier":"s:SS","text":"String","kind":"typeIdentifier"}]},"doc://SwiftHPKE/SH":{"identifier":"doc:\/\/SwiftHPKE\/SH","type":"unresolvable","title":"Swift.Hashable"},"doc://SwiftHPKE/s12CaseIterableP":{"identifier":"doc:\/\/SwiftHPKE\/s12CaseIterableP","type":"unresolvable","title":"Swift.CaseIterable"},"doc://SwiftHPKE/documentation/SwiftHPKE/HPKEException":{"abstract":[{"text":"The HPKE exceptions","type":"text"}],"identifier":"doc:\/\/SwiftHPKE\/documentation\/SwiftHPKE\/HPKEException","fragments":[{"text":"enum","kind":"keyword"},{"text":" ","kind":"text"},{"kind":"identifier","text":"HPKEException"}],"kind":"symbol","title":"HPKEException","url":"\/documentation\/swifthpke\/hpkeexception","role":"symbol","navigatorTitle":[{"text":"HPKEException","kind":"identifier"}],"type":"topic"},"doc://SwiftHPKE/documentation/SwiftHPKE":{"abstract":[{"type":"text","text":"Hybrid Public Key Encryption"}],"title":"SwiftHPKE","type":"topic","role":"collection","kind":"symbol","identifier":"doc:\/\/SwiftHPKE\/documentation\/SwiftHPKE","url":"\/documentation\/swifthpke"},"doc://SwiftHPKE/documentation/SwiftHPKE/AEAD/AESGCM128":{"url":"\/documentation\/swifthpke\/aead\/aesgcm128","identifier":"doc:\/\/SwiftHPKE\/documentation\/SwiftHPKE\/AEAD\/AESGCM128","abstract":[{"type":"text","text":"AES-128-GCM"}],"kind":"symbol","title":"AEAD.AESGCM128","role":"symbol","type":"topic","fragments":[{"text":"case","kind":"keyword"},{"text":" ","kind":"text"},{"kind":"identifier","text":"AESGCM128"}]},"doc://SwiftHPKE/documentation/SwiftHPKE/AEAD":{"role":"symbol","fragments":[{"kind":"keyword","text":"enum"},{"kind":"text","text":" "},{"text":"AEAD","kind":"identifier"}],"navigatorTitle":[{"text":"AEAD","kind":"identifier"}],"abstract":[{"text":"The AEAD encryption algorithms","type":"text"}],"identifier":"doc:\/\/SwiftHPKE\/documentation\/SwiftHPKE\/AEAD","url":"\/documentation\/swifthpke\/aead","kind":"symbol","type":"topic","title":"AEAD"},"doc://SwiftHPKE/documentation/SwiftHPKE/AEAD/Equatable-Implementations":{"type":"topic","kind":"article","url":"\/documentation\/swifthpke\/aead\/equatable-implementations","abstract":[],"identifier":"doc:\/\/SwiftHPKE\/documentation\/SwiftHPKE\/AEAD\/Equatable-Implementations","title":"Equatable Implementations","role":"collectionGroup"},"doc://SwiftHPKE/documentation/SwiftHPKE/AEAD/CHACHAPOLY":{"identifier":"doc:\/\/SwiftHPKE\/documentation\/SwiftHPKE\/AEAD\/CHACHAPOLY","abstract":[{"type":"text","text":"ChaCha20-Poly1305"}],"role":"symbol","url":"\/documentation\/swifthpke\/aead\/chachapoly","title":"AEAD.CHACHAPOLY","kind":"symbol","type":"topic","fragments":[{"kind":"keyword","text":"case"},{"text":" ","kind":"text"},{"text":"CHACHAPOLY","kind":"identifier"}]},"doc://SwiftHPKE/SQ":{"identifier":"doc:\/\/SwiftHPKE\/SQ","type":"unresolvable","title":"Swift.Equatable"}}}
{"schemaVersion":{"major":0,"patch":0,"minor":3},"hierarchy":{"paths":[["doc:\/\/SwiftHPKE\/documentation\/SwiftHPKE"]]},"abstract":[{"text":"The AEAD encryption algorithms","type":"text"}],"primaryContentSections":[{"kind":"declarations","declarations":[{"tokens":[{"kind":"keyword","text":"enum"},{"kind":"text","text":" "},{"kind":"identifier","text":"AEAD"}],"platforms":["macOS"],"languages":["swift"]}]}],"identifier":{"url":"doc:\/\/SwiftHPKE\/documentation\/SwiftHPKE\/AEAD","interfaceLanguage":"swift"},"sections":[],"variants":[{"paths":["\/documentation\/swifthpke\/aead"],"traits":[{"interfaceLanguage":"swift"}]}],"relationshipsSections":[{"kind":"relationships","identifiers":["doc:\/\/SwiftHPKE\/s12CaseIterableP","doc:\/\/SwiftHPKE\/s23CustomStringConvertibleP","doc:\/\/SwiftHPKE\/SQ","doc:\/\/SwiftHPKE\/SH"],"title":"Conforms To","type":"conformsTo"}],"metadata":{"role":"symbol","title":"AEAD","symbolKind":"enum","fragments":[{"kind":"keyword","text":"enum"},{"kind":"text","text":" "},{"text":"AEAD","kind":"identifier"}],"navigatorTitle":[{"kind":"identifier","text":"AEAD"}],"externalID":"s:9SwiftHPKE4AEADO","modules":[{"name":"SwiftHPKE"}],"roleHeading":"Enumeration"},"kind":"symbol","topicSections":[{"identifiers":["doc:\/\/SwiftHPKE\/documentation\/SwiftHPKE\/AEAD\/AESGCM128","doc:\/\/SwiftHPKE\/documentation\/SwiftHPKE\/AEAD\/AESGCM256","doc:\/\/SwiftHPKE\/documentation\/SwiftHPKE\/AEAD\/CHACHAPOLY","doc:\/\/SwiftHPKE\/documentation\/SwiftHPKE\/AEAD\/EXPORTONLY"],"title":"Enumeration Cases"},{"title":"Instance Properties","identifiers":["doc:\/\/SwiftHPKE\/documentation\/SwiftHPKE\/AEAD\/description"]},{"generated":true,"identifiers":["doc:\/\/SwiftHPKE\/documentation\/SwiftHPKE\/AEAD\/Equatable-Implementations"],"title":"Default Implementations"}],"seeAlsoSections":[{"generated":true,"title":"Enumerations","identifiers":["doc:\/\/SwiftHPKE\/documentation\/SwiftHPKE\/KDF","doc:\/\/SwiftHPKE\/documentation\/SwiftHPKE\/KEM","doc:\/\/SwiftHPKE\/documentation\/SwiftHPKE\/HPKEException"]}],"references":{"doc://SwiftHPKE/documentation/SwiftHPKE/AEAD/description":{"abstract":[{"type":"text","text":"Textual description of "},{"type":"codeVoice","code":"self"}],"title":"description","fragments":[{"text":"var","kind":"keyword"},{"text":" ","kind":"text"},{"kind":"identifier","text":"description"},{"text":": ","kind":"text"},{"kind":"typeIdentifier","preciseIdentifier":"s:SS","text":"String"}],"identifier":"doc:\/\/SwiftHPKE\/documentation\/SwiftHPKE\/AEAD\/description","type":"topic","kind":"symbol","url":"\/documentation\/swifthpke\/aead\/description","role":"symbol"},"doc://SwiftHPKE/documentation/SwiftHPKE/AEAD/CHACHAPOLY":{"abstract":[{"type":"text","text":"ChaCha20-Poly1305"}],"title":"AEAD.CHACHAPOLY","fragments":[{"text":"case","kind":"keyword"},{"kind":"text","text":" "},{"text":"CHACHAPOLY","kind":"identifier"}],"identifier":"doc:\/\/SwiftHPKE\/documentation\/SwiftHPKE\/AEAD\/CHACHAPOLY","type":"topic","kind":"symbol","url":"\/documentation\/swifthpke\/aead\/chachapoly","role":"symbol"},"doc://SwiftHPKE/documentation/SwiftHPKE/AEAD/EXPORTONLY":{"role":"symbol","title":"AEAD.EXPORTONLY","fragments":[{"kind":"keyword","text":"case"},{"text":" ","kind":"text"},{"kind":"identifier","text":"EXPORTONLY"}],"abstract":[{"text":"Export Only","type":"text"}],"url":"\/documentation\/swifthpke\/aead\/exportonly","identifier":"doc:\/\/SwiftHPKE\/documentation\/SwiftHPKE\/AEAD\/EXPORTONLY","type":"topic","kind":"symbol"},"doc://SwiftHPKE/documentation/SwiftHPKE/AEAD/Equatable-Implementations":{"role":"collectionGroup","title":"Equatable Implementations","abstract":[],"url":"\/documentation\/swifthpke\/aead\/equatable-implementations","identifier":"doc:\/\/SwiftHPKE\/documentation\/SwiftHPKE\/AEAD\/Equatable-Implementations","type":"topic","kind":"article"},"doc://SwiftHPKE/documentation/SwiftHPKE/AEAD/AESGCM128":{"abstract":[{"text":"AES-128-GCM","type":"text"}],"kind":"symbol","identifier":"doc:\/\/SwiftHPKE\/documentation\/SwiftHPKE\/AEAD\/AESGCM128","role":"symbol","fragments":[{"kind":"keyword","text":"case"},{"text":" ","kind":"text"},{"kind":"identifier","text":"AESGCM128"}],"type":"topic","title":"AEAD.AESGCM128","url":"\/documentation\/swifthpke\/aead\/aesgcm128"},"doc://SwiftHPKE/SH":{"type":"unresolvable","identifier":"doc:\/\/SwiftHPKE\/SH","title":"Swift.Hashable"},"doc://SwiftHPKE/s23CustomStringConvertibleP":{"type":"unresolvable","identifier":"doc:\/\/SwiftHPKE\/s23CustomStringConvertibleP","title":"Swift.CustomStringConvertible"},"doc://SwiftHPKE/SQ":{"type":"unresolvable","identifier":"doc:\/\/SwiftHPKE\/SQ","title":"Swift.Equatable"},"doc://SwiftHPKE/documentation/SwiftHPKE/KEM":{"identifier":"doc:\/\/SwiftHPKE\/documentation\/SwiftHPKE\/KEM","fragments":[{"text":"enum","kind":"keyword"},{"kind":"text","text":" "},{"kind":"identifier","text":"KEM"}],"abstract":[{"type":"text","text":"The key encapsulation mechanisms"}],"navigatorTitle":[{"kind":"identifier","text":"KEM"}],"url":"\/documentation\/swifthpke\/kem","kind":"symbol","title":"KEM","type":"topic","role":"symbol"},"doc://SwiftHPKE/documentation/SwiftHPKE/AEAD":{"abstract":[{"type":"text","text":"The AEAD encryption algorithms"}],"fragments":[{"kind":"keyword","text":"enum"},{"text":" ","kind":"text"},{"text":"AEAD","kind":"identifier"}],"type":"topic","identifier":"doc:\/\/SwiftHPKE\/documentation\/SwiftHPKE\/AEAD","title":"AEAD","url":"\/documentation\/swifthpke\/aead","kind":"symbol","role":"symbol","navigatorTitle":[{"text":"AEAD","kind":"identifier"}]},"doc://SwiftHPKE/s12CaseIterableP":{"type":"unresolvable","identifier":"doc:\/\/SwiftHPKE\/s12CaseIterableP","title":"Swift.CaseIterable"},"doc://SwiftHPKE/documentation/SwiftHPKE":{"role":"collection","title":"SwiftHPKE","identifier":"doc:\/\/SwiftHPKE\/documentation\/SwiftHPKE","abstract":[{"type":"text","text":"Hybrid Public Key Encryption"}],"url":"\/documentation\/swifthpke","type":"topic","kind":"symbol"},"doc://SwiftHPKE/documentation/SwiftHPKE/KDF":{"kind":"symbol","url":"\/documentation\/swifthpke\/kdf","identifier":"doc:\/\/SwiftHPKE\/documentation\/SwiftHPKE\/KDF","navigatorTitle":[{"text":"KDF","kind":"identifier"}],"type":"topic","abstract":[{"type":"text","text":"The key derivation functions"}],"role":"symbol","fragments":[{"text":"enum","kind":"keyword"},{"text":" ","kind":"text"},{"text":"KDF","kind":"identifier"}],"title":"KDF"},"doc://SwiftHPKE/documentation/SwiftHPKE/HPKEException":{"url":"\/documentation\/swifthpke\/hpkeexception","title":"HPKEException","role":"symbol","type":"topic","identifier":"doc:\/\/SwiftHPKE\/documentation\/SwiftHPKE\/HPKEException","abstract":[{"type":"text","text":"The HPKE exceptions"}],"navigatorTitle":[{"kind":"identifier","text":"HPKEException"}],"fragments":[{"text":"enum","kind":"keyword"},{"text":" ","kind":"text"},{"text":"HPKEException","kind":"identifier"}],"kind":"symbol"},"doc://SwiftHPKE/documentation/SwiftHPKE/AEAD/AESGCM256":{"type":"topic","role":"symbol","title":"AEAD.AESGCM256","url":"\/documentation\/swifthpke\/aead\/aesgcm256","abstract":[{"text":"AES-256-GCM","type":"text"}],"kind":"symbol","fragments":[{"text":"case","kind":"keyword"},{"text":" ","kind":"text"},{"kind":"identifier","text":"AESGCM256"}],"identifier":"doc:\/\/SwiftHPKE\/documentation\/SwiftHPKE\/AEAD\/AESGCM256"}}}
Loading

0 comments on commit 27f656f

Please sign in to comment.