Skip to content
Merged
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/pkcs1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- "base64ct/**"
- "const-oid/**"
- "der/**"
- "pem-rfc7468/**"
- "pkcs1/**"
- "Cargo.*"
push:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pkcs8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- "base64ct/**"
- "const-oid/**"
- "der/**"
- "pem-rfc7468/**"
- "pkcs8/**"
- "spki/**"
- "Cargo.*"
Expand Down
65 changes: 65 additions & 0 deletions .github/workflows/sec1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: sec1

on:
pull_request:
paths:
- "base64ct/**"
- "const-oid/**"
- "der/**"
- "pem-rfc7468/**"
- "sec1/**"
- "Cargo.*"
push:
branches: master

defaults:
run:
working-directory: sec1

env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-Dwarnings"

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- 1.51.0 # MSRV
- stable
target:
- thumbv7em-none-eabi
- wasm32-unknown-unknown
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
target: ${{ matrix.target }}
override: true
- run: cargo build --target ${{ matrix.target }} --release --no-default-features
- run: cargo build --target ${{ matrix.target }} --release --no-default-features --features alloc
- run: cargo build --target ${{ matrix.target }} --release --no-default-features --features pem
- run: cargo build --target ${{ matrix.target }} --release --no-default-features --features subtle
- run: cargo build --target ${{ matrix.target }} --release --no-default-features --features zeroize
- run: cargo build --target ${{ matrix.target }} --release --no-default-features --features alloc,pem,subtle,zeroize

test:
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- 1.51.0 # MSRV
- stable
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- run: cargo test --release --no-default-features
- run: cargo test --release
- run: cargo test --release --all-features
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion sec1/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ name = "sec1"
version = "0.0.0" # Also update html_root_url in lib.rs when bumping this
description = """
Pure Rust implementation of SEC1: Elliptic Curve Cryptography encoding formats
including ASN.1 DER-serialized private keys
including ASN.1 DER-serialized private keys as well as the
Elliptic-Curve-Point-to-Octet-String encoding
"""
authors = ["RustCrypto Developers"]
license = "Apache-2.0 OR MIT"
Expand All @@ -15,9 +16,11 @@ readme = "README.md"

[dependencies]
der = { version = "0.4", features = ["oid"], path = "../der" }
generic-array = { version = "0.14", default-features = false }

# optional dependencies
pem-rfc7468 = { version = "0.2", optional = true, path = "../pem-rfc7468" }
subtle = { version = ">=2, <2.5", optional = true, default-features = false }
zeroize = { version = "1", optional = true, default-features = false, features = ["alloc"] }

[dev-dependencies]
Expand Down
7 changes: 6 additions & 1 deletion sec1/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use core::fmt;
#[cfg(feature = "pem")]
use crate::pem;

/// Result type
/// Result type with `sec1` crate's [`Error`] type.
pub type Result<T> = core::result::Result<T, Error>;

/// Error type
Expand Down Expand Up @@ -42,6 +42,10 @@ pub enum Error {
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
PermissionDenied,

/// Errors relating to the `Elliptic-Curve-Point-to-Octet-String` or
/// `Octet-String-to-Elliptic-Curve-Point` encodings.
PointEncoding,

/// Version errors
Version,
}
Expand All @@ -57,6 +61,7 @@ impl fmt::Display for Error {
Error::Io => f.write_str("I/O error"),
#[cfg(feature = "pem")]
Error::Pem(err) => write!(f, "SEC1 {}", err),
Error::PointEncoding => f.write_str("elliptic curve point encoding error"),
Error::Version => f.write_str("SEC1 version error"),
#[cfg(feature = "std")]
Error::PermissionDenied => f.write_str("permission denied"),
Expand Down
8 changes: 6 additions & 2 deletions sec1/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! Pure Rust implementation of [SEC1: Elliptic Curve Cryptography] encoding formats
//! including ASN.1 DER-serialized private keys.
//! Pure Rust implementation of [SEC1: Elliptic Curve Cryptography] encoding
//! formats including ASN.1 DER-serialized private keys as well as the
//! `Elliptic-Curve-Point-to-Octet-String` encoding.
//!
//! # Minimum Supported Rust Version
//! This crate requires **Rust 1.51** at a minimum.
Expand All @@ -20,6 +21,8 @@ extern crate alloc;
#[cfg(feature = "std")]
extern crate std;

pub mod point;

mod error;
mod parameters;
mod private_key;
Expand All @@ -30,6 +33,7 @@ pub use der;
pub use self::{
error::{Error, Result},
parameters::EcParameters,
point::EncodedPoint,
private_key::EcPrivateKey,
traits::FromEcPrivateKey,
};
Expand Down
Loading