Walter H.
2013-03-17 17:14:33 UTC
Hello,
has anybody got an idea, how to programm/get such a timestamp server -
is not RFC 3161 conform -
with using OpenSSL on Linux;
attached are the ASN.1 dump of the received and sent package - in this
case the signtool.exe sends the query to
http://timestamp.verisign.com/scripts/timestamp.dll and receives from
there the reply;
- send (request): mssendts-asn1.text
- receive (reply): msrecvts-asn1.text
(these I recorded with wireshark)
I thought of this:
openssl smime -pk7out -in received.der -inform DER -sign -out
pkcs7reply.der -outform DER -md sha1 -signer cert.pem -inkey key.pem
-passin file:passphrase
but there I'm missing the original 256 bytes of the received query,
and the SECTION with OID 1.2.840.113549.1.9.15 (sMIMECapabilities) is
too much;
see the 3rd attachment: pkcs7reply-asn1.text
below is the "spec" from MSDN;
how can I achieve this?
Thanks,
Walter
Time Stamp Request
The time stamp request is sent within an HTTP 1.1 POST message. In the
HTTP header, the CacheControl directive is set to no-cache, and the
Content-Type directive is set to application/octet-stream. The body of
the HTTP message is a base64 encoding of /Distinguished Encoding Rules/
<http://msdn.microsoft.com/en-us/library/windows/desktop/ms721573%28v=vs.85%29.aspx#_security_distinguished_encoding_rules_gly>
(DER) encoding of the time stamp request.
Although not currently used, the Content-Length directive should also be
used in constructing the HTTP message because it helps the time stamp
server locate where the request is within the HTTP POST.
Other HTTP headers may also be present and should be ignored if they are
not understood by the requestor or time stamp server.
The time stamp request is an ASN.1 encoded message. The format of the
request is as follows.
Copy
TimeStampRequest ::= SEQUENCE {
countersignatureType OBJECT IDENTIFIER,
attributes Attributes OPTIONAL,
content ContentInfo
}
The countersignatureType is the /object identifier/
<http://msdn.microsoft.com/en-us/library/windows/desktop/ms721599%28v=vs.85%29.aspx#_security_object_identifier_gly>
(OID) that identifies this as a time stamp countersignature and should
be the exact OID 1.3.6.1.4.1.311.3.2.1.
No attributes are currently included in the time stamp request.
The content is a ContentInfo as defined by PKCS #7. The content is the
data to be signed. For signature time stamping, the ContentType should
be Data, and the content should be the encryptedDigest (signature) from
the SignerInfo of the PKCS #7 content to be time stamped.
Time Stamp Response
The time stamp response is also sent within an HTTP 1.1 message. In the
HTTP header, the Content-Type directive is also set to
application/octet-stream. The body of the HTTP message is a base64
encoding of DER encoding of the time stamp response.
The time stamp response is a PKCS #7 signed message signed by the time
stamper. The ContentInfo of the PKCS #7 message is identical to the
ContentInfo received in the time stamp. The PKCS #7 content contains the
signing time authenticated attribute (defined in PKCS #99, OID
1.2.840.113549.9.5).
After Authenticode receives the time stamp from the server, Authenticode
incorporates the time stamp into the original PKCS #7 *SignedData*
<http://msdn.microsoft.com/en-us/library/windows/desktop/aa387722%28v=vs.85%29.aspx>
as a countersignature. To accomplish this, the ContentInfo of the
returned PKCS #7 *SignedData* is discarded, and the SignerInfo of the
returned time stamp is copied as a countersignature into the SignerInfo
of the original PKCS #7 *SignedData*. The certificate chain of the time
stamper is also copied into Certificates in the original PKCS #7
*SignedData* as an unauthenticated attribute of the original signer.
has anybody got an idea, how to programm/get such a timestamp server -
is not RFC 3161 conform -
with using OpenSSL on Linux;
attached are the ASN.1 dump of the received and sent package - in this
case the signtool.exe sends the query to
http://timestamp.verisign.com/scripts/timestamp.dll and receives from
there the reply;
- send (request): mssendts-asn1.text
- receive (reply): msrecvts-asn1.text
(these I recorded with wireshark)
I thought of this:
openssl smime -pk7out -in received.der -inform DER -sign -out
pkcs7reply.der -outform DER -md sha1 -signer cert.pem -inkey key.pem
-passin file:passphrase
but there I'm missing the original 256 bytes of the received query,
and the SECTION with OID 1.2.840.113549.1.9.15 (sMIMECapabilities) is
too much;
see the 3rd attachment: pkcs7reply-asn1.text
below is the "spec" from MSDN;
how can I achieve this?
Thanks,
Walter
Time Stamp Request
The time stamp request is sent within an HTTP 1.1 POST message. In the
HTTP header, the CacheControl directive is set to no-cache, and the
Content-Type directive is set to application/octet-stream. The body of
the HTTP message is a base64 encoding of /Distinguished Encoding Rules/
<http://msdn.microsoft.com/en-us/library/windows/desktop/ms721573%28v=vs.85%29.aspx#_security_distinguished_encoding_rules_gly>
(DER) encoding of the time stamp request.
Although not currently used, the Content-Length directive should also be
used in constructing the HTTP message because it helps the time stamp
server locate where the request is within the HTTP POST.
Other HTTP headers may also be present and should be ignored if they are
not understood by the requestor or time stamp server.
The time stamp request is an ASN.1 encoded message. The format of the
request is as follows.
Copy
TimeStampRequest ::= SEQUENCE {
countersignatureType OBJECT IDENTIFIER,
attributes Attributes OPTIONAL,
content ContentInfo
}
The countersignatureType is the /object identifier/
<http://msdn.microsoft.com/en-us/library/windows/desktop/ms721599%28v=vs.85%29.aspx#_security_object_identifier_gly>
(OID) that identifies this as a time stamp countersignature and should
be the exact OID 1.3.6.1.4.1.311.3.2.1.
No attributes are currently included in the time stamp request.
The content is a ContentInfo as defined by PKCS #7. The content is the
data to be signed. For signature time stamping, the ContentType should
be Data, and the content should be the encryptedDigest (signature) from
the SignerInfo of the PKCS #7 content to be time stamped.
Time Stamp Response
The time stamp response is also sent within an HTTP 1.1 message. In the
HTTP header, the Content-Type directive is also set to
application/octet-stream. The body of the HTTP message is a base64
encoding of DER encoding of the time stamp response.
The time stamp response is a PKCS #7 signed message signed by the time
stamper. The ContentInfo of the PKCS #7 message is identical to the
ContentInfo received in the time stamp. The PKCS #7 content contains the
signing time authenticated attribute (defined in PKCS #99, OID
1.2.840.113549.9.5).
After Authenticode receives the time stamp from the server, Authenticode
incorporates the time stamp into the original PKCS #7 *SignedData*
<http://msdn.microsoft.com/en-us/library/windows/desktop/aa387722%28v=vs.85%29.aspx>
as a countersignature. To accomplish this, the ContentInfo of the
returned PKCS #7 *SignedData* is discarded, and the SignerInfo of the
returned time stamp is copied as a countersignature into the SignerInfo
of the original PKCS #7 *SignedData*. The certificate chain of the time
stamper is also copied into Certificates in the original PKCS #7
*SignedData* as an unauthenticated attribute of the original signer.