Commit graph

230 commits

Author SHA1 Message Date
Heiko Schaefer
93baf42b84
Re-organize log levels.
- card operations are logged at "info" level
- APDU command/response are logged at "debug"
- other log output is at "trace"
2022-03-22 12:47:42 +01:00
Heiko Schaefer
63b47cffdc
Update/remove dependency on env_logger 2022-03-22 11:27:48 +01:00
Heiko Schaefer
0b4a18b136
Fix clippy lints 2022-03-06 16:15:13 +01:00
Heiko Schaefer
1d33870aa6
openpgp-card 0.2.1 release 2022-02-28 11:08:15 +01:00
Heiko Schaefer
421e4d155f
Make OpenPgp "Send + Sync" 2022-02-28 11:06:00 +01:00
Heiko Schaefer
af0410191e
Implement Display for Lang 2022-02-25 18:56:37 +01:00
Heiko Schaefer
a8637f48b1
Bump versions 2022-02-24 21:25:47 +01:00
Heiko Schaefer
56d03ffca6
Drop use of "anyhow". 2022-02-24 21:25:47 +01:00
Heiko Schaefer
986094fac8
Update/improve crate level documentation. 2022-02-24 21:25:47 +01:00
Heiko Schaefer
e9235164c8
Rename PIN-related functions for clarity 2022-02-24 21:25:47 +01:00
Heiko Schaefer
8ab3a43d6e
Use Error::InternalError less, introduce additional specific error variants. 2022-02-24 21:25:47 +01:00
Heiko Schaefer
088bb88a02
Consistently model pin as &[u8] in openpgp-card.
Fixes #22
2022-02-24 21:25:47 +01:00
Heiko Schaefer
96167f6530
Move OpenPGP card functionality into OpenPgp/OpenPgpTransaction.
This separates backend access (implemented in CardBackend and CardTransaction) from OpenPGP card operations.

