der-parser
Parser/encoder for ASN.1 BER/DER data
10.0.0
146M downloads/mo
#622 most downloaded on crates.io
rusticata/der-parser
What this package is like to depend on
Last release 2 years ago
no release in 18 months
Release timing varies
gaps range from 2 weeks to 11 months
Most releases are documented
notes for 35 of 51 stable releases
3 versions withdrawn
withdrawn after publishing
9 years old
60 releases · first in 2017
0 releases in the last 12 months
see the full history below
Release timeline
60 releases · Mar 2017 to Jan 2025Releases
latest 60-
10.0.021 Jan 2025Release notes
Open source →Changed/Fixed
Breaking change:
-
BerObject: convert BmpString data to
&[u8]to properly handle UTF-16 data (#76) -
Upgrade
asn1-rsto 0.7.0 -
Rename feature "bitvec" to "as_bitvec" and update to bitvec 1.0 (#73)
-
Serialize: fix possible wrong encoding of length if exactly 128 (#77)
Thanks
- Daniel McCarney
-
-
9.0.023 Feb 2024Release notes
Open source →Changed/Fixed
- Upgrade
asn1-rsto 0.6.0 - Set MSRV to 1.63.0
- Update hex-literal to 0.4.0
- Implement
BerObject::try_from(Any)(#67)
- Upgrade
-
8.2.007 Mar 2023Release notes
Open source →What's Changed
- Fix parser name to
parse_der_visiblestringforVisibleString(Closes #64).
Keep previous function for compatibility (mark it as deprecated). - Fix clippy warnings (rustc 1.67.1)
- Update test-case from 2.0 to 3.0
Full Changelog: der-parser-8.1.0...der-parser-8.2.0
Release notes
Open source →Changed/Fixed
- Fix parser name to
parse_der_visiblestringforVisibleString(Closes #64). Keep previous function for compatibility (mark it as deprecated). - Fix clippy warnings (rustc 1.67.1)
- Update test-case from 2.0 to 3.0
- Fix parser name to
-
8.1.024 May 2022Release notes
Open source →Changed/Fixed
- Upgrade
asn1-rsto 0.5.0 (new features only: only increment minor number)
- Upgrade
-
8.0.011 Apr 2022Release notes
Open source →Changed/Fixed
- Upgrade
asn1-rsto 0.4.0 This causes an increment of the major number, becauseasn1-rsis re-exported
- Upgrade
-
7.0.010 Feb 2022Release notes
Open source →This release marks the beginning of the merge with the
asn1-rscrate. This will break things.However, this is necessary, because the
asn1-rscrate is much cleaner and supports more types
and features (like serialization, custom derive, etc.).
Ultimately, this crate will become a frontend toasn1-rs, that will be optional: crate users can
switch toasn1-rsand use it directly.Changed/Fixed
MSRV: The minimum supported rust version is now 1.53.
BerObjectHeader:BerSizehas been renamed toLengthBerClasshas been renamed toClassBerTaghas been renamed toTag- Header fields are now private. Getters/setters have been added, and must be used to access/modify fields
BerObjectContent:Unknownvariant now contains anAnyobject, with both the header and object contentPrivatevariant has been merged intoUnknownBmpString,GeneralString,GraphicString,T61String,VideotexStringandObjectDescriptorare now decodedGeneralizedTimeandUtcTimeare now decoded
BerError:- Add error types
UnexpectedClassandUnexpectedTag - Store expected and found item in error to help debugging
- Keep
InvalidTagfor tags with invalid form (length/encoding/etc.) - Use
displaydocforBerError - Parsing an indefinite length in DER now raises
IndefiniteLengthUnexpected - Error: when a DER constraint fails, store constraint identifier
DER:DerClassandDerTaghave been deprecated. UseClassandTaginstead.DerObjectHeaderhas been deprecated. UseHeaderinstead.
Oid:- The
Oidobject is now the same asasn1_rs::Oid(simply reexported) - Remove dependency on crate
der-oid-macro
Misc:
ber_read_element_content_asnow requires a non-zerodepth, or it
will raise aBerMaxDeptherror (previously, 0 allowed one level of parsing)- crate
rusticata-macrosis now re-exported (#55)
Thanks
- @lilyball
- @erikmarkmartin
Full Changelog: https://github.com/rusticata/der-parser/commits/der-parser-7.0.0
Release notes
Open source →This release marks the beginning of the merge with the
asn1-rscrate. This will break things.However, this is necessary, because the
asn1-rscrate is much cleaner and supports more types and features (like serialization, custom derive, etc.). Ultimately, this crate will become a frontend toasn1-rs, that will be optional: crate users can switch toasn1-rsand use it directly.Changed/Fixed
MSRV: The minimum supported rust version is now 1.53.
BerObjectHeader:BerSizehas been renamed toLengthBerClasshas been renamed toClassBerTaghas been renamed toTag- Header fields are now private. Getters/setters have been added, and must be used to access/modify fields
BerObjectContent:Unknownvariant now contains anAnyobject, with both the header and object contentPrivatevariant has been merged intoUnknownBmpString,GeneralString,GraphicString,T61String,VideotexStringandObjectDescriptorare now decodedGeneralizedTimeandUtcTimeare now decoded
BerError:- Add error types
UnexpectedClassandUnexpectedTag - Store expected and found item in error to help debugging
- Keep
InvalidTagfor tags with invalid form (length/encoding/etc.) - Use
displaydocforBerError - Parsing an indefinite length in DER now raises
IndefiniteLengthUnexpected - Error: when a DER constraint fails, store constraint identifier
DER:DerClassandDerTaghave been deprecated. UseClassandTaginstead.DerObjectHeaderhas been deprecated. UseHeaderinstead.
Oid:- The
Oidobject is now the same asasn1_rs::Oid(simply reexported) - Remove dependency on crate
der-oid-macro
Misc:
ber_read_element_content_asnow requires a non-zerodepth, or it will raise aBerMaxDeptherror (previously, 0 allowed one level of parsing)- crate
rusticata-macrosis now re-exported (#55)
Thanks
- @lilyball
- @erikmarkmartin
-
6.0.127 Jan 2022Release notes
Open source →What's Changed
- Report number of missing bytes when having a complete header and incomplete data
Full Changelog: https://github.com/rusticata/der-parser/commits/der-parser-6.0.1
-
6.0.013 Sep 2021Release notes
Open source →This release has several major changes:
- upgrade to nom 7
- add support for
no_std - remove all macros
- update MSRV to 1.48
Changed/Fixed
- Do not attempt to parse PRIVATE object contents (closes #48)
- BER: raise error if using Indefinite length and not constructed
- Fix
oid!macro to be independant ofder_parsercrate name and path (#46) - Simplify
der-oid-macro, do not depend onnom - Fix
INTEGERsigned/unsigned parsing (#49) - Change
as_bigint()andas_uint()to return aResult - Remove deprecated functions
Added
- Added support for
no_std(#50) - Make
BerErrorCopy + Clone (#51) - Add feature 'bitvec' for
.as_bitslice()methods
Removed
- Remove all macros
Thanks
- @yoguorui for
no_stdsupport - @SergioBenitez for
BerErrortraits - @lilyball for
INTEGERparsing
-
6.0.0-beta106 Sep 2021 pre-releaseNothing published for this version
-
5.1.203 Aug 2021Nothing published for this version
-
5.1.126 Jul 2021Nothing published for this version
-
5.1.025 Mar 2021Release notes
Open source →Changed/Fixed
- Remove dependency on proc-macro-hack (attempt to fix #36)
- Update pretty_assertions requirement from 0.6 to 0.7
- Update num-bigint to 0.4 (Closes #42)
-
5.0.108 Mar 2021Release notes
Open source →Changed/Fixed
- Fix typos in the
parse_[ber|der]_[u32|u64]doc comments - Add documentation for BerObjectContent variants (#41)
- Fixes for clippy
Added
- Fix typos in the
-
5.0.028 Nov 2020Release notes
Open source →See changelog entries for 5.0.0-beta1 and -beta2 for changes since 4.1
Changed/Fixed
The following changes applies since 5.0.0-beta1, and do not affect 4.x
- Fix potential integer underflow in
bytes_to_u64 - Fix potential stack recursion overflow for indefinite length objects (Add maximum depth).
- Fix potential UB in bitstring_to_u64 with large input and many ignored bits
- Fix constructed objects parsing with indefinite length (do not include EOC)
- Constructed objects: use
InvalidTageverywhere if tag is not expected - Integer parsing functions now all return
IntegerTooLargeinstead ofMapRes - Ensure Indefinite length form is only used in BER constructed objects
Added
- Add new error
StringInvalidCharsetand update string parsing methods - Add methods
parse_ber_sliceandparse_der_sliceto parse an expected Tag and get content as slice
- Fix potential integer underflow in
-
5.0.0-beta224 Nov 2020 pre-releaseRelease notes
Open source →Changed/Fixed
- Consistency: reorder arguments or function callbacks, always set input slice as first argument
(
parse_ber_sequence_defined_g,parse_ber_container,parse_ber_tagged_explicit_g, ...) - Make functions
parse_ber_sequence_of_vandparse_ber_set_of_vaccept generic error types
Added
- Add
parse_ber_content2, owned version ofparse_ber_content, which can directly be combined withparse_ber_tagged_implicit_g - Add methods to parse DER tagged values and containers (with constraints)
- Consistency: reorder arguments or function callbacks, always set input slice as first argument
(
-
5.0.0-beta102 Nov 2020 pre-releaseRelease notes
Open source →Changed/Fixed
- Upgrade to nom 6
- Switch all parsers to function-based parsers
- Change representation of size (new type
BerSize) to support BER indefinite lengths - Rewrite BER/DER parsing macros to use functional parsing combinators
- The constructed bit is now tested for explicit tagged structures
- Some checks (for ex. tags in constructed objects) now return specific errors (
InvalidTag) instead of generic errors (Verify) - Refactor BerObject for parsing of tagged and optional values
- Add method
as_bitslice()to BerObject - Remove Copy trait from BerObjectHeader, copy is non-trivial and should be explicit
- Fix the bug that caused OIDs longer than two subidentifiers which started by subidentifiers "0.0" ("itu-t recommenation") not to be decoded correctly
- Implement the
as_u64andas_u32methods for BerObjects with contents of typeBerObjectContent::BitString. - Implement the
VideotexString,ObjectDescriptorGraphicString, andVisibleStringstring types. (Non-breaking changes) - Correctly decode
BMPStringas UTF-16 instead of UTF-8 when printing. (Non-breaking change) - Turn
UTCTimeandGeneralizedTimeinto a&strinstead of&[u8], as they inherit fromVisibleStringwhich is a subset of ASCII. (Breaking change)
Added
- Add combinator
parse_ber_optional
Thanks
By alphabetic order of handle:
@cccs-sadugas@nickelc@p1-mmr
-
4.1.113 Apr 2023Nothing published for this version
-
4.1.003 Sep 2020Release notes
Open source →Added/Changed
- Re-export num-bigint so crate users do not have to import it
- Add function versions to parse BER sequences/sets (#20)
- Add function versions to parse BER tagged objects (#20)
- Add generic error type to structured parsing functions
- Add function to parse a generic BER container object
- Document that trailing bytes from SEQUENCE/SET are ignored
- Deprecate functions
parse_{ber,der}_explicit(use_optional)
-
4.0.208 Jul 2020 -
4.0.129 Jun 2020 -
4.0.005 Jun 2020Release notes
Open source →Attention This is a major release, with several API-breaking changes. See
UPGRADING.mdfor instructions.Thanks
- Jannik Schürg (oid, string verifications)
Added
- Add functions
parse_ber_recursiveandparse_der_recursive, allowing to specify maximum recursion depth when parsing - The string types
IA5String,NumericString,PrintableStringandUTF8Stringdo now only parse if the characters are valid. as_str()was added toBerObjectContentto obtain a&strfor the types above.as_slice()works as before.- Implement
Errortrait forBerError - Add method to extract raw tag from header
BerObjectHeadernow has a lifetime and araw_tagfieldBerObjectnow has araw_tagfield- Implement
PartialEqmanually forBerObject:raw_tagis compared only if both fields provide it
- Add type
BerClass - Start adding serialization support (experimental) using the
serializefeature
Changed/Fixed
- Make header part of
BerObject, remove duplicate fields - Maximum recursion logic has changed. Instead of providing the current depth, the argument is now the maximum possible depth.
- Change the api around
Oidto achieve zero-copy. The following changed:- The
Oidstruct now has a lifetime and usesCowinternally. - The procedural macro
oid!was added. Oid::fromreturns aResultnow.- The
Oidstruct now encodes whether the oid is relative or not. - The
Debugimplementation now shows whether the oid is relative and uses the bigint feature if available. - The
Oid::itermethod now returns anOption.Oid::iter_bigintwas added. Hashis now derived forOid.
- The
- Minimum rust version is now 1.34
-
4.0.0-beta102 Jun 2020 pre-releaseNothing published for this version
-
4.0.0-alpha309 Apr 2020 pre-release withdrawnNothing published for this version
-
4.0.0-alpha231 Mar 2020 pre-release withdrawnNothing published for this version
-
4.0.0-alpha118 Feb 2020 pre-release withdrawnNothing published for this version
-
3.0.430 Jan 2020Nothing published for this version
-
3.0.326 Nov 2019Release notes
Open source →- Make the pretty-printer function public
- Fix DER datestring sanity check
- CI
- add rusfmt check
- add cargo clippy
-
3.0.201 Sep 2019 -
3.0.121 Aug 2019Release notes
Open source →- Add crate
BerResultandDerResulttypes - Use crate result types, remove uneeded imports
- Crates using
der-parserdo not need to importnomorrusticata-macrosanymore - Result types are aliases, so API is unchanged
- Crates using
- Add crate
-
3.0.005 Aug 2019Release notes
Open source →- Upgrade to nom 5 (breaks API)
- New error types, now all functions use
BerError
-
2.1.025 Jul 2019 -
2.0.225 Jul 2019 -
2.0.125 Jul 2019 -
2.0.008 Jul 2019Release notes
Open source →- Refactor code, split BER and DER, check DER constraints
- Add recursion limit for sequences and sets
- Rustfmt
- Documentation
- Remove unused function
ber_read_element_content
-
2.0.0-alpha203 Jul 2019 pre-releaseNothing published for this version
-
2.0.0-alpha118 Jun 2019 pre-releaseNothing published for this version
-
1.1.124 Dec 2018Release notes
Open source →- Fix OID parsing, and add support for relative OIDs
- Add FromStr trait for Oid
-
1.1.022 Oct 2018 -
1.0.014 Aug 2018 -
0.5.507 May 2018Release notes
Open source →- Add functions
parse_der_u32andparse_der_u64to quickly parse integers - Remove
Oid::from_vec,Oid::fromdoes the same - Enforce constraints on DER booleans
- Add functions
-
0.5.411 Apr 2018Release notes
Open source →- Add
BitStringObjectto wrap BitString objects - Mark constructed BitStrings as unsupported
- Do not try to parse application-specific data in
parse_der
- Add
-
0.5.321 Mar 2018Release notes
Open source →- Add function
DerObject::as_u64 - Add function
DerObject::as_oid_val - Add
parse_der_struct!variant to check tag
- Add function
-
0.5.213 Mar 2018Release notes
Open source →- Add functions to test object class and primitive/constructed state
- Add macro
parse_der_application! - Add macro
parse_der_tagged!to parse[x] EXPLICITor[x] IMPLICITtagged values
-
0.5.102 Mar 2018 -
0.5.017 Jan 2018Release notes
Open source →- Allow use of crate without extra use statements
- Use constants for u32 errors instead of magical numbers
- Rename
tag_of_der_content()toDerObjectContent::tag - Rename DerElementxxx structs to have a consistent naming scheme
- Add documentation for parsing DER sequences and sets, and fix wrong return type for sets
- Fix a lot of clippy warnings
- QA: add pragma rules (disable unsafe code, unstable features etc.)
- More documentation
- Switch license to MIT + APLv2
-
0.4.419 Oct 2017Release notes
Open source →- Add macro parse_der_defined_m, to parse a defined sequence or set
This macro differs from
parse_der_definedbecause it allows using macros - Rename
DerObject::new_inttoDerObject::from_int_slice - Rename
Oid::to_hextoOid::to_string - Document more functions
- Add macro parse_der_defined_m, to parse a defined sequence or set
This macro differs from
-
0.4.316 Oct 2017Nothing published for this version
-
0.4.224 Sep 2017Nothing published for this version
-
0.4.111 Sep 2017Release notes
Open source →- Add new feature 'bigint' to export DER integers
- OID is now a specific type
- Add new types T61String and BmpString
- Fix wrong expected tag in parse_der_set_of
-
0.4.020 Jun 2017Release notes
Open source →- Der Integers are now represented as slices (byte arrays) since they can be larger than u64.
-
0.3.507 Apr 2017Nothing published for this version
-
0.3.402 Apr 2017Nothing published for this version
-
0.3.327 Mar 2017Nothing published for this version
-
0.3.224 Mar 2017Nothing published for this version
-
0.3.106 Mar 2017Nothing published for this version
-
0.3.006 Mar 2017Nothing published for this version
-
0.2.003 Mar 2017Nothing published for this version
-
0.1.402 Mar 2017Nothing published for this version
-
0.1.302 Mar 2017Nothing published for this version
-
0.1.202 Mar 2017Nothing published for this version