Hot answers tagged

13

So is PKCS7 a signature format or a certificate format or both? Neither. PKCS7 is now Cryptographic Message Syntax(CMS). From the RFC 5652: This syntax is used to digitally sign, digest, authenticate, or encrypt arbitrary message content. CMS enables interoperability between different products which can operate on the same document without ...


4

It uses deterministic padding, i.e. padding with FF octets, finalized by a single 00 valued byte. So it is indeed RSASSA-PKCS1-v1_5 which uses EMSA-PKCS1-V1_5-ENCODE. Don't be fooled by the reference to RSA encryption in the OID for sha256WithRSAEncryption. That simply points to the modular exponentiation - in this case with the private key. PKCS#1 versions ...


3

PKCS stands for Public Key Cryptography Standards. The name was part of RSA Laboratories that managed to create and publish a very long list of standards, including: PKCS#1 : RSA with various schemes for encryption + signature generation and schemes PKCS#5 : Password Based Encryption or PBE PKCS#7 : The Cryptographic Message Syntax or CMS PKCS#8 : A scheme ...


2

Consider the two cases. without signedAttrs: first we hash the content, then we sign that hash. The first thing we do is hash the content. with signedAttrs: first we hash the content, call it hash1; then we construct signedAttrs which includes hash1 in the message-digest attribute; then we hash signedAttrs, call it hash2; then we sign hash2. Only hash2 is ...


2

The practical answer to this is: use a library. There are many available, and they already handle the complicated details below plus many more that exist in PKCS7/CMS in general but are not in this rather simple case. However, that is offtopic for crypto; try softwarerecs for help selecting one, and stackoverflow if you have specific problems using it. The ...


2

How would receiver know that it was not from originator? The recipient doesn't know the sender with this scheme. It can be anybody. Why? There's no secret involved in the sending process that is unique to the sender and thus anybody can create such a message, as you already noted. Why can't an attacker do this? He can. However this looks more like a ...


1

It is PKCS7 signed message. In .Net you can use SignedCMS object ... using System.Security.Cryptography.Pkcs; ... var ctx = new System.DirectoryServices.AccountManagement.PrincipalContext(System.DirectoryServices.AccountManagement.ContextType.Domain); var userPrincipal = System.DirectoryServices.AccountManagement.UserPrincipal.FindByIdentity(ctx, System....


1

(moved from comment, expanded slightly) (AES) Key Wrap is not the same as normal data encryption like CBC or GCM; it does quite a bit of remixing, and adds exactly 64 bits to any AES "plain key" (here 256 + 64 = 320 = 40 bytes) even though it uses the AES algorithm which has a 128-bit data block. See http://tools.ietf.org/html/rfc3394 and the relevant ...


1

The actual data can be omitted from a SignedData encapContentInfo; see current CMS RFC which is not materially changed from earlier versions. The RFC calls this "external signature"; IME it is also called "detached signature" or "clear-sign[ing,ed]", and is widely used. For example S/MIME signed messages usually are a multipart containing the plaintext data ...


1

the following command do what I want : openssl smime -in msg -pk7out -out msg.pk7 openssl asn1parse -in msg.pk7


1

The PKCS#7 standard is a messaging standard which includes messaging formats for signed data, enveloped data or signed and enveloped data. The PKCS#11 api will produce a "raw" signature, which you will have to wrap in the PKCS#7 signed data formats. If you are using Java or .Net I would recommend looking at the Bouncycastle apis, which include full PKCS#7 ...


Only top voted, non community-wiki answers of a minimum length are eligible