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
908 changes: 765 additions & 143 deletions Cargo.lock

Large diffs are not rendered by default.

46 changes: 40 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,46 @@ members = [
"jose-jwt",
]

[workspace.package]
edition = "2024"
version = "0.2.0-pre"
rust-version = "1.85"
authors = ["RustCrypto Developers"]
license = "Apache-2.0 OR MIT"
repository = "https://github.com/RustCrypto/JOSE"

[workspace.dependencies]
# Internal workspace crates
jose-b64 = { path = "./jose-b64", features = ["secret", "json"] }
jose-jwa = { path = "./jose-jwa" }
jose-jwe = { path = "./jose-jwe" }
jose-jwk = { path = "./jose-jwk" }
jose-jws = { path = "./jose-jws" }
jose-jwt = { path = "./jose-jwt" }

# External dependencies
base64ct = { version = "1.8", default-features = false, features = ["alloc"] }
ecdsa = { version = "0.17.0-rc.16", default-features = false, features = ["der", "algorithm", "hazmat"] }
elliptic-curve = { version = "0.14.0-rc.28", default-features = false, features = ["arithmetic", "sec1"] }
hmac = { version = "0.13.0-rc.5", default-features = false }
k256 = { version = "0.14.0-rc.7", default-features = false, features = ["arithmetic", "ecdsa"] }
p256 = { version = "0.14.0-rc.7", default-features = false, features = ["arithmetic", "ecdsa"] }
p384 = { version = "0.14.0-rc.7", default-features = false, features = ["arithmetic", "ecdsa"] }
p521 = { version = "0.14.0-rc.7", default-features = false, features = ["arithmetic", "ecdsa"] }
rand_core = { version = "0.9", default-features = false }
rsa = { version = "0.10.0-rc.16", default-features = false }
serde = { version = "1.0.185", default-features = false, features = ["alloc", "derive"] }
serde_json = { version = "1.0.96", default-features = false, features = ["alloc"] }
sha2 = { version = "0.11.0-rc.5", default-features = false, features = ["oid"] }
signature = { version = "3.0.0-rc.4", default-features = false, features = ["digest"] }
url = { version = "2.4.1", default-features = false, features = ["serde"] }
zeroize = { version = "1.8.1", default-features = false, features = ["alloc", "serde"] }

# Optional dependencies
getrandom = { version = "0.4", default-features = false }
subtle = { version = "2.6", default-features = false }
serdect = { version = "0.2", default-features = false, features = ["alloc"] }

[profile.dev]
opt-level = 2

Expand All @@ -19,9 +59,3 @@ jose-jwe = { path = "./jose-jwe" }
jose-jwk = { path = "./jose-jwk" }
jose-jws = { path = "./jose-jws" }
jose-jwt = { path = "./jose-jwt" }

primefield = { git = "https://github.com/RustCrypto/elliptic-curves.git" }
k256 = { git = "https://github.com/RustCrypto/elliptic-curves.git" }
p256 = { git = "https://github.com/RustCrypto/elliptic-curves.git" }
p384 = { git = "https://github.com/RustCrypto/elliptic-curves.git" }
p521 = { git = "https://github.com/RustCrypto/elliptic-curves.git" }
19 changes: 10 additions & 9 deletions jose-b64/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
[package]
name = "jose-b64"
version = "0.2.0-pre"
authors = ["RustCrypto Developers"]
license = "Apache-2.0 OR MIT"
description = "Base64 utilities for use in JOSE crates"
documentation = "https://docs.rs/jose-b64"
homepage = "https://github.com/RustCrypto/JOSE/tree/master/jose-b64"
repository = "https://github.com/RustCrypto/JOSE"
repository.workspace = true
categories = ["cryptography", "data-structures", "encoding", "parser-implementations"]
keywords = ["json", "jose"]
readme = "README.md"
edition = "2024"
rust-version = "1.85"

version.workspace = true
edition.workspace = true
rust-version.workspace = true

[features]
secret = ["serde", "dep:zeroize", "dep:subtle"]
json = ["serde", "dep:serde_json"]
serde = ["dep:serde"]

[dependencies]
base64ct = { version = "1.8.0", default-features = false, features = ["alloc"] }
base64ct = { workspace = true }

