commit_hash
stringlengths
40
40
author
stringlengths
1
57
date
timestamp[s]date
2010-07-26 04:45:09
2026-04-14 18:21:10
message
stringlengths
8
1.39M
diff
stringlengths
68
51.2k
files_changed
int64
1
136
insertions
int64
0
2.35k
deletions
int64
0
1.9k
9131e859d5ee4238c33bae6ab9da1edaa7ea6d30
Tony Arcieri
2022-04-26T16:03:42
der: add `PemWriter` and 1-pass `EncodePem` (#618) Adds a `PemWriter` type which impls the `Writer` trait and can perform on-the-fly PEM encoding.
diff --git a/der/src/encode.rs b/der/src/encode.rs index 1de1cb37..078026a8 100644 --- a/der/src/encode.rs +++ b/der/src/encode.rs @@ -3,15 +3,18 @@ use crate::{Encoder, Header, Length, Result, Tagged, Writer}; #[cfg(feature = "alloc")] -use {crate::ErrorKind, alloc::vec::Vec, core::iter}; +use {alloc::vec::Vec, co...
4
84
7
f0a3d96b384b8b0472dcfe427acdeccd52edfbea
Tony Arcieri
2022-04-26T01:05:59
der: blanket impl `Writer` for `T: std::io::Write` (#617)
diff --git a/der/src/writer.rs b/der/src/writer.rs index b5e31327..1d03134e 100644 --- a/der/src/writer.rs +++ b/der/src/writer.rs @@ -2,6 +2,9 @@ use crate::Result; +#[cfg(feature = "std")] +use std::io; + /// Writer trait which outputs encoded DER. pub trait Writer { /// Write the given DER-encoded bytes ...
1
12
0
73a4cde7a72abbaf0ca79805bbf02b6793a3dcfb
Tony Arcieri
2022-04-26T00:15:01
spki: streaming fingerprint builder (#616) Uses the `Writer` trait to compute SPKI fingerprints by hashing output DER on-the-fly as opposed to encoding it first to an intermediate buffer then computing the SHA-256 digest. Besides simply being more efficient, the buffered method had a hardcoded limit of 4096-byte...
diff --git a/spki/src/fingerprint.rs b/spki/src/fingerprint.rs new file mode 100644 index 00000000..6a3901fb --- /dev/null +++ b/spki/src/fingerprint.rs @@ -0,0 +1,43 @@ +//! SPKI fingerprint support. + +use der::Writer; +use sha2::{Digest, Sha256}; + +/// Size of a SHA-256 SPKI fingerprint in bytes. +pub(crate) const ...
4
75
18
fc48f0de2e31fa449174004312539816ddff53fa
Tony Arcieri
2022-04-25T22:10:26
ssh-key: add internal `UnixTime` helper type (#613) Adds a type for modeling Unix timestamps for use in OpenSSH certificate validity windows. This puts all time-related code in a single place.
diff --git a/ssh-key/src/certificate.rs b/ssh-key/src/certificate.rs index b28afea6..ca24ca0a 100644 --- a/ssh-key/src/certificate.rs +++ b/ssh-key/src/certificate.rs @@ -5,12 +5,14 @@ mod cert_type; mod field; mod options_map; mod signing_key; +mod unix_time; pub use self::{ builder::Builder, cert_type::Cer...
4
189
52
446d223c52eec5a96151a32b36f55cb835911bd6
Tony Arcieri
2022-04-25T17:05:54
ssh-key: add `certificate::Builder::new_with_validity_times` (#612) Adds a `std` feature-gated constructor method for `certificate::Builder` which allows specifying the validity window in terms of `SystemTime`. This is helpful when computing the validity window relative to the system clock as queried with `System...
diff --git a/ssh-key/src/certificate/builder.rs b/ssh-key/src/certificate/builder.rs index 33abd6d4..f0b66a92 100644 --- a/ssh-key/src/certificate/builder.rs +++ b/ssh-key/src/certificate/builder.rs @@ -1,12 +1,15 @@ //! OpenSSH certificate builder. use super::{CertType, Certificate, Field, OptionsMap, SigningKey};...
2
44
8
c56768be4b3c221c772edb1bd608140f659bccc2
Tony Arcieri
2022-04-24T21:28:39
der: rename `ByteSlice::as_bytes` => `::as_slice` (#610)
diff --git a/der/src/asn1/any.rs b/der/src/asn1/any.rs index b4a4e3bb..61836ddc 100644 --- a/der/src/asn1/any.rs +++ b/der/src/asn1/any.rs @@ -47,7 +47,7 @@ impl<'a> Any<'a> { /// Get the raw value for this [`Any`] type as a byte slice. pub fn value(self) -> &'a [u8] { - self.value.as_bytes() + ...
15
27
28
64d71f53e940e8df78fcb30184095e665c65959e
Tony Arcieri
2022-04-24T17:39:40
der: simplify `Encoder` implementation (#609) Uses a boolean `failed` flag rather than an `Option`. While this eliminates a modicum of safety around using the `Encoder` after an encoding operation has failed, it drastically simplifies the implementation.
diff --git a/der/src/encoder.rs b/der/src/encoder.rs index 5cdb49d2..d39a0ed4 100644 --- a/der/src/encoder.rs +++ b/der/src/encoder.rs @@ -9,7 +9,10 @@ use crate::{ #[derive(Debug)] pub struct Encoder<'a> { /// Buffer into which DER-encoded message is written - bytes: Option<&'a mut [u8]>, + bytes: &'a mut...
1
30
54
a97e5530f1928b80af4d1f3dc62e0d9aeebbd6c5
Tony Arcieri
2022-04-24T15:37:50
der: make `Reader::remaining_len` infallible (#608) Like #607, this makes a length calculation infallible, and also adds a default implementation. It uses saturating arithmetic to avoid panics, with `debug_assert!` to make sure the operands of the calculation make sense. That said, if there is a bug where a re...
diff --git a/der/src/decoder.rs b/der/src/decoder.rs index 72864e21..7a28f9c2 100644 --- a/der/src/decoder.rs +++ b/der/src/decoder.rs @@ -79,7 +79,7 @@ impl<'a> Decoder<'a> { } else if !self.is_finished() { Err(ErrorKind::TrailingData { decoded: self.position, - re...
3
27
14
34451d85156f693c4c294bde17070698b0b61822
Tony Arcieri
2022-04-24T15:12:19
der: make `Reader::input_len` infallible (#607) It was previously fallible to support runtime calculations, but with a bit of refactoring and simplification it's possible to query this for the current `Decoder` type using `ByteSlice::len`. Other readers may need to compute it, but this can be performed as an eag...
diff --git a/der/src/decoder.rs b/der/src/decoder.rs index e8527dea..72864e21 100644 --- a/der/src/decoder.rs +++ b/der/src/decoder.rs @@ -9,10 +9,10 @@ use crate::{ #[derive(Clone, Debug)] pub struct Decoder<'a> { /// Byte slice being decoded. - /// - /// In the event an error was previously encountered t...
4
51
82
f46bdf1c0e55688f6180e755e139182eba7cac45
Tony Arcieri
2022-04-24T04:25:23
der: initial `Reader` trait (#606) Begins moving core decoding functionality into a `Reader` trait. The longer-term goal is to move enough functionality to the trait to support things like one-pass decoding directly from PEM for `DecodeOwned` types.
diff --git a/der/derive/src/choice.rs b/der/derive/src/choice.rs index 1fa6c725..362145de 100644 --- a/der/derive/src/choice.rs +++ b/der/derive/src/choice.rs @@ -96,6 +96,7 @@ impl DeriveChoice { impl<#lt_params> ::der::Decode<#lifetime> for #ident<#lt_params> { fn decode(decoder: &mut ...
17
162
111
ad4a4fc2e6bd822add58e59bf3fddf43616af0f8
Tony Arcieri
2022-04-23T20:08:08
der: initial `Writer` trait (#605) Begins moving core encoding functionality into a `Writer` trait. The longer-term goal is to make the `Encode` trait accept a generic type as a backend, which can enable things like 1-pass PEM encoding or computing key fingerprints by impl'ing `Writer` for a hash function.
diff --git a/der/src/asn1/any.rs b/der/src/asn1/any.rs index 14029197..b4a4e3bb 100644 --- a/der/src/asn1/any.rs +++ b/der/src/asn1/any.rs @@ -2,7 +2,7 @@ use crate::{ asn1::*, ByteSlice, Choice, Decode, DecodeValue, Decoder, DerOrd, EncodeValue, Encoder, Error, - ErrorKind, FixedTag, Header, Length, Result,...
19
73
67
677bc840372a1c23741016a4ee548785d4be7972
Tony Arcieri
2022-04-23T18:04:42
der: add `EncodeRef`/`EncodeValueRef`; remove `OptionalRef` (#604) Adds generic wrapper types for encoding references to types which impl encoding traits: - `EncodeRef`: impls `Encode` for &T where T: `Encode` - `EncodeValueRef`: impls `EncodeValue` and `Tagged` for &T This, in conjunction with impls for `&Opt...
diff --git a/der/derive/src/sequence/field.rs b/der/derive/src/sequence/field.rs index 23c85835..057496e5 100644 --- a/der/derive/src/sequence/field.rs +++ b/der/derive/src/sequence/field.rs @@ -98,7 +98,7 @@ impl SequenceField { !attrs.optional, "`default`, and `optional` are mutually...
7
146
94
41e7e06e8b4b4bd3bf2c41cd347bc555ceeb6f31
Tony Arcieri
2022-04-12T17:05:18
der: use try_fold for length calculation
diff --git a/der/src/asn1/sequence.rs b/der/src/asn1/sequence.rs index 6bdd0b50..4ec7d4ad 100644 --- a/der/src/asn1/sequence.rs +++ b/der/src/asn1/sequence.rs @@ -30,7 +30,7 @@ where self.fields(|fields| { fields .iter() - .fold(Ok(Length::ZERO), |len, field| len + ...
1
1
1
b4b28dcefd68616d4a211118a9b7e5a7cf8aa815
Tony Arcieri
2022-04-12T15:25:04
ssh-key: certificate builder docs and `Field` type (#600) Adds rustdoc which illustrates how to use `certificate::Builder`. Also adds a `certificate::Field` enum used in error reporting, which is more easily matched upon than the previous string-based type.
diff --git a/ssh-key/src/algorithm.rs b/ssh-key/src/algorithm.rs index d252a46f..fc14429d 100644 --- a/ssh-key/src/algorithm.rs +++ b/ssh-key/src/algorithm.rs @@ -342,7 +342,7 @@ impl EcdsaCurve { /// Get the number of bytes needed to encode a field element for this curve. #[cfg(feature = "alloc")] - pub...
6
164
44
a3bf33179cb6f8b708533b9412c14991bf557f34
Tony Arcieri
2022-04-11T23:46:55
ssh-key: enforce min RSA key size; remove keygen from tests (#599) Ensures that all RSA keys which are converted to types by the `rsa` crate (a necessary step for signing/verification) meet a minimum size requirement: 2048-bits. Uses a hardcoded 2048-bit RSA key for certificate verification tests so as to avoid ...
diff --git a/ssh-key/src/private/rsa.rs b/ssh-key/src/private/rsa.rs index b1ca7e5b..3bbdb6e1 100644 --- a/ssh-key/src/private/rsa.rs +++ b/ssh-key/src/private/rsa.rs @@ -11,6 +11,7 @@ use zeroize::Zeroize; use { crate::Error, rand_core::{CryptoRng, RngCore}, + rsa::PublicKeyParts, }; #[cfg(feature = ...
3
76
12
4ef8d1bbddc56f5bad054739c4b1db68d44d5c60
Tony Arcieri
2022-04-11T22:19:11
ssh-key: add certificate validation documentation (#598)
diff --git a/ssh-key/src/certificate.rs b/ssh-key/src/certificate.rs index 5b38fee0..b58d57b0 100644 --- a/ssh-key/src/certificate.rs +++ b/ssh-key/src/certificate.rs @@ -50,8 +50,79 @@ use std::{ /// /// Certificates must be validated before they can be trusted! /// -/// See documentation for [`Certificate::validat...
3
94
2
3dfa6085c0b2815c0d0c2512f2fd88a8c9a6ae20
Tony Arcieri
2022-04-11T19:21:16
ssh-key: fingerprint simplification + SHA-512 support (#596) Simplifies and unifies the fingerprint implementation into a single `Fingerprint` enum type which makes it simple to plug in new hash functions. Also adds SHA-512 support, which makes it possible for the fingerprint methods to be infallible.
diff --git a/ssh-key/src/algorithm.rs b/ssh-key/src/algorithm.rs index 93e009c4..d252a46f 100644 --- a/ssh-key/src/algorithm.rs +++ b/ssh-key/src/algorithm.rs @@ -375,6 +375,7 @@ impl str::FromStr for EcdsaCurve { /// Hashing algorithms a.k.a. digest functions. #[derive(Copy, Clone, Debug, Eq, Hash, PartialEq, Part...
12
103
129
5a7f248c66c1e873152af04c7030e70ea434dd7a
Tony Arcieri
2022-04-09T19:49:09
ssh-key: encoding improvements (#591) - Adds `Reader::finish` method which checks all data has been consumed - Adds `Error::TrailingData` with a `remaining` field which returns the number of bytes of unexpected trailing data at the end of the input - Impls `PrivateKey` encoding in terms of the `Decode`/`Encode` t...
diff --git a/ssh-key/src/certificate.rs b/ssh-key/src/certificate.rs index c0bc1b08..4565c400 100644 --- a/ssh-key/src/certificate.rs +++ b/ssh-key/src/certificate.rs @@ -26,7 +26,11 @@ use { use serde::{de, ser, Deserialize, Serialize}; #[cfg(feature = "std")] -use std::time::{Duration, SystemTime, UNIX_EPOCH}; +u...
5
193
130
9661f23f417cb553fd1ca75c43670afddac27259
Tony Arcieri
2022-04-09T17:20:13
ssh-key: factor out `public::Sk*` types (#589) Factors out Security Key (FIDO/U2F) types which can store the associated `application` string when the `alloc` feature is enabled.
diff --git a/ssh-key/src/public.rs b/ssh-key/src/public.rs index 6a93792a..f8473adf 100644 --- a/ssh-key/src/public.rs +++ b/ssh-key/src/public.rs @@ -11,14 +11,16 @@ mod key_data; mod openssh; #[cfg(feature = "alloc")] mod rsa; +mod sk; -pub use self::{ed25519::Ed25519PublicKey, key_data::KeyData}; +pub use self:...
5
192
62
a39634ff20c085a8f6ad151cd32f530306055a99
Tony Arcieri
2022-04-09T16:44:48
ssh-key: length calculation improvements (#588) Rely on nested calls to `Encode::encoded_len` more heavily when calculating lengths, leaving fewer commented literals to explain how the length calculations work.
diff --git a/ssh-key/src/certificate.rs b/ssh-key/src/certificate.rs index 32974b1c..c0bc1b08 100644 --- a/ssh-key/src/certificate.rs +++ b/ssh-key/src/certificate.rs @@ -429,22 +429,17 @@ impl Encode for Certificate { fn encoded_len(&self) -> Result<usize> { [ self.algorithm.as_certificate_s...
2
8
14
0981b8a0030676c0df021ed3a921fc5192399ce0
Tony Arcieri
2022-04-07T13:20:55
ssh-key: RSA signature support (#583) Support for parsing RFC8332-flavored RSASSA-PKCS#1v1.5 signatures on OpenSSH certificates. Implementing this required further paramaterizing the `Algorithm` enum around a `HashAlg` associated with the `Algorithm::Rsa` variant. Separately, the `CertificateAlg` type was folded...
diff --git a/Cargo.lock b/Cargo.lock index 95eddfd8..304c337c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1167,6 +1167,7 @@ dependencies = [ "rand_core 0.6.3", "sec1", "sha2 0.10.2", + "signature", "subtle", "tempfile", "zeroize", diff --git a/ssh-key/Cargo.toml b/ssh-key/Cargo.toml index e687601b..1797f0c...
14
286
305
639157594aedab428fa7c3df2481c8ddf8d557fd
Tony Arcieri
2022-04-07T04:29:52
ssh-key: refactor encoder/decoder (#582) Refactors encoding to be trait-based, removing most of the previous inherent methods on `Decoder` and `Encoder` and replacing them with impls of the `Encode` and `Decode` traits on the respective types.
diff --git a/ssh-key/src/algorithm.rs b/ssh-key/src/algorithm.rs index 7c7e34b8..dadcdf0f 100644 --- a/ssh-key/src/algorithm.rs +++ b/ssh-key/src/algorithm.rs @@ -77,7 +77,7 @@ impl<T: AlgString> Decode for T { fn decode(decoder: &mut impl Decoder) -> Result<Self> { let mut buf = [0u8; MAX_ALG_NAME_SIZE];...
15
452
326
2633ce6c7c9f330851212ceecc0346a4e91edda1
Tony Arcieri
2022-04-05T15:27:49
der: enable arithmetic and casting clippy lints (#579) Enables the following lints globally: - `clippy::cast_lossless` - `clippy::cast_possible_truncation` - `clippy::cast_possible_wrap` - `clippy::cast_precision_loss` - `clippy::cast_sign_loss` - `clippy::checked_conversions` - `clippy::implicit_saturating_s...
diff --git a/der/src/arrayvec.rs b/der/src/arrayvec.rs index d5cca23d..04fb8134 100644 --- a/der/src/arrayvec.rs +++ b/der/src/arrayvec.rs @@ -123,7 +123,7 @@ impl<'a, T> Iterator for Iter<'a, T> { } fn size_hint(&self) -> (usize, Option<usize>) { - let len = self.elements.len() - self.position; + ...
13
101
46
c8a157bdcee045053f180bfec751226b508cf6a3
Tony Arcieri
2022-04-05T03:00:39
ssh-key: preliminary certificate encoder support (#578) Support for encoding OpenSSH certificates from the `Certificate` type.
diff --git a/ssh-key/src/certificate.rs b/ssh-key/src/certificate.rs index 577a5c6f..4d765198 100644 --- a/ssh-key/src/certificate.rs +++ b/ssh-key/src/certificate.rs @@ -1,7 +1,9 @@ //! OpenSSH certificate support. use crate::{ + checked::CheckedSum, decoder::{Base64Decoder, Decode, Decoder}, + encoder:...
4
142
21
8f565e312a544f123c23d69b89e0a5f48ac70665
Tony Arcieri
2022-04-05T01:47:10
ssh-key: private key checkint improvements (#577) This commit adds support for storing the "checkint" for a private key in the `PrivateKey` type. This makes it possible to reserialize a decoded private key byte-for-byte. Additionally, encryption and random key generation now generate a random "checkint". The ...
diff --git a/ssh-key/src/private.rs b/ssh-key/src/private.rs index 3551ded1..430385f5 100644 --- a/ssh-key/src/private.rs +++ b/ssh-key/src/private.rs @@ -173,6 +173,9 @@ pub struct PrivateKey { /// KDF options. kdf: Kdf, + /// "Checkint" value used to verify successful decryption. + checkint: Option<...
5
45
48
e616297a70d068661a68e34d3c21905ed1ef0222
Tony Arcieri
2022-04-04T13:13:27
ssh-key: move privatekey/comment pair methods to `PrivateKey` (#573) They were previously implemented on `private::KeypairData`, however the `PrivateKey` type is a more natural place to put them. If we ever do want to handle more than one private key inside of a private key file, this is also where they'll have t...
diff --git a/ssh-key/src/kdf.rs b/ssh-key/src/kdf.rs index 4627a9fa..d0b91564 100644 --- a/ssh-key/src/kdf.rs +++ b/ssh-key/src/kdf.rs @@ -113,6 +113,11 @@ impl Kdf { self == &Self::None } + /// Is the KDF configured as anything other than `none`? + pub fn is_some(&self) -> bool { + !self.i...
3
163
189
30c3b9ee99358d14ba7337ed561f100a38f86c8b
Tony Arcieri
2022-04-03T23:18:30
ssh-key: refactor privatekey comment pair handling (#572) Factors all code related to privatekey/coment pair handling into the same methods. Currently specialized to one private key.
diff --git a/ssh-key/src/private.rs b/ssh-key/src/private.rs index 6a16a75b..f0f8ad66 100644 --- a/ssh-key/src/private.rs +++ b/ssh-key/src/private.rs @@ -253,7 +253,7 @@ impl PrivateKey { } let key_data = pem_decoder.decode_length_prefixed(|decoder, _len| { - KeypairData::decode_padded(d...
2
65
34
88362a2fba5260a8b5398bb6e17eac7336ba225b
Tony Arcieri
2022-03-31T22:26:22
ssh-key: checked sum simplification (#570) Minor simplification to the implementation
diff --git a/ssh-key/src/checked.rs b/ssh-key/src/checked.rs index 4d30d557..6e6db30f 100644 --- a/ssh-key/src/checked.rs +++ b/ssh-key/src/checked.rs @@ -16,7 +16,7 @@ where { fn checked_sum(self) -> Result<usize> { self.into_iter() - .try_fold(0usize, |acc, len| acc.checked_add(len)) + ...
1
1
1
06ca504ed4d5ddea3ce42de92728f692a4a65b63
Tony Arcieri
2022-03-30T22:57:53
pem-rfc7468: rename `PemLabel::TYPE_LABEL` => `::PEM_LABEL` (#568) It's more intuitive for the names to match, and also clearer that the label is PEM-related.
diff --git a/der/src/document.rs b/der/src/document.rs index e0cadbbc..cf6ef4d7 100644 --- a/der/src/document.rs +++ b/der/src/document.rs @@ -61,7 +61,7 @@ pub trait Document<'a>: AsRef<[u8]> + Sized + TryFrom<Vec<u8>, Error = Error> { { let (label, der_bytes) = pem::decode_vec(s.as_bytes())?; - ...
10
15
15
3125de9c3e73e0825ac20b573a90efd1e5baccc1
Tony Arcieri
2022-03-30T13:12:34
base64ct: add `Encoding` docs (#566) Adds a list of types which impl the `Encoding` trait
diff --git a/base64ct/src/encoding.rs b/base64ct/src/encoding.rs index aacf63c6..22e84344 100644 --- a/base64ct/src/encoding.rs +++ b/base64ct/src/encoding.rs @@ -9,6 +9,9 @@ use core::str; #[cfg(feature = "alloc")] use alloc::{string::String, vec::Vec}; +#[cfg(doc)] +use crate::{Base64, Base64Bcrypt, Base64Crypt, ...
1
12
0
4ee0ef4e912deaf6a9e49ff8a35358119d10632c
Tony Arcieri
2022-03-30T05:21:00
pem-rfc7468: use `str::from_utf8_unchecked` in `encode` (#565) There's a unsafety versus sidechannel resistence tradeoff in converting PEM output by the `Encoder` type to a `str` (which performs branch-heavy UTF-8 validity checks). This commit introduces a tiny bit of `unsafe` code (the very first `unsafe` code ...
diff --git a/pem-rfc7468/src/encoder.rs b/pem-rfc7468/src/encoder.rs index 5b516dd3..46966190 100644 --- a/pem-rfc7468/src/encoder.rs +++ b/pem-rfc7468/src/encoder.rs @@ -69,7 +69,27 @@ pub fn encode<'o>( let mut encoder = Encoder::new(type_label, line_ending, buf)?; encoder.encode(input)?; let encoded_l...
2
23
3
4891aa27ef4dcaca2c9743c56b7baab91d244c60
Tony Arcieri
2022-03-30T04:45:16
pem-rfc7468: add clippy lints for checked arithmetic and panics (#564) Enforces checked arithmetic (where possible) and that production builds don't use panicking macros. This is a breaking change because it makes previously infallible length calculation functions infallible, so it bumps the version to v0.5.0-pr...
diff --git a/Cargo.lock b/Cargo.lock index ca76bf16..242fb37d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -665,7 +665,7 @@ dependencies = [ [[package]] name = "pem-rfc7468" -version = "0.4.0" +version = "0.5.0-pre" dependencies = [ "base64ct", ] diff --git a/der/Cargo.toml b/der/Cargo.toml index 1a99f636..5a07d...
9
59
36
4693a2d470c8e3d3782bfcd6b305820f54d2ba60
Tony Arcieri
2022-03-30T03:57:16
base64ct: bound `Encoding` on `Variant` (#562) The `Encoding` trait defines this crate's public API, however internally it's implemented in terms of `Variant`. `Variant` is a sealed trait. Previously it was exposed as the bound on the generic parameter of `Decoder` and `Encoder`. This is technically a breaking...
diff --git a/base64ct/src/decoder.rs b/base64ct/src/decoder.rs index ef17c325..cb635db5 100644 --- a/base64ct/src/decoder.rs +++ b/base64ct/src/decoder.rs @@ -3,7 +3,6 @@ use crate::{ encoding, line_ending::{CHAR_CR, CHAR_LF}, - variant::Variant, Encoding, Error::{self, InvalidLength}, MIN_...
3
9
21
131956af6b25fa2c69968e5b5935598417e49318
Tony Arcieri
2022-03-30T03:25:46
const-oid: add clippy lints for checked arithmetic and panics (#561) Enforces checked arithmetic (where possible) and that production builds don't use panicking macros. For now some of the arithmetic is annotated with an explicit allow, along with an explanation of why it shouldn't overflow.
diff --git a/const-oid/src/arcs.rs b/const-oid/src/arcs.rs index b3f9f244..e0281146 100644 --- a/const-oid/src/arcs.rs +++ b/const-oid/src/arcs.rs @@ -66,9 +66,15 @@ impl<'a> Arcs<'a> { let mut arc_bytes = 0; loop { - match self.oid.as_bytes().get(offset + arc_byte...
7
76
18
4303cc4630755e2fcc45f2aab6607d486ef14fa6
Tony Arcieri
2022-03-30T02:02:23
ssh-key: add `PrivateKey::encrypt_with` (#560) Adds an encryption method which accepts explicit `Cipher` and `Kdf` parameters. The `PrivateKey::encrypt` method is composed in terms of `encrypt_with`.
diff --git a/ssh-key/src/private.rs b/ssh-key/src/private.rs index 4a3a4cdf..f64f8c81 100644 --- a/ssh-key/src/private.rs +++ b/ssh-key/src/private.rs @@ -367,8 +367,8 @@ impl PrivateKey { }) } - /// Attempt to encrypt an unencrypted private key using the provided - /// password to derive an encry...
1
26
9
8cf3a7abdac543366a12651e48666983a9d229be
Tony Arcieri
2022-03-30T01:25:17
base64ct+der+ssh-key: enable more clippy lints (#559) Add lints against panicking
diff --git a/base64ct/src/lib.rs b/base64ct/src/lib.rs index bd45f515..3f02e77f 100644 --- a/base64ct/src/lib.rs +++ b/base64ct/src/lib.rs @@ -6,9 +6,11 @@ html_root_url = "https://docs.rs/base64ct/1.4.1" )] #![doc = include_str!("../README.md")] -#![forbid(clippy::unwrap_used)] #![warn( clippy::integer_ar...
3
11
5
1bd3384f8270fe6c62cbe915ba523837cda816cb
Tony Arcieri
2022-03-30T00:42:55
ssh-key: add internal `CheckedSum` trait (#558) Simplifies performing checked arithmetic of `usize`. In the context of this crate, it's primarily useful for clarity and eliminating boilerplate when summing multiple lengths.
diff --git a/ssh-key/src/algorithm.rs b/ssh-key/src/algorithm.rs index 34afeeee..487b2eae 100644 --- a/ssh-key/src/algorithm.rs +++ b/ssh-key/src/algorithm.rs @@ -1,6 +1,7 @@ //! Algorithm support. use crate::{ + checked::CheckedSum, decoder::{Decode, Decoder}, encoder::{Encode, Encoder}, Error, R...
16
99
81
350b3b5daef3b50d15380755e8ae11385e2bb8a8
Tony Arcieri
2022-03-29T23:06:03
base64ct: add `clippy::integer_arithmetic` lint (#557) Ensures that (almost) all arithmetic is checked. The lint is disabled in several places that need further review. Each of these places has an accompanying TODO.
diff --git a/base64ct/src/decoder.rs b/base64ct/src/decoder.rs index cf1c7e35..ef17c325 100644 --- a/base64ct/src/decoder.rs +++ b/base64ct/src/decoder.rs @@ -121,7 +121,7 @@ impl<'i, E: Variant> Decoder<'i, E> { // If there's data in the block buffer, use it if !self.block_buffer.is_empty() {...
5
61
27
91f1ac75a1a489513fa378b2c97a4fdbae85bd73
Tony Arcieri
2022-03-29T22:02:36
der: enable clippy's panic lints (#556) Enable the available static analysis that `clippy` provides to ensure the crate is free of macros that cause panics.
diff --git a/der/src/asn1/real.rs b/der/src/asn1/real.rs index f69ec96a..d0fb3c58 100644 --- a/der/src/asn1/real.rs +++ b/der/src/asn1/real.rs @@ -1,4 +1,5 @@ -//! ASN.1 `NULL` support. +//! ASN.1 `REAL` support. + use crate::{ str_slice::StrSlice, ByteSlice, DecodeValue, Decoder, EncodeValue, Encoder, FixedTag, ...
2
16
3
dc96aa255e58efe37a1b76baa5af9cfe990d4f7a
daxpedda
2022-03-29T13:24:05
crypto-serde: Improve documentation (#545)
diff --git a/crypto-serde/Cargo.toml b/crypto-serde/Cargo.toml index 0459929e..8094d88d 100644 --- a/crypto-serde/Cargo.toml +++ b/crypto-serde/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "crypto-serde" description = "Serde serializer/deserializer helpers used by the RustCrypto project" -version = "0.0.0" +version =...
4
121
12
f7cfb7b7a8afc9e1931886534b8cb0ada72160f6
Tony Arcieri
2022-03-29T00:04:23
ssh-key: factor `KeypairData` into its own module (#550) The `private` module it was previously inside of had grown quite large.
diff --git a/ssh-key/src/private.rs b/ssh-key/src/private.rs index 4ad3dce6..0a3e234b 100644 --- a/ssh-key/src/private.rs +++ b/ssh-key/src/private.rs @@ -9,12 +9,14 @@ mod dsa; #[cfg(feature = "ecdsa")] mod ecdsa; mod ed25519; +mod keypair; #[cfg(feature = "alloc")] mod rsa; #[cfg(feature = "ecdsa")] pub use ...
2
388
364
7432ef6c7c8f4556ff00aebcc26ec8a46bb8c455
Tony Arcieri
2022-03-28T23:21:19
ssh-key: enforce checked arithmetic (#549) Code is now warning-free under the `clippy::integer_arithmetic` lint. Additionally adds a check that decoded ciphertexts are properly aligned to the expected block size.
diff --git a/ssh-key/src/algorithm.rs b/ssh-key/src/algorithm.rs index 96129e35..34afeeee 100644 --- a/ssh-key/src/algorithm.rs +++ b/ssh-key/src/algorithm.rs @@ -57,7 +57,7 @@ impl<T: AlgString> Decode for T { impl<T: AlgString> Encode for T { fn encoded_len(&self) -> Result<usize> { - Ok(4 + self.as_re...
17
79
36
4319b0d1868c28fead9a5154e2c55e25631cd1ca
Tony Arcieri
2022-03-28T19:59:15
ssh-key: add back `Cipher::None` variant (#548) It was originally removed in #544, replacing it with `Option<Cipher>`, however there are various properties it'd be nice to attach to `Cipher` which can't be modeled with an `Option`, namely the block size.
diff --git a/ssh-key/src/algorithm.rs b/ssh-key/src/algorithm.rs index cd8911e9..96129e35 100644 --- a/ssh-key/src/algorithm.rs +++ b/ssh-key/src/algorithm.rs @@ -55,23 +55,6 @@ impl<T: AlgString> Decode for T { } } -impl<T: AlgString> Decode for Option<T> { - fn decode(decoder: &mut impl Decoder) -> Result<...
9
150
152
ac77e539d345e1c98fced1236d4ccbc74eb3eeeb
Tony Arcieri
2022-03-28T16:46:51
ssh-key: add `Decoder::decode_length_prefixed` (#547) Adds a helper method for decoding length-prefixed data which calls a provided decoder function/closure and then afterward validates that the correct amount of data was read. This could potentially be adapted to use a special decoder wrapper which enforces tha...
diff --git a/Cargo.lock b/Cargo.lock index e485f483..8cf34f65 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -459,10 +459,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "418d37c8b1d42553c93648be529cb70f920d3baf8ef469b74b9638df426e0b4c" dependencies = [ "cfg-if", - "js-sys", "libc", ...
8
74
63
0dca45e8e3b542582a9bc4f51af7605d4e871337
Tony Arcieri
2022-03-27T19:01:57
ssh-key: rename `CipherAlg` => `Cipher`; refactoring (#544) - Renames the type to `Cipher` - Models the property of `PrivateKey` as `Option<Cipher>`. This eliminates the need to return `Option` from every method as the type always represents a valid cipher. - Extracts `Cipher` into a `cipher` module - Move de...
diff --git a/ssh-key/src/algorithm.rs b/ssh-key/src/algorithm.rs index 7e195571..6ea10468 100644 --- a/ssh-key/src/algorithm.rs +++ b/ssh-key/src/algorithm.rs @@ -7,9 +7,6 @@ use crate::{ }; use core::{fmt, str}; -/// AES-256 in counter (CTR) mode -const AES256_CTR: &str = "aes256-ctr"; - /// bcrypt-pbkdf const B...
6
184
147
a7de19cb93119673791b8159e2dff0453ed94882
daxpedda
2022-03-27T18:57:36
Fix `json::from_reader` (#543)
diff --git a/crypto-serde/Cargo.lock b/crypto-serde/Cargo.lock deleted file mode 100644 index 00d2f74e..00000000 --- a/crypto-serde/Cargo.lock +++ /dev/null @@ -1,7 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "cmov" -version = ...
6
134
76
22ee30c3e653ff4e11126e8cb55371efd8031308
Tony Arcieri
2022-03-27T18:34:01
ssh-key: various naming fixups (#542) - Removes `PrivateKey::kdf_alg` in favor of `.kdf().algorithm()` - Removes "ossh_*"/"OSSH_*" prefixes from test fixtures
diff --git a/ssh-key/src/private.rs b/ssh-key/src/private.rs index ac29b3a8..5297cccc 100644 --- a/ssh-key/src/private.rs +++ b/ssh-key/src/private.rs @@ -24,7 +24,7 @@ pub use self::{ use crate::{ decoder::{Decode, Decoder}, encoder::{Encode, Encoder}, - public, Algorithm, CipherAlg, Error, Kdf, KdfAlg, ...
4
152
145
004ec70501079a063c132d77d9482b88290d4362
daxpedda
2022-03-27T17:50:26
crypto-serde: implement slice deserializing with buffer (#540)
diff --git a/crypto-serde/src/slice.rs b/crypto-serde/src/slice.rs index 0cceaea7..5edd1c7a 100644 --- a/crypto-serde/src/slice.rs +++ b/crypto-serde/src/slice.rs @@ -1,14 +1,13 @@ //! TODO //! crypto-serde implementation for slices. -use serde::{Serialize, Serializer}; +use core::fmt; + +use serde::de::{Error, Vis...
1
66
8
42d998e3cf84101381513f1bdaf14efc655115eb
Tony Arcieri
2022-03-27T17:46:54
ssh-key: consolidate `KdfAlg` and `KdfOpts` into `Kdf` (#541) Since the KDF algorithm and options are located side-by-side in private keys, and this crate models them as effectively a single `enum`, this commit makes that a first-class arrangement, combining the two into a unified `pub enum Kdf`. This allows the...
diff --git a/ssh-key/src/kdf.rs b/ssh-key/src/kdf.rs index f7af11d0..fb233f01 100644 --- a/ssh-key/src/kdf.rs +++ b/ssh-key/src/kdf.rs @@ -3,7 +3,7 @@ //! These are used for deriving an encryption key from a password. use crate::{ - decoder::Decoder, + decoder::{Decode, Decoder}, encoder::{Encode, Encode...
5
83
75
c9853e97639db4a50b7a0eee7fb10e0123e5deec
Tony Arcieri
2022-03-27T17:12:40
ssh-key: private key decryption support (#539) Preliminary support for decrypting encrypted OpenSSH private keys, with support for `bcrypt-pbkdf` as the KDF and `aes256-ctr` as the encryption cipher. Tested against an example encrypted private key (`id_ed25519.enc`) produced using the `ssh-keygen` utility: ...
diff --git a/Cargo.lock b/Cargo.lock index 35d4c51a..9bebfa02 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -54,6 +54,17 @@ dependencies = [ "proptest", ] +[[package]] +name = "bcrypt-pbkdf" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3806a8db60cf56efee531616a34a...
11
297
72
f13d73408a0c1cc4fc88820958ae36b9bc159d6f
Chris
2022-03-27T16:05:56
der: support for the REAL type (#346) Covers sections 8.5 and 11.3 of ITU-T X.690 (02/2021) Source: https://www.oss.com/asn1/resources/books-whitepapers-pubs/larmouth-asn1-book.pdf, page 174 Signed-off-by: Christopher Rabotin <christopher.rabotin@gmail.com>
diff --git a/der/src/asn1.rs b/der/src/asn1.rs index fd9a753d..0dbed1bb 100644 --- a/der/src/asn1.rs +++ b/der/src/asn1.rs @@ -15,6 +15,7 @@ mod octet_string; mod oid; mod optional; mod printable_string; +mod real; mod sequence; mod sequence_of; mod set_of; diff --git a/der/src/asn1/integer.rs b/der/src/asn1/inte...
5
987
6
e72cf744d1e8c07b9443d6da98e9abb01237f57f
daxpedda
2022-03-27T16:00:00
crypto-serde: Implement separate handling for arrays (#538) This introduces allocation-free de/serialization for fixed sized arrays.
diff --git a/Cargo.lock b/Cargo.lock index 27dac014..35d4c51a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -314,6 +314,7 @@ dependencies = [ "hex-literal", "proptest", "serde", + "serde-json-core", "serde_json", "toml", "zeroize", @@ -961,6 +962,16 @@ dependencies = [ "serde_derive", ] +[[package]] +nam...
11
726
213
7971777a4e147726a3abc0907d96c6ae9c6e9110
Tony Arcieri
2022-03-26T13:38:13
ssh-key: bcrypt-pbkdf KDF options decoder/encoder (#537) Support for parsing bcrypt-pbkdf's KDF options into `KdfOpts::Bcrypt` and encoding them into an output private key document
diff --git a/ssh-key/src/algorithm.rs b/ssh-key/src/algorithm.rs index 3d20fb2b..c536990f 100644 --- a/ssh-key/src/algorithm.rs +++ b/ssh-key/src/algorithm.rs @@ -7,13 +7,10 @@ use crate::{ }; use core::{fmt, str}; -#[cfg(feature = "alloc")] -use alloc::vec::Vec; - /// AES-256 in counter (CTR) mode const AES256_C...
5
128
83
201eac418736162489dc4403e25c9ae1f6d4699e
Tony Arcieri
2022-03-26T02:39:29
ssh-key: encrypted private key encoding support (#536)
diff --git a/ssh-key/src/private.rs b/ssh-key/src/private.rs index 68789d60..d7d1bd66 100644 --- a/ssh-key/src/private.rs +++ b/ssh-key/src/private.rs @@ -52,7 +52,7 @@ const PADDING_BYTES: [u8; 7] = [1, 2, 3, 4, 5, 6, 7]; const PEM_LINE_WIDTH: usize = 70; /// Block size to use for unencrypted keys. -const UNENCRYP...
2
78
34
e6d705c1b43fc6b730271888838f89c2d940fb2f
Tony Arcieri
2022-03-25T22:28:36
crypto-serde: `alloc` feature (#534) Adds a baseline heapless `no_std` profile which is capable of serializing binary data without `alloc`.
diff --git a/crypto-serde/Cargo.toml b/crypto-serde/Cargo.toml index 40d68565..a6adfbe3 100644 --- a/crypto-serde/Cargo.toml +++ b/crypto-serde/Cargo.toml @@ -12,11 +12,11 @@ edition = "2021" rust-version = "1.56" [dependencies] -base16ct = { version = "0.1.1", default-features = false, features = ["alloc"] } -serd...
6
55
17
c77b6d891027c77016581041eaa8f798439830c2
Tony Arcieri
2022-03-25T21:33:11
crypto-serde: add `serialize_hex_*_or_bin` functions (#533) Adds static functions which can serialize any `T: AsRef<[u8]>`, which avoids making an intermediate copy unless the underlying format is human-readable.
diff --git a/crypto-serde/src/lib.rs b/crypto-serde/src/lib.rs index a314a583..5b4f446f 100644 --- a/crypto-serde/src/lib.rs +++ b/crypto-serde/src/lib.rs @@ -24,6 +24,34 @@ use serde::{ #[cfg(feature = "zeroize")] use zeroize::Zeroize; +/// Serialize the given type as lower case hex when using human-readable +/// ...
1
31
8
fbfaa13038f91d4251b3410a0e29fb28b3f29da2
Tony Arcieri
2022-03-25T21:10:46
crypto-serde: proptests (#532) Adds initial proptests which ensure that randomly generated inputs round trip back to their original values
diff --git a/Cargo.lock b/Cargo.lock index c53dd81a..d22ab72d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -312,6 +312,7 @@ dependencies = [ "bincode", "ciborium", "hex-literal", + "proptest", "serde", "serde_json", "toml", diff --git a/crypto-serde/Cargo.toml b/crypto-serde/Cargo.toml index c85de472..40d685...
5
41
0
609fdd2b91f77e5e36543e4bef567e6e62e36e4a
Tony Arcieri
2022-03-25T16:14:17
der: add `DecodeOwned` marker trait (#529) Adds a marker trait for types which can be `der::Decode`d without borrowing any data from the input. It's useful for cases where borrowing from the input isn't possible. For example, if we were to add on-the-fly PEM decoding as proposed in #525.
diff --git a/der/src/decode.rs b/der/src/decode.rs index 61ee2fe5..a3e854fd 100644 --- a/der/src/decode.rs +++ b/der/src/decode.rs @@ -35,6 +35,18 @@ where } } +/// Marker trait for data structures that can be decoded from DER without +/// borrowing any data from the decoder. +/// +/// This is primarily useful ...
2
13
1
2d9e4326cf09e7520af53fcd8fe2be644275f3bc
Tony Arcieri
2022-03-25T15:15:15
der: rename `decodable`/`encodable` modules => `decode`/`encode` (#528) Followup to #523, which renamed the traits but not the modules they're defined in. Additionally factors the `DecodeValue`/`EncodeValue` traits into these modules (originally defined in the `value` module, which is removed in this PR).
diff --git a/der/src/decodable.rs b/der/src/decode.rs similarity index 75% rename from der/src/decodable.rs rename to der/src/decode.rs index 12e8f392..61ee2fe5 100644 --- a/der/src/decodable.rs +++ b/der/src/decode.rs @@ -1,6 +1,6 @@ //! Trait definition for [`Decode`]. -use crate::{DecodeValue, Decoder, FixedTag, ...
4
33
41
cfd093b76c46d5529c0addb29cfeebc3861a7fbe
Tony Arcieri
2022-03-22T14:33:22
spki: impl `ValueOrd` for `SubjectPublicKeyInfo` (#522) Closes #309
diff --git a/spki/src/spki.rs b/spki/src/spki.rs index a9e60504..2e3ececf 100644 --- a/spki/src/spki.rs +++ b/spki/src/spki.rs @@ -1,7 +1,8 @@ //! X.509 `SubjectPublicKeyInfo` use crate::{AlgorithmIdentifier, Error, Result}; -use der::{asn1::BitString, Decodable, Decoder, Encodable, Sequence}; +use core::cmp::Order...
1
19
5
d42432a3cbd78584df8ed8cb25d125a92a76ebb7
bstrie
2022-03-17T13:34:33
feat(sec1): add default cargo feature for disabling point module (#516) This allows users who aren't using EncodedPoint to omit dependencies on generic-array, typenum, and version_check.
diff --git a/sec1/Cargo.toml b/sec1/Cargo.toml index 5ea2118a..6a88e660 100644 --- a/sec1/Cargo.toml +++ b/sec1/Cargo.toml @@ -16,10 +16,9 @@ edition = "2021" rust-version = "1.57" [dependencies] -generic-array = { version = "0.14.4", default-features = false } - # optional dependencies der = { version = "=0.6.0-...
3
12
10
2524cbcca72073d5076770cf035a72e221a7d74c
Tony Arcieri
2022-03-16T02:19:51
ssh-key: SHA-256 fingerprint support (#513) Optional support for computing SHA-256 fingerprints of keys. Uses the `Encoder` trait to write data to `Sha256`, allowing OTF computation of key fingerprints.
diff --git a/Cargo.lock b/Cargo.lock index c4ab75f3..f0e216d2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -976,6 +976,7 @@ dependencies = [ "hex-literal", "pem-rfc7468", "sec1", + "sha2", "subtle", "tempfile", "zeroize", diff --git a/ssh-key/Cargo.toml b/ssh-key/Cargo.toml index d16b2589..c4fc15b8 100644 --...
13
338
32
c4f54362d636d545a4a5cc6127497b6cea668b8d
Tony Arcieri
2022-03-14T19:11:02
x509-cert v0.0.2 (#512)
diff --git a/Cargo.lock b/Cargo.lock index 8b6bb420..c4ab75f3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1216,7 +1216,7 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "x509-cert" -version = "0.0.1" +version = "0.0.2" dependencies = [ "const-oid", "der", di...
3
3
3
17301ea13d3232e79dc2249e6b2a718de4e30d63
Tony Arcieri
2022-03-14T14:48:43
ssh-key: refactor encoding (#510) Factors encoding support into separate `decoder` and `encoder` modules
diff --git a/ssh-key/src/algorithm.rs b/ssh-key/src/algorithm.rs index e5b2b2c5..802b0064 100644 --- a/ssh-key/src/algorithm.rs +++ b/ssh-key/src/algorithm.rs @@ -1,7 +1,8 @@ //! Algorithm support. use crate::{ - base64::{Decode, DecoderExt, Encode, EncoderExt, StrField}, + decoder::{Decode, Decoder}, + en...
16
207
188
6dc17851e41ff60abcbd0e03498f03af800bf4b5
Tony Arcieri
2022-03-14T13:20:23
Bump prerelease versions (#509) Cuts releases of the following crates (mainly for the `pem-rfc7468` v0.4.0 release): - `der` v0.6.0-pre.3 - `der_derive` v0.6.0-pre.3 - `pkcs5` v0.5.0-pre.1 - `pkcs8` v0.9.0-pre.1 - `sec1` v0.3.0-pre.1 - `spki` v0.6.0-pre.2
diff --git a/Cargo.lock b/Cargo.lock index eca1c1ac..e6e86020 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -286,7 +286,7 @@ dependencies = [ [[package]] name = "der" -version = "0.6.0-pre.2" +version = "0.6.0-pre.3" dependencies = [ "const-oid", "der_derive", @@ -299,7 +299,7 @@ dependencies = [ [[package]] ...
11
28
28
1d30cc210fa1156beff05379b0a0493e4902a40f
bstrie
2022-03-12T01:58:44
chore: bump crate prerelease versions (#493) This bumps the prerelease versions for the following crates: base64ct const-oid der der_derive pem-rfc7468 spki
diff --git a/Cargo.lock b/Cargo.lock index 88f6e1f3..77b2e9c2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -286,7 +286,7 @@ dependencies = [ [[package]] name = "der" -version = "0.6.0-pre.1" +version = "0.6.0-pre.2" dependencies = [ "const-oid", "der_derive", @@ -299,7 +299,7 @@ dependencies = [ [[package]] ...
15
25
25
6c26435f7dd2d1738d93d72a92a1cfb7120e8d5a
Tony Arcieri
2022-03-11T23:50:42
const-oid: test improvements (#506) Test specific error return values as opposed to just checking `is_err`
diff --git a/const-oid/src/lib.rs b/const-oid/src/lib.rs index 76730abb..5c6a9f4f 100644 --- a/const-oid/src/lib.rs +++ b/const-oid/src/lib.rs @@ -119,10 +119,11 @@ impl ObjectIdentifier { pub fn from_bytes(ber_bytes: &[u8]) -> Result<Self> { let len = ber_bytes.len(); - if !(2..=Self::MAX_SIZE)....
2
38
13
caa7a98bd0a82dbb617891afffd4da3b4798d6d6
Tony Arcieri
2022-03-11T23:04:50
const-oid: add `ObjectIdentifier::parent` (#505) Adds a method for getting the parent of a given OID in the hierarchy. This also changes the `ObjectIdentifier::from_arcs` method to take `Arc`s by value rather than reference.
diff --git a/const-oid/src/lib.rs b/const-oid/src/lib.rs index 14bf22e0..76730abb 100644 --- a/const-oid/src/lib.rs +++ b/const-oid/src/lib.rs @@ -105,10 +105,10 @@ impl ObjectIdentifier { } /// Parse an OID from a slice of [`Arc`] values (i.e. integers). - pub fn from_arcs<'a>(arcs: impl IntoIterator<It...
2
28
9
d1bed1c93bca14e12aa12393819b5edca784e477
Tony Arcieri
2022-03-11T22:38:39
const-oid: add `ObjectIdentifier::push_arc` (#504) Impl'd as a `const fn`.
diff --git a/const-oid/src/encoder.rs b/const-oid/src/encoder.rs index 2c62eb68..877b6ed2 100644 --- a/const-oid/src/encoder.rs +++ b/const-oid/src/encoder.rs @@ -32,7 +32,7 @@ enum State { } impl Encoder { - /// Create a new encoder initialized to an empty default state + /// Create a new encoder initialized...
3
32
5
3d96b7fe02fcb126f5b8901869de168e7fba9497
Tony Arcieri
2022-03-11T21:48:30
ssh-key: remove PEM references in public keys Public keys are not encoded as PEM.
diff --git a/ssh-key/src/private.rs b/ssh-key/src/private.rs index 1cdb174f..eca85d51 100644 --- a/ssh-key/src/private.rs +++ b/ssh-key/src/private.rs @@ -182,7 +182,7 @@ impl PrivateKey { Ok(private_key) } - /// Encode OpenSSH-formatted (PEM) public key. + /// Encode OpenSSH-formatted (PEM) priva...
2
4
4
db0ce07636addad59b8b3844a0f5bb10c6a79508
Tony Arcieri
2022-03-11T21:07:29
ssh-key: make `authorized_keys` types owned (#502) Owned types are easier to work with. This commit retains the config options parser in a heapless mode but requires `alloc` to actually store them. Since they were the only borrowed part of `authorized_key::Entry`, it can become owned as well. This allows `A...
diff --git a/ssh-key/src/algorithm.rs b/ssh-key/src/algorithm.rs index ec6c83d7..e5b2b2c5 100644 --- a/ssh-key/src/algorithm.rs +++ b/ssh-key/src/algorithm.rs @@ -295,9 +295,9 @@ impl str::FromStr for KdfAlg { // TODO(tarcieri): stub! #[derive(Clone, Debug, Default, Eq, PartialEq)] #[non_exhaustive] -pub struct KdfO...
5
220
93
a5ee7e90cf524e261fd6a63816c9cdfe55a66128
Tony Arcieri
2022-03-11T19:51:13
base64ct: rename `Decoder::decoded_len` => `::remaining_len` (#500) This is technically a breaking change, but this method was only just introduced in the v1.4.0 release which occurred less than 24h ago, so changing things now, yanking that release, and cutting a replacement v1.4.1 release should hopefully not caus...
diff --git a/base64ct/src/decoder.rs b/base64ct/src/decoder.rs index 3c0cadab..83bfb17d 100644 --- a/base64ct/src/decoder.rs +++ b/base64ct/src/decoder.rs @@ -37,7 +37,7 @@ pub struct Decoder<'i, E: Variant> { line_reader: LineReader<'i>, /// Length of the remaining data after Base64 decoding. - decoded_...
5
31
29
4d23bf2c64bf8ed88df1327ac5b05c061207a909
Tony Arcieri
2022-03-11T19:23:08
ssh-key: improved padding check (#499)
diff --git a/ssh-key/src/private.rs b/ssh-key/src/private.rs index ee81b3f1..5dd4cbe7 100644 --- a/ssh-key/src/private.rs +++ b/ssh-key/src/private.rs @@ -125,8 +125,15 @@ impl PrivateKey { // Begin decoding unencrypted list of N private keys // See OpenSSH PROTOCOL.key § 3 - // TODO(tarcieri...
1
32
23
88c8ad0615ade43257112a56e946fa9ccc283b58
Tony Arcieri
2022-03-11T14:17:54
sec1: make DER feature optional (#497) This allows the SEC1 encoded point types to be used without pulling in the `der` crate and its associated dependencies
diff --git a/sec1/Cargo.toml b/sec1/Cargo.toml index d75baf6b..c3a3f790 100644 --- a/sec1/Cargo.toml +++ b/sec1/Cargo.toml @@ -16,10 +16,10 @@ edition = "2021" rust-version = "1.57" [dependencies] -der = { version = "=0.6.0-pre.1", features = ["oid"], path = "../der" } generic-array = { version = "0.14.4", default...
7
21
6
89056822e0c3d7710c12c4612dcb26e20636d2a8
Tony Arcieri
2022-03-11T03:16:55
ssh-key: validate private key padding bytes (#495)
diff --git a/ssh-key/src/private.rs b/ssh-key/src/private.rs index a758cc17..b38d3149 100644 --- a/ssh-key/src/private.rs +++ b/ssh-key/src/private.rs @@ -119,6 +119,7 @@ impl PrivateKey { let checkint1 = pem_decoder.decode_u32()?; let checkint2 = pem_decoder.decode_u32()?; + // TODO(tarcieri...
1
29
4
de38555013715b6d1fc20e71c9a57fc5b50bcdfa
Nathaniel McCallum
2022-03-10T22:26:52
feat(x509): add `Validity::from_now()` helper method (#492) Signed-off-by: Nathaniel McCallum <nathaniel@profian.com>
diff --git a/x509/src/time.rs b/x509/src/time.rs index 843d6220..02a69818 100644 --- a/x509/src/time.rs +++ b/x509/src/time.rs @@ -122,6 +122,21 @@ pub struct Validity { pub not_after: Time, } +impl Validity { + /// Creates a `Validity` which starts now and lasts for `duration`. + #[cfg(feature = "std")] ...
1
15
0
46365005aee9cd68c893eca49f6d83d32eb2d754
Nathaniel McCallum
2022-03-10T21:43:05
chore: clean up extension testing (#491) Signed-off-by: Nathaniel McCallum <nathaniel@profian.com>
diff --git a/x509/tests/pkix_extensions.rs b/x509/tests/pkix_extensions.rs index 8f292a2c..8f93a283 100644 --- a/x509/tests/pkix_extensions.rs +++ b/x509/tests/pkix_extensions.rs @@ -1,5 +1,6 @@ //! Certificate tests -use der::asn1::{BitString, UIntBytes}; +use const_oid::AssociatedOid; +use der::asn1::UIntBytes; use...
1
80
185
f3a88fb6be3b4f42c7eac1c9fc7988018b2b31af
Nathaniel McCallum
2022-03-10T21:42:38
chore(x509): enable unused_lifetimes and unused_qualifications lints (#490) Also, clean up the types they warn about. Signed-off-by: Nathaniel McCallum <nathaniel@profian.com>
diff --git a/x509/src/anchor.rs b/x509/src/anchor.rs index 25ee2111..1edda7e5 100644 --- a/x509/src/anchor.rs +++ b/x509/src/anchor.rs @@ -84,7 +84,7 @@ pub struct CertPathControls<'a> { pub policy_set: Option<CertificatePolicies<'a>>, #[asn1(context_specific = "2", tag_mode = "IMPLICIT", optional = "true")...
3
10
5
b076c0d1c4ae63b3d13c80abcd0386399869e5a9
Nathaniel McCallum
2022-03-10T20:27:24
feat(x509): impl AssociatedOid for all extensions (#489) Signed-off-by: Nathaniel McCallum <nathaniel@profian.com>
diff --git a/x509/src/ext/pkix.rs b/x509/src/ext/pkix.rs index fd2576f2..de0553db 100644 --- a/x509/src/ext/pkix.rs +++ b/x509/src/ext/pkix.rs @@ -15,6 +15,7 @@ use crate::attr::AttributeTypeAndValue; pub use access::{AccessDescription, AuthorityInfoAccessSyntax, SubjectInfoAccessSyntax}; pub use authkeyid::Authority...
13
169
81
20485f70ca9291c5cc577f02d0e8005df1434f6e
Nathaniel McCallum
2022-03-10T19:39:51
feat(x509): implement RFC 4514 string serialization for x509 names (#464) Signed-off-by: Nathaniel McCallum <nathaniel@profian.com>
diff --git a/x509/src/attr.rs b/x509/src/attr.rs index ae87e661..cd706c9f 100644 --- a/x509/src/attr.rs +++ b/x509/src/attr.rs @@ -1,7 +1,11 @@ //! Attribute-related definitions as defined in X.501 (and updated by RFC 5280). +use alloc::vec::Vec; +use core::fmt::{self, Write}; + +use const_oid::db::DB; use der::asn...
7
470
46
3d2e15b79bd893d91cc7592d6eac70cf7dc95166
Nathaniel McCallum
2022-03-10T19:30:07
chore: remove non-pkix extensions (#487) The intent isn't to throw these away. But rather to resurrect them when: 1. Their OIDs are added to the OIDDB. 2. We know where to put them. Signed-off-by: Nathaniel McCallum <nathaniel@profian.com>
diff --git a/x509/src/ext.rs b/x509/src/ext.rs index 0d3b5d0e..d717a7c8 100644 --- a/x509/src/ext.rs +++ b/x509/src/ext.rs @@ -3,7 +3,6 @@ use der::Sequence; use spki::ObjectIdentifier; -pub mod other; pub mod pkix; /// Extension as defined in [RFC 5280 Section 4.1.2.9]. diff --git a/x509/src/ext/other.rs b/x50...
3
10
39
bf749b7b32118968a80b4d0b405c897867351ca5
Nathaniel McCallum
2022-03-10T19:25:52
feat(x509): add extension query methods to `TbsCertificate` (#481) Signed-off-by: Nathaniel McCallum <nathaniel@profian.com>
diff --git a/x509/src/certificate.rs b/x509/src/certificate.rs index 4d0ee186..f93ab6fa 100644 --- a/x509/src/certificate.rs +++ b/x509/src/certificate.rs @@ -2,8 +2,9 @@ use crate::{name::Name, time::Validity}; use alloc::vec::Vec; +use const_oid::AssociatedOid; use der::asn1::{BitString, UIntBytes}; -use der::{...
1
36
1
4ac8df903307f0344b613a56f07aed923564279d
Nathaniel McCallum
2022-03-10T18:23:54
fix(oiddb): don't filter out branch nodes (#486) Some of these branch nodes are actually used for types. Signed-off-by: Nathaniel McCallum <nathaniel@profian.com>
diff --git a/const-oid/oiddbgen/src/asn1.rs b/const-oid/oiddbgen/src/asn1.rs index 0d3f741b..a403375b 100644 --- a/const-oid/oiddbgen/src/asn1.rs +++ b/const-oid/oiddbgen/src/asn1.rs @@ -1,4 +1,4 @@ -use std::collections::{BTreeMap, HashSet}; +use std::collections::BTreeMap; use regex::Regex; @@ -89,15 +89,8 @@ im...
2
127
8
0677590d865c56684c6a1adddc93758b6c2471d8
Nathaniel McCallum
2022-03-10T18:19:53
chore(x509): remove unhelpful doc strings (#478) Signed-off-by: Nathaniel McCallum <nathaniel@profian.com>
diff --git a/x509/src/attr.rs b/x509/src/attr.rs index 0836dd76..ae87e661 100644 --- a/x509/src/attr.rs +++ b/x509/src/attr.rs @@ -44,11 +44,9 @@ pub type AttributeValue<'a> = Any<'a>; /// [RFC 2986 Section 4]: https://datatracker.ietf.org/doc/html/rfc2986#section-4 /// [RFC 5280 Appendix A.1]: https://datatracker.ie...
6
7
18
403e41360cf77eb8bed2c406b3f31932d1932986
Tony Arcieri
2022-03-09T00:35:31
ssh-key: add `PrivateKey::public_key` and `From` conversions (#485) Support for getting the `PublicKey` associated with a `PrivateKey`, along with `From` conversions between them and the various intermediate types.
diff --git a/ssh-key/src/private.rs b/ssh-key/src/private.rs index b6d60af4..e4598fc1 100644 --- a/ssh-key/src/private.rs +++ b/ssh-key/src/private.rs @@ -23,7 +23,7 @@ pub use self::{ use crate::{ base64::{Decode, DecoderExt}, - public, Algorithm, CipherAlg, Error, KdfAlg, KdfOptions, Result, + public, A...
4
72
1
86b250f52fb9dc636394b991aea10f70147242ee
Tony Arcieri
2022-03-08T17:36:15
ssh-key: trait-based decoder/encoder (#484) Changes the `Decode` and `Encode` traits to accept `impl DecoderExt`/`impl EncoderExt` (respectively) as parameters. This abstracts over the decoder/encoder type, which may be raw Base64 (as used by public keys) or PEM (as used by private keys).
diff --git a/ssh-key/src/algorithm.rs b/ssh-key/src/algorithm.rs index 59e7bac8..c8738cd0 100644 --- a/ssh-key/src/algorithm.rs +++ b/ssh-key/src/algorithm.rs @@ -1,7 +1,7 @@ //! Algorithm support. use crate::{ - base64::{self, Decode, DecoderExt, Encode, EncoderExt}, + base64::{Decode, DecoderExt, Encode, En...
14
79
72
2faa16be9d2925a7bc6ad51328db26e4c64fab61
Tony Arcieri
2022-03-08T16:11:44
ssh-key: factor out `DecoderExt`/`EncoderExt` traits (#483) Implements the SSH key wire format in terms of traits rather than newtypes. Traits can be used with either the raw Base64 or PEM encoders.
diff --git a/pem-rfc7468/src/decoder.rs b/pem-rfc7468/src/decoder.rs index 6b75ba23..d2d32a66 100644 --- a/pem-rfc7468/src/decoder.rs +++ b/pem-rfc7468/src/decoder.rs @@ -119,11 +119,6 @@ impl<'i> Decoder<'i> { pub fn is_finished(&self) -> bool { self.base64.is_finished() } - - /// Convert into th...
10
61
113
e5c8d004fcb4bd47a477cc82284477c3623907ea
Tony Arcieri
2022-03-08T14:39:07
pem-rfc7468: return `str` from `encode` (#482) Changes the return type of `encode` from `[u8]` to `str`. It's easy to go the other direction with `.as_bytes()`.
diff --git a/pem-rfc7468/src/encoder.rs b/pem-rfc7468/src/encoder.rs index 8ff43ce2..a49a4aa9 100644 --- a/pem-rfc7468/src/encoder.rs +++ b/pem-rfc7468/src/encoder.rs @@ -5,6 +5,7 @@ use crate::{ ENCAPSULATION_BOUNDARY_DELIMITER, POST_ENCAPSULATION_BOUNDARY, PRE_ENCAPSULATION_BOUNDARY, }; use base64ct::{Base64, ...
2
13
4
619b5645f485d62f9c14eea258647446ad760f09
Nathaniel McCallum
2022-03-08T01:39:39
feat(der): clean up Newtype implementations (#480) Signed-off-by: Nathaniel McCallum <nathaniel@profian.com>
diff --git a/der/derive/src/newtype.rs b/der/derive/src/newtype.rs index e29df132..921ee713 100644 --- a/der/derive/src/newtype.rs +++ b/der/derive/src/newtype.rs @@ -75,18 +75,16 @@ impl DeriveNewtype { } } - #limpl ::core::ops::Deref for #ltype { - type Target...
3
6
8
eb8de315714c9f5fca4f976b260a4b62e244f139
Nathaniel McCallum
2022-03-07T22:49:09
feat(x509): add ExtensionReq type (#472) Signed-off-by: Nathaniel McCallum <nathaniel@profian.com>
diff --git a/x509/src/request.rs b/x509/src/request.rs index 1955933a..40618351 100644 --- a/x509/src/request.rs +++ b/x509/src/request.rs @@ -1,9 +1,14 @@ //! PKCS#10 Certification Request types +use crate::ext::Extension; use crate::{attr::Attributes, name::Name}; +use alloc::vec::Vec; + +use const_oid::db::rfc...
1
20
1
5a0982586dc59b9ba95c7709298edd5038a00626
Nathaniel McCallum
2022-03-07T21:54:05
fix(oiddb): improve regex to find more OIDs (#471) Signed-off-by: Nathaniel McCallum <nathaniel@profian.com>
diff --git a/const-oid/oiddbgen/src/asn1.rs b/const-oid/oiddbgen/src/asn1.rs index ccd2bd2d..0d3f741b 100644 --- a/const-oid/oiddbgen/src/asn1.rs +++ b/const-oid/oiddbgen/src/asn1.rs @@ -9,7 +9,7 @@ pub struct Asn1Parser { impl Asn1Parser { const DEF: &'static str = r"(?mx) - (?P<name>[a-zA-Z][a-zA-Z0-9-...
2
452
11
c705639c94e1187e5982d46dfca9f5f1322d96cd
Nathaniel McCallum
2022-03-07T21:53:29
feat(const-oid): add the AssociatedOid trait (#479) Signed-off-by: Nathaniel McCallum <nathaniel@profian.com>
diff --git a/const-oid/src/lib.rs b/const-oid/src/lib.rs index 6b7bdd00..62258cc0 100644 --- a/const-oid/src/lib.rs +++ b/const-oid/src/lib.rs @@ -29,6 +29,12 @@ pub use crate::{ use crate::encoder::Encoder; use core::{fmt, str::FromStr}; +/// A trait which associates an OID with a type. +pub trait AssociatedOid { ...
1
6
0
a9cc4832a5e8cb6fc0b483ddc2c4d2de873ca483
Nathaniel McCallum
2022-03-07T21:38:36
feat(spki): impl PartialOrd for AlgorithmIdentifier (#476) Co-authored-by: Carl Wallace <crwallace1970@gmail.com>
diff --git a/spki/src/algorithm.rs b/spki/src/algorithm.rs index 8997c4a6..ef2c3955 100644 --- a/spki/src/algorithm.rs +++ b/spki/src/algorithm.rs @@ -14,7 +14,7 @@ use der::{Decodable, DecodeValue, Decoder, DerOrd, Encodable, Header, Sequence, /// ``` /// /// [RFC 5280 Section 4.1.1.2]: https://tools.ietf.org/html/...
1
1
1
4ca4b07ff3930f7f5e106525c1ad3960136891fd
Nathaniel McCallum
2022-03-07T21:12:42
feat(x509): add PkiPath type (#466) Signed-off-by: Nathaniel McCallum <nathaniel@profian.com>
diff --git a/x509/src/certificate.rs b/x509/src/certificate.rs index 791dc38f..5250901a 100644 --- a/x509/src/certificate.rs +++ b/x509/src/certificate.rs @@ -1,7 +1,9 @@ use crate::{name::Name, time::Validity}; +use alloc::vec::Vec; + use der::asn1::{BitString, UIntBytes}; -use der::{Enumerated, Sequence}; +use de...
2
18
2
f0f4c727f85376431d2336e47d3cb9ef6cd8f09e
Nathaniel McCallum
2022-03-07T20:52:07
feat(x509): re-export der crate (#473) Signed-off-by: Nathaniel McCallum <nathaniel@profian.com>
diff --git a/x509/src/lib.rs b/x509/src/lib.rs index cf02acca..f0cc8371 100644 --- a/x509/src/lib.rs +++ b/x509/src/lib.rs @@ -14,6 +14,8 @@ extern crate alloc; #[cfg(feature = "std")] extern crate std; +pub use der; + pub mod anchor; pub mod attr; pub mod ext;
1
2
0
3058e91eb628d6a9c9c668b385d2f2f0d7d828e2
Nathaniel McCallum
2022-03-07T20:51:03
test(x509): fixup an ObjectIdentifier::new_unwrap() instance (#477) Co-authored-by: Carl Wallace <crwallace1970@gmail.com>
diff --git a/x509/tests/certificate.rs b/x509/tests/certificate.rs index fc4d9aa6..e11c463d 100644 --- a/x509/tests/certificate.rs +++ b/x509/tests/certificate.rs @@ -162,10 +162,9 @@ fn decode_oversized_oids() { o1str, "1.3.6.1.4.1.311.21.8.11672683.15464451.6967228.369088.2847561.77.4994205.11305917...
1
2
3
57bf2cabc391fd2dd7fe582ce14809ca64873fef
Tony Arcieri
2022-03-07T18:32:59
pem-rfc7468: impl `io::Write` for `Encoder` (#474) Allows using the `std::io` API to encode data as PEM.
diff --git a/pem-rfc7468/src/decoder.rs b/pem-rfc7468/src/decoder.rs index 5ce6da31..6b75ba23 100644 --- a/pem-rfc7468/src/decoder.rs +++ b/pem-rfc7468/src/decoder.rs @@ -61,19 +61,6 @@ pub fn decode_label(pem: &[u8]) -> Result<&str> { Ok(Encapsulation::try_from(pem)?.label()) } -/// Check for PEM headers in th...
3
50
13
6c7860fa606f0f12f9e0fb3d851fc7c10da66e7a
Nathaniel McCallum
2022-03-07T17:28:21
feat(oiddb): make name search case-insensitive (#469) Signed-off-by: Nathaniel McCallum <nathaniel@profian.com>
diff --git a/const-oid/src/db.rs b/const-oid/src/db.rs index 8199e2ab..9491d2f6 100644 --- a/const-oid/src/db.rs +++ b/const-oid/src/db.rs @@ -35,6 +35,24 @@ const fn eq(lhs: &[u8], rhs: &[u8]) -> bool { true } +/// A const implementation of case-insensitive ASCII equals. +const fn eq_case(lhs: &[u8], rhs: &[u8...
1
20
2
f7270a05f6294528cca6f12d5a27d85f71d01213
Nathaniel McCallum
2022-03-07T16:44:37
chore(x509): remove oids now defined in the oiddb (#465) Signed-off-by: Nathaniel McCallum <nathaniel@profian.com>
diff --git a/Cargo.lock b/Cargo.lock index 6120dd7d..5d3d6abb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1216,6 +1216,7 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" name = "x509" version = "0.0.1" dependencies = [ + "const-oid", "der", "flagset", "hex-literal", diff --git ...
5
36
210
8c0318a9b19181e0da336da712c13a5d8ee79b6b
Nathaniel McCallum
2022-03-07T15:38:03
fix(der): manually impl Default for SetOfVec (#468) Signed-off-by: Nathaniel McCallum <nathaniel@profian.com>
diff --git a/der/src/asn1/set_of.rs b/der/src/asn1/set_of.rs index b9314ad7..93a07dd0 100644 --- a/der/src/asn1/set_of.rs +++ b/der/src/asn1/set_of.rs @@ -177,7 +177,7 @@ impl<'a, T> ExactSizeIterator for SetOfIter<'a, T> {} /// and depends on `alloc` support. #[cfg(feature = "alloc")] #[cfg_attr(docsrs, doc(cfg(fea...
1
11
1