Comments (5)
This seems to fix the issue without breaking the existing tests. @XAMPPRocky is this a sensible change?
diff --git a/standards/cms/src/lib.rs b/standards/cms/src/lib.rs
index 55d006f..14bddab 100644
--- a/standards/cms/src/lib.rs
+++ b/standards/cms/src/lib.rs
@@ -208,7 +208,7 @@ pub struct OtherRevocationInfoFormat {
#[derive(AsnType, Clone, Debug, Decode, Encode, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct EncapsulatedContentInfo {
pub content_type: ContentType,
- #[rasn(tag(explicit(0)))]
+ #[rasn(tag(context, 0))]
pub content: Option<OctetString>,
}
from rasn.
Thank you for your issue! Right now I don't think I would want to make the change, since the IETF RFC is what should be followed, rather than Microsoft's undocumented formats. I would prefer to add a seperate type for Microsoft types over having spec non-compliant types.
from rasn.
from RFC5652 it is acknowledged that cms breaks compatibility with pkcs7, which is also an IETF RFC.
5.2.1. Compatibility with PKCS #7
This section contains a word of warning to implementers that wish to
support both the CMS and PKCS #7 [PKCS#7] SignedData content types.
Both the CMS and PKCS #7 identify the type of the encapsulated
content with an object identifier, but the ASN.1 type of the content
itself is variable in PKCS #7 SignedData content type.
PKCS #7 defines content as:
content [0] EXPLICIT ANY DEFINED BY contentType OPTIONAL
The CMS defines eContent as:
eContent [0] EXPLICIT OCTET STRING OPTIONAL
The CMS definition is much easier to use in most applications, and it
is compatible with both S/MIME v2 and S/MIME v3. S/MIME signed
messages using the CMS and PKCS #7 are compatible because identical
signed message formats are specified in RFC 2311 for S/MIME v2
[MSG2], RFC 2633 for S/MIME v3 [MSG3], and RFC 3851 for S/MIME v3.1
[MSG3.1]. S/MIME v2 encapsulates the MIME content in a Data type
(that is, an OCTET STRING) carried in the SignedData contentInfo
content ANY field, and S/MIME v3 carries the MIME content in the
SignedData encapContentInfo eContent OCTET STRING. Therefore, in
S/MIME v2, S/MIME v3, and S/MIME v3.1, the MIME content is placed in
an OCTET STRING and the message digest is computed over the identical
portions of the content. That is, the message digest is computed
over the octets comprising the value of the OCTET STRING, neither the
tag nor length octets are included.
https://datatracker.ietf.org/doc/html/rfc5652#page-12
from rasn.
@dvc94ch Thanks for the info, I think I'd like to go with having a separate type for PKCS#7 EncapsulatedContentInfo
, SignedData
, DigestData
, and AuthenticatedData
stored in a pkcs7_compat
module in cms
.
from rasn.
Closing as resolved in #62
from rasn.
Related Issues (20)
- stack overflow when comparing &ObjectIdentifier with &[u32] HOT 1
- DER decoding of empty sequences is incredibly slow HOT 4
- UnbindRequest encodes/decodes incorrectly
- Comparing Object Identifier causes SIGSEGV HOT 2
- `index_map` and `character_map` are broken (one static map is initialized for all types, and thus doesn't work for different types)
- Breaking change in 0.12.6 breaks compilation of apple-codesign HOT 1
- Tokei lines of code badge doesn't work
- Mutable Access to Encoded Values HOT 2
- Performance of PER codec HOT 8
- Is it possible to get &[u8] for the underlying decoded value
- Standards crates (`rasn-pkix`, `rasn-ocsp`, etc.) should not enable `rasn`'s default feature HOT 2
- Failed windows builds HOT 1
- OER encoder produces output that it can't decode HOT 5
- ia5 string decoding debug assertion reached from OER HOT 1
- OER/COER decode_sequence_of passes invalid data to bitvec load_be resulting in panic from assertion HOT 4
- Does not work in no-std environment HOT 3
- OER encoding rountrip confuses fields HOT 2
- OER/UPER/APER roundtrip fails with untagged sequence fields and optional types HOT 8
- Combination of optional fields and explicit tag ignores the option type HOT 3
- Decoding the data stream
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rasn.