# optional dependencies
zeroize = { version = "1.8.1", default-features = false, optional = true, features = ["alloc", "serde"] }
serde = { version = "1.0.185", default-features = false, optional = true, features = ["alloc", "derive"] }
serde_json = { version = "1.0.96", default-features = false, optional = true, features = ["alloc"] }
subtle = { version = "2.5.0", default-features = false, optional = true }
zeroize = { workspace = true, optional = true }
serde = { workspace = true, optional = true }
serde_json = { workspace = true, optional = true }
subtle = { workspace = true, optional = true }

[package.metadata.docs.rs]
all-features = true
Expand Down
15 changes: 8 additions & 7 deletions jose-jwa/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[package]
name = "jose-jwa"
version = "0.2.0-pre"
authors = ["RustCrypto Developers"]
license = "Apache-2.0 OR MIT"
description = """
Expand All @@ -10,18 +9,20 @@ RFC7518
"""
documentation = "https://docs.rs/jose-jwa"
homepage = "https://github.com/RustCrypto/JOSE/tree/master/jose-jwa"
repository = "https://github.com/RustCrypto/JOSE"
repository.workspace = true
categories = ["cryptography", "data-structures", "encoding", "parser-implementations"]
keywords = ["json", "jose"]
keywords = ["json", "jose", "jwa"]
readme = "README.md"
edition = "2024"
rust-version = "1.85"

version.workspace = true
edition.workspace = true
rust-version.workspace = true

[dependencies]
serde = { version = "1.0.185", default-features = false, features = ["alloc", "derive"] }
serde = { workspace = true }

[dev-dependencies]
serde_json = "1.0.96"
serde_json = { workspace = true }

[package.metadata.docs.rs]
all-features = true
Expand Down
37 changes: 32 additions & 5 deletions jose-jwe/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[package]
name = "jose-jwe"
version = "0.1.0-pre"
authors = ["RustCrypto Developers"]
license = "Apache-2.0 OR MIT"
description = """
Expand All @@ -10,12 +9,40 @@ RFC7516
"""
documentation = "https://docs.rs/jose-jwe"
homepage = "https://github.com/RustCrypto/JOSE/tree/master/jose-jwe"
repository = "https://github.com/RustCrypto/JOSE"
repository.workspace = true
categories = ["cryptography", "data-structures", "encoding", "parser-implementations"]
keywords = ["json", "jose"]
keywords = ["json", "jose", "jwe", "encryption"]
readme = "README.md"
edition = "2024"
rust-version = "1.85"

version.workspace = true
edition.workspace = true
rust-version.workspace = true

[features]
default = []

# Recommended algorithms (includes all recommended algorithms from RFC 7518)
recommended = ["rand"]

# Random number generation support
rand = ["dep:rand_core", "dep:getrandom"]

[dependencies]
jose-b64 = { workspace = true }
jose-jwa = { workspace = true }
jose-jwk = { workspace = true }

serde = { workspace = true }
serde_json = { workspace = true }

# Random number generation
rand_core = { workspace = true, optional = true }
getrandom = { workspace = true, optional = true }

zeroize = { workspace = true }

[dev-dependencies]
serde_json = { workspace = true }

[package.metadata.docs.rs]
all-features = true
Expand Down
45 changes: 23 additions & 22 deletions jose-jwk/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[package]
name = "jose-jwk"
version = "0.2.0-pre"
authors = ["RustCrypto Developers"]
license = "Apache-2.0 OR MIT"
description = """
Expand All @@ -10,42 +9,44 @@ RFC7517
"""
documentation = "https://docs.rs/jose-jwk"
homepage = "https://github.com/RustCrypto/JOSE/tree/master/jose-jwk"
repository = "https://github.com/RustCrypto/JOSE"
repository.workspace = true
categories = ["cryptography", "data-structures", "encoding", "parser-implementations"]
keywords = ["json", "jose"]
keywords = ["json", "jose", "jwk"]
readme = "README.md"
edition = "2024"
rust-version = "1.85"

version.workspace = true
edition.workspace = true
rust-version.workspace = true