Fixes #7
2022-02-24 21:25:47 +01:00
Heiko Schaefer
074bab321e
Add notes that "check_pw1 causes the error counter to decrease" (see #23) on some cards 2022-02-24 21:25:47 +01:00
Heiko Schaefer
12a6a77b8d
CardTransaction::method should not return a Response. Most don't have a return value, the rest should return Vec<u8> instead.
Fixes #19
2022-02-24 21:25:47 +01:00
Heiko Schaefer
636813279b
Reformatted to conform to vanilla rustfmt. 2022-02-24 21:25:47 +01:00
Neal H. Walfield
c4119ae77f
For CardBackend and CardTransaction, implement T for Box<T>
- Allow a Box<dyn CardBackend> to be used in all contexts where a
    type that implements CardBackend can be used.

  - Likewise for CardTransaction.
2022-02-18 17:45:09 +01:00
Heiko Schaefer
282b16fdba
Cleanup: move ?Sized bounds to "where". 2022-02-18 15:09:33 +01:00
Heiko Schaefer
c23f23c619
Introduce the new CardBackend trait.
A CardBackend represents a card without an open transaction (a CardTransaction implementation can be acquired from a CardBackend).
2022-02-18 15:06:31 +01:00
Heiko Schaefer
5133051626
Rename CardClient -> CardTransaction. 2022-02-18 15:06:31 +01:00
Heiko Schaefer
5b2979874b
Implement methods on the CardClient trait rather than on dyn CardClient.
This patch is largely based on input and an MR by @nwalfield.
2022-02-18 15:06:31 +01:00
Heiko Schaefer
06ad7772a6
Remove remnants of card_app. 2022-02-16 18:21:49 +01:00
Heiko Schaefer
dcf73bd86d
More explicit data type Lang for language. 2022-02-16 10:02:35 +01:00
Heiko Schaefer
889eedbb79
Remove cardholder_certificate from the public CardClient API, for now (until we learn of actual use cases for this part of the spec). 2022-02-15 16:07:05 +01:00
Heiko Schaefer
574d7be765
Use byte-array data types for url, name, lang in openpgp-card. 2022-02-15 15:34:52 +01:00
Heiko Schaefer
2480745088
Move implementation of low-level OpenPGP functionality from CardApp to CardClient. 2022-02-14 17:46:16 +01:00
Heiko Schaefer
5e7fcd079b
Change CardApp API: take &mut CardClient parameter for all calls (instead of owning a CardClientBox).
This way, clients can exert control over the state of the CardClient, e.g. to combine CardApp operations in a PCSC transaction.
2022-02-14 17:43:07 +01:00
Heiko Schaefer
748c334403
Implement TxClient to use pcsc with transactions (transaction opening code is duplicated) 2022-02-14 17:43:07 +01:00
Heiko Schaefer
476f46dacc
Simplify get_data() by splitting it into a one-byte- and two-byte-tag variant. 2022-02-09 13:34:43 +01:00
Heiko Schaefer
8a899afb9d
Fix/clean up limitation of data length. 2022-02-09 12:50:42 +01:00
Heiko Schaefer
40f279684e
workaround and test for "ledger nano s" quirks 2022-02-08 12:28:17 +01:00
Heiko Schaefer
b04295543e
Gracefully handle missing algorithm_information in generate_key_simple() 2021-12-10 22:42:37 +01:00
Heiko Schaefer
413e8b7d2a
Bump versions for releases. 2021-12-02 18:45:46 +01:00
Heiko Schaefer
4ff2cf8b2e
Normalize naming: always use algo_info instead of algo_list. 2021-12-02 18:35:54 +01:00
Heiko Schaefer
281bf403e3
Normalize naming of "private use" DO related fn. 2021-12-02 18:35:54 +01:00
Heiko Schaefer
133b290ae6
Adjust getter fn naming. 2021-12-02 18:35:54 +01:00
Heiko Schaefer
1dc178a7b2
Documentation edits. 2021-12-02 18:35:53 +01:00
Heiko Schaefer
ddcd888834
Refactor determine_ecc_attrs() for reusability.
Use in AlgoSimple::determine_algo().
2021-12-02 16:58:50 +01:00
Heiko Schaefer
c37c34e525
Remove bitsize of e parameter for RSA from SimpleAlgo.
Use determine_rsa_attrs() to get a concrete Algo for a specific card from an AlgoSimple.
2021-12-02 14:08:17 +01:00
Heiko Schaefer
10bdb32c45
Refactor determine_rsa_attrs() to be more easily reusable for key generation. 2021-12-02 13:13:28 +01:00
Heiko Schaefer
9739074b63
Minor error handling/messaging cleanups. 2021-12-01 22:23:22 +01:00
Heiko Schaefer
576110ecce
Update comments. 2021-12-01 22:21:28 +01:00
Heiko Schaefer
ecd862e23f
Remove "get_" prefix from getter function names (to better conform with Rust API Guidelines https://rust-lang.github.io/api-guidelines). 2021-12-01 19:11:22 +01:00
Heiko Schaefer
9d87cddb60
Minor tweaks in Display impl for Algo. 2021-12-01 00:06:39 +01:00
Heiko Schaefer
2709b4ad39
Implement pinpad feature detection and pinpad support for verify/modify (of pw1 and pw3) in pcsc backend.
Extend CardCaps to contain pw1_max_len and pw3_max_len (and initialize these values from ARD).

Add pinpad_verify(), pinpad_modify(), feature_verify()/feature_modify() to CardClient API.
Expose in card_app (and openpgp-card-sequoia card API).

Adjust opgpcard, opgpcard-pin to ue pinpad reader when available.
2021-11-30 22:51:18 +01:00
Heiko Schaefer
9e9cddc225
Implement setting of 'identity' for NitroKey Start. 2021-11-29 18:33:23 +01:00
Heiko Schaefer
9de79477b9
Implement get_firmware_version (probably YubiKey specific) 2021-11-23 20:38:46 +01:00
Heiko Schaefer
9930e7d420
Clarified: the spec says the card will format accordingly. 2021-11-22 19:24:09 +01:00
Heiko Schaefer
e695e8171a
Implement 'Display' for PublicKeyMaterial 2021-11-16 19:18:34 +01:00
Heiko Schaefer
90ae9398ed
Adjust the backend API and interaction with openpgp-card some more. 2021-11-12 18:47:56 +01:00