|
| 1 | +## Upgrading from 0.17 to 0.18 |
| 2 | + |
| 3 | +The major changes in version 0.18 are described here. |
| 4 | + |
| 5 | +### Cargo and dependencies |
| 6 | + |
| 7 | +Dependencies: |
| 8 | + |
| 9 | +- `nom` updated to 8.0 `asn1-rs` updated to 0.8 |
| 10 | + - note that `bigint` is enabled in `asn1-rs` import |
| 11 | + - `bitvec` is present by default |
| 12 | +- `der-parser` dependency (and re-export) removed |
| 13 | + |
| 14 | +### Global API |
| 15 | + |
| 16 | +- The default parsing trait is now `DerParser`. The parsing function `.parse_der()` now expects an `Input` object, which can be built from bytes using `Input::from`. All X.509 objects and sub-objects will provide this trait |
| 17 | + + This improves error handling (`Input` tracks offsets) and helps simplifying code for parsers |
| 18 | +- The legacy trait `FromDer` is still provided for compatibility, for top-level objects. |
| 19 | + |
| 20 | +### Changed struct fields and methods |
| 21 | + |
| 22 | +General: |
| 23 | +- `UniqueIdentifier` has no lifetime anymore |
| 24 | +- Removed constant `MAX_OBJECT_SIZE`. This is not required in this crate since `asn1-rs` takes care of reading valid data. |
| 25 | +- Module `utils.rs` has been removed, functions are now part of `x509.rs` |
| 26 | + |
| 27 | +CSR: |
| 28 | +- `X509CertificationRequest` extensions contains a **SET** of values, not a single value |
| 29 | +- `csr.requested_extensions()` returns an `Iterator`, not an `Option<Iterator>` |
| 30 | + |
| 31 | +Extensions: |
| 32 | + |
| 33 | +- `InhibitAnyPolicy` is now an anonymous struct: |
| 34 | +`InhibitAnyPolicy { skip_certs: 2 }` => `InhibitAnyPolicy(2)` |
| 35 | +- `SubjectAlternativeName` iteration changed from `&san.general_names` to `san.general_names()` (or `.0`) |
| 36 | + |
| 37 | +### Changes in types from `asn1-rs` |
| 38 | + |
| 39 | +The following changes are not part of this crate, but are exposed in `Any` objects: |
| 40 | + |
| 41 | +- Any.data() now has type `Input` |
| 42 | + - Use `.as_bytes2()` to get `&[u8]` |
| 43 | + + Note: recoding `.as_bytes()` or `.as_ref()` may seem useless, but this is necessary to work around problem with lifetimes. |
| 44 | +- `BitString` does not have a lifetime parameter anymore |
| 45 | + - `bitstring.data` is replaced by `bitstring.as_raw_slice()` |
| 46 | + |
| 47 | +### Changes in types from `nom` |
| 48 | + |
| 49 | +- The nom `Parser` trait has changed (it now uses associated types) |
| 50 | +- Add `.parse`, for ex: `length_data(be_u16).parse(i)` |
| 51 | + |
| 52 | +### Notes for crate developers |
| 53 | + |
| 54 | +- Many parsers have been replaced by derive attributes (like `Sequence` or `Choice`) when possible. This reduces risks of errors and makes code more easier to maintain |
| 55 | + + Encoders are not derived for now |
| 56 | +- File `extensions/mod.rs` has been split in multiple files |
0 commit comments