[features]
default = ["crypto"]
crypto = ["p256", "p384", "p521", "k256", "rsa"]
legacy = ["dep:base64ct", "dep:elliptic-curve", "dep:serde_json", "dep:serdect", "dep:subtle"]

[dependencies]
jose-b64 = { version = "=0.2.0-pre", default-features = false, features = ["secret"] }
jose-jwa = { version = "=0.2.0-pre" }
serde = { version = "1", default-features = false, features = ["alloc", "derive"] }
zeroize = { version = "1.8.1", default-features = false, features = ["alloc"] }
jose-b64 = { workspace = true }
jose-jwa = { workspace = true }
serde = { workspace = true }
zeroize = { workspace = true }

# optional dependencies
p256 = { version = "0.14.0-pre.9", default-features = false, optional = true, features = ["arithmetic"] }
p384 = { version = "0.14.0-pre.9", default-features = false, optional = true, features = ["arithmetic"] }
p521 = { version = "0.14.0-pre.9", default-features = false, optional = true, features = ["arithmetic"] }
k256 = { version = "0.14.0-pre.9", default-features = false, optional = true, features = ["arithmetic"] }
rsa = { version = "0.10.0-rc.6", default-features = false, optional = true }
url = { version = "2.4.1", default-features = false, optional = true, features = ["serde"] }
p256 = { workspace = true, optional = true }
p384 = { workspace = true, optional = true }
p521 = { workspace = true, optional = true }
k256 = { workspace = true, optional = true }
rsa = { workspace = true, optional = true }
url = { workspace = true, optional = true }

# legacy dependencies
base64ct = { version = "1", optional = true, default-features = false, features = ["alloc"] }
elliptic-curve = { version = "0.14.0-rc.4", optional = true, default-features = false, features = ["arithmetic", "sec1"] }
serdect = { version = "0.2", optional = true, default-features = false, features = ["alloc"] }
serde_json = { version = "1.0.121", optional = true, default-features = false, features = ["alloc"] }
subtle = { version = "2.6", optional = true, default-features = false }
base64ct = { workspace = true, optional = true }
elliptic-curve = { workspace = true, optional = true }
serdect = { workspace = true, optional = true }
serde_json = { workspace = true, optional = true }
subtle = { workspace = true, optional = true }

[dev-dependencies]
elliptic-curve = { version = "0.14.0-rc.4", default-features = false, features = ["dev"] }
serde_json = "1.0.121"
elliptic-curve = { workspace = true, features = ["dev"] }
serde_json = { workspace = true }

[package.metadata.docs.rs]
all-features = true
Expand Down
10 changes: 5 additions & 5 deletions jose-jwk/src/crypto/k256.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

#![cfg(feature = "k256")]

use k256::elliptic_curve::sec1::{FromEncodedPoint, ToEncodedPoint};
use k256::{EncodedPoint, FieldBytes, PublicKey, SecretKey};
use k256::elliptic_curve::sec1::{FromSec1Point, ToSec1Point};
use k256::{FieldBytes, PublicKey, Sec1Point, SecretKey};

use jose_jwa::{Algorithm, Algorithm::Signing, Signing::*};

Expand Down Expand Up @@ -39,7 +39,7 @@ impl KeyInfo for SecretKey {

impl From<&PublicKey> for Ec {
fn from(pk: &PublicKey) -> Self {
let ep = pk.to_encoded_point(false);
let ep = pk.to_sec1_point(false);

Self {
crv: EcCurves::P256K,
Expand Down Expand Up @@ -77,8 +77,8 @@ impl TryFrom<&Ec> for PublicKey {
x.copy_from_slice(&value.x);
y.copy_from_slice(&value.y);

let ep = EncodedPoint::from_affine_coordinates(&x, &y, false);
Option::from(Self::from_encoded_point(&ep)).ok_or(Error::Invalid)
let ep = Sec1Point::from_affine_coordinates(&x, &y, false);
Option::from(Self::from_sec1_point(&ep)).ok_or(Error::Invalid)
}
}

Expand Down
10 changes: 5 additions & 5 deletions jose-jwk/src/crypto/p256.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

#![cfg(feature = "p256")]

use p256::elliptic_curve::sec1::{FromEncodedPoint, ToEncodedPoint};
use p256::{EncodedPoint, FieldBytes, PublicKey, SecretKey};
use p256::elliptic_curve::sec1::{FromSec1Point, ToSec1Point};
use p256::{FieldBytes, PublicKey, Sec1Point, SecretKey};

use jose_jwa::{Algorithm, Algorithm::Signing, Signing::*};

Expand Down Expand Up @@ -39,7 +39,7 @@ impl KeyInfo for SecretKey {

impl From<&PublicKey> for Ec {
fn from(pk: &PublicKey) -> Self {
let ep = pk.to_encoded_point(false);
let ep = pk.to_sec1_point(false);

Self {
crv: EcCurves::P256,
Expand Down Expand Up @@ -77,8 +77,8 @@ impl TryFrom<&Ec> for PublicKey {
x.copy_from_slice(&value.x);
y.copy_from_slice(&value.y);

let ep = EncodedPoint::from_affine_coordinates(&x, &y, false);
Option::from(Self::from_encoded_point(&ep)).ok_or(Error::Invalid)
let ep = Sec1Point::from_affine_coordinates(&x, &y, false);
Option::from(Self::from_sec1_point(&ep)).ok_or(Error::Invalid)
}
}

Expand Down
10 changes: 5 additions & 5 deletions jose-jwk/src/crypto/p384.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

#![cfg(feature = "p384")]

use p384::elliptic_curve::sec1::{FromEncodedPoint, ToEncodedPoint};
use p384::{EncodedPoint, FieldBytes, PublicKey, SecretKey};
use p384::elliptic_curve::sec1::{FromSec1Point, ToSec1Point};
use p384::{FieldBytes, PublicKey, Sec1Point, SecretKey};

use jose_jwa::{Algorithm, Algorithm::Signing, Signing::*};

Expand Down Expand Up @@ -39,7 +39,7 @@ impl KeyInfo for SecretKey {

impl From<&PublicKey> for Ec {
fn from(pk: &PublicKey) -> Self {
let ep = pk.to_encoded_point(false);
let ep = pk.to_sec1_point(false);

Self {
crv: EcCurves::P384,
Expand Down Expand Up @@ -77,8 +77,8 @@ impl TryFrom<&Ec> for PublicKey {
x.copy_from_slice(&value.x);
y.copy_from_slice(&value.y);

let ep = EncodedPoint::from_affine_coordinates(&x, &y, false);
Option::from(Self::from_encoded_point(&ep)).ok_or(Error::Invalid)
let ep = Sec1Point::from_affine_coordinates(&x, &y, false);
Option::from(Self::from_sec1_point(&ep)).ok_or(Error::Invalid)
}
}

Expand Down
10 changes: 5 additions & 5 deletions jose-jwk/src/crypto/p521.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

#![cfg(feature = "p521")]

use p521::elliptic_curve::sec1::{FromEncodedPoint, ToEncodedPoint};
use p521::{EncodedPoint, FieldBytes, PublicKey, SecretKey};
use p521::elliptic_curve::sec1::{FromSec1Point, ToSec1Point};
use p521::{FieldBytes, PublicKey, Sec1Point, SecretKey};

use jose_jwa::{Algorithm, Algorithm::Signing, Signing::*};

Expand Down Expand Up @@ -39,7 +39,7 @@ impl KeyInfo for SecretKey {

impl From<&PublicKey> for Ec {
fn from(pk: &PublicKey) -> Self {
let ep = pk.to_encoded_point(false);
let ep = pk.to_sec1_point(false);

Self {
crv: EcCurves::P521,
Expand Down Expand Up @@ -77,8 +77,8 @@ impl TryFrom<&Ec> for PublicKey {
x.copy_from_slice(&value.x);
y.copy_from_slice(&value.y);

let ep = EncodedPoint::from_affine_coordinates(&x, &y, false);
Option::from(Self::from_encoded_point(&ep)).ok_or(Error::Invalid)
let ep = Sec1Point::from_affine_coordinates(&x, &y, false);
Option::from(Self::from_sec1_point(&ep)).ok_or(Error::Invalid)
}
}

Expand Down
Loading