Tony Arcieri (iqlusion)
e6cea2eca6
Rename key module to piv ( #277 )
...
Now that the crate is named `yubikey` rather than `yubikey-piv`, it
makes more sense to call this module out as PIV-related functionality.
2021-07-12 10:42:55 -07:00
Tony Arcieri (iqlusion)
e249e91297
Replace getrandom with rand_core ( #276 )
...
`rand_core::OsRng` provides a facade over `getrandom` which simplifies
error handling.
2021-07-12 09:58:58 -07:00
Tony Arcieri (iqlusion)
1765e11bc0
Flatten API ( #274 )
...
Re-exports types from the toplevel instead of placing them in individual
modules (often which only contain one type).
This makes the API easier for users to navigate, while still retaining
the same module structure internally.
Additionally, this commit uses the `uuid` crate for modeling UUIDs.
2021-07-12 08:40:31 -07:00
Tony Arcieri (iqlusion)
1228d16439
Rename settings::BoolValue => ConfigValue; refactor/cleanup ( #272 )
...
Renames the type used for storing a configuration setting.
Also changes the internal functions to use `Option<ConfigValue>` as the
return value, rather than comparing to a default value, which makes them
slightly more idiomatic.
2021-07-11 14:53:54 -07:00
Tony Arcieri (iqlusion)
de51b0cc46
Add Result alias ( #271 )
...
Adds a `yubikey::Result` alias with `yubikey::Error` as the error type.
Since we only have one `Error` type, this simplifies the return types
where a `Result` is returned.
2021-07-11 09:44:08 -07:00
Tony Arcieri (iqlusion)
1051eaf26d
Rename Ccc::cccid => Ccc::card_id ( #270 )
...
Better reflects the return type
2021-07-11 09:00:58 -07:00
Tony Arcieri (iqlusion)
a1d9c7afc5
Fix clippy::upper_case_acronyms nits; small cleanups ( #269 )
...
Renames the following to match Rust idioms:
- `APDU` => `Apdu`
- `CCC` => `Ccc`
- `CHUID` => `ChuId`
Also removes `Copy` from `mscmap::Container`, which fixes a clippy lint
about its usage of `to_bytes`.
2021-07-11 08:51:25 -07:00
Tony Arcieri (iqlusion)
2c06626c25
Bump elliptic-curve to v0.10; MSRV 1.51+ ( #268 )
...
Also updates the following:
- `p256` v0.9
- `p384` v0.8
2021-07-11 08:14:14 -07:00
Tony Arcieri (iqlusion)
a2a912fc3c
Rename to yubikey.rs ( #267 )
...
We now have publishing rights to the `yubikey` crate.
This commit renames the project to yubikey.rs
Co-authored-by: Tony Arcieri <bascule@gmail.com >
2021-07-10 17:02:59 -07:00
Tony Arcieri (iqlusion)
865353f4da
RustCrypto dependency updates; MSRV 1.47+ ( #251 )
...
Updates the following dependencies:
- `des` v0.7
- `elliptic-curve` v0.9
- `hmac` v0.11
- `pbkdf2` v0.8
- `p256` v0.8
- `p384` v0.7
2021-04-30 07:09:24 -07:00
Shella Stephens
d33e80faea
Update rsa to v0.4.0 & fix cargo audit ( #246 )
...
* Bump rsa to v0.4.0
2021-03-29 09:12:33 -07:00
Tony Arcieri (iqlusion)
43dfc06875
yubikey-piv v0.3.0 ( #240 )
2021-03-22 09:45:19 -07:00
str4d
18e3636161
Replace MgmKey::set with MgmKey::{set_default, set_manual} ( #224 )
...
* Add MgmKey::set_default method
This wipes any metadata related to derived and PIN-protected management
keys, returning the management key to its default state.
* Transaction::set_mgm_key: Take touch requirement as bool
The Option<u8> was inherited from the original C code's usage of an
unsigned char. We don't need that flexibility, because only two cases
are supported.
* Replace MgmKey::set with MgmKey::set_manual
MgmKey::set_default is now implemented as a wrapper around
MgmKey::set_manual, as they both require clearing metadata related to
derived and PIN-protected management keys.
2021-02-01 09:27:04 -08:00
str4d
9d1da84233
Create typed structs for PIN-protected and admin metadata ( #223 )
...
MgmKey::set_protected and YubiKey::set_pin_last_changed both contained
bugs resulting from the conversion of C pointer logic (incorrect buffer
management). The new Metadata struct holds its own buffer, avoiding the
problem.
Also adds a protected management key integration test.
2021-01-31 09:54:13 -08:00
Tony Arcieri (iqlusion)
8b896ab4de
Rename default git branch from develop to main ( #217 )
2021-01-30 07:11:18 -08:00
str4d
24b035008c
Improve self-signed certificates ( #207 )
...
Adds support for:
- A hierarchical SubjectName field.
- Certificate extensions.
2021-01-11 07:49:15 -08:00
Shella Stephens
08185c5ec9
Bump der-parser, nom, x509-parser ( #194 )
...
* Bump der-parser from 4.1.0 to 5.0.0
Bumps [der-parser](https://github.com/rusticata/der-parser ) from 4.1.0 to 5.0.0.
- [Release notes](https://github.com/rusticata/der-parser/releases )
- [Changelog](https://github.com/rusticata/der-parser/blob/master/CHANGELOG.md )
- [Commits](https://github.com/rusticata/der-parser/compare/der-parser-4.1.0...der-parser-5.0.0 )
Signed-off-by: dependabot[bot] <support@github.com >
* Bump der-parser, nom, x509-parser
* clippy
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-07 07:20:58 -08:00
Tony Arcieri (iqlusion)
fc62fc286d
yubikey-piv v0.1.0 ( #180 )
2020-10-19 08:26:05 -07:00
Tony Arcieri
17ae87f741
Bump RustCrypto dependencies
...
Updates all RustCrypto crates (`crypto-mac`, `des`, `hmac`, `pbkdf2`)
to the latest versions.
2020-10-18 10:12:09 -07:00
Tony Arcieri
cbe60413cb
Bump p256 to v0.5; p384 to v0.4; MSRV 1.44+
2020-10-17 13:54:40 -07:00
Shella Stephens
860c163eb9
Update rsa to v0.3 & other dependencies ( #142 )
...
* Update rsa to v0.3 & other dependencies
2020-06-15 16:40:33 -07:00
BlackHoleFox
556b9cb671
Remove dependency on regular num-bigint
2020-06-09 18:42:56 -05:00
BlackHoleFox
6e3560c10f
Switch to buffer alias
2020-06-08 22:09:57 -05:00
BlackHoleFox
0f907ebd5c
Implement RSA key precomputation
2020-06-08 21:48:25 -05:00
BlackHoleFox
acc96e988f
Refactor key import function
2020-06-01 23:07:18 -05:00
Tony Arcieri
5e52f93f4a
Remove unnecessary parens
2020-05-04 08:45:40 -07:00
Tony Arcieri
926450b573
Cargo.lock: update dependencies
2020-02-15 07:03:21 -08:00
Tony Arcieri
27504890d7
Bump elliptic-curve from 0.2.0 to 0.3.0
2020-01-07 15:11:27 -05:00
Jack Grigg
b5e774cf2b
pcsc::Error::NoReadersAvailable -> Error::NotFound in YubiKey::open*
...
This provides a consistent user experience between no readers being
connected, and readers being connected but not the one we are trying to
open.
2019-12-18 11:03:30 -06:00
Jack Grigg
422f89b3e9
Extract ChangeRefAction enum
2019-12-16 06:26:41 -06:00
Jack Grigg
985b1d272c
Add a serial number wrapper struct with Into conversions
2019-12-15 17:50:25 +00:00
Jack Grigg
58acfe6330
Simplify issuer and subject stringification
2019-12-15 17:42:47 +00:00
Jack Grigg
1a95a5f921
Fix PKCS#1 v1.5 signature generation
2019-12-15 17:09:09 +00:00
Jack Grigg
8ac78cafb8
Certificate::generate_self_signed
2019-12-15 10:59:50 +00:00
Jack Grigg
5e8a014be2
Expose certificate serial and issuer
2019-12-15 10:35:22 +00:00
Jack Grigg
d44a32453c
Write certificate TLVs into correct offsets
2019-12-15 10:33:01 +00:00
Jack Grigg
d113c1f4b9
impl<'a> TryFrom<&'a [u8]> for Certificate
2019-12-11 02:44:40 +00:00
Jack Grigg
2eff313064
Fix bug in key::generate and document weirdness
...
Bug was introduced in #73 when starting offsets were overlooked. Digging
into why they were there led to uncovering the weird not-quite-ASN.1
format that the YubiKey returns generated pubkeys in.
2019-12-11 02:26:23 +00:00
Jack Grigg
41b10d1f23
Convert certificate info into an enum
2019-12-11 02:21:49 +00:00
Jack Grigg
4c2ecea721
Replace GeneratedKey with PublicKeyInfo
2019-12-11 00:31:31 +00:00
Jack Grigg
e73607e662
Rename Certificate::new to Certificate::from_bytes
2019-12-11 00:30:39 +00:00
Tony Arcieri
08897ec7c9
cli: print reader name as part of status command
2019-12-10 08:43:33 -08:00
Jack Grigg
1bf3b13e52
Add missing untested feature gates
2019-12-10 13:31:48 +00:00
Jack Grigg
8385dda201
Check buffer length in set_length
2019-12-10 13:22:21 +00:00
Jack Grigg
363bdc4351
Extract TLV writing into serialization::Tlv
2019-12-10 13:17:01 +00:00
Jack Grigg
da828abe3c
Extract TLV parsing into serialization::Tlv
2019-12-10 13:14:39 +00:00
Tony Arcieri
78d5f33695
cli: add status command
...
Provides equivalent functionality to `yubico-piv-tool`
2019-12-09 18:00:34 -08:00
Carl Wallace
855f2ecb24
add try_from String for SlotIds in support of CLI
2019-12-08 19:25:27 -05:00
Tony Arcieri
4663cffb96
yubikey: add open_by_serial method
...
Support for opening a `YubiKey` with a specific serial number.
2019-12-08 12:12:03 -08:00
Tony Arcieri
0a100acdd2
Rename container module to mscmap
...
Better reflects what it actually is.
2019-12-08 10:01:00 -08:00