
From pkix@nmhq.net  Fri Jul 12 13:05:56 2019
Return-Path: <pkix@nmhq.net>
X-Original-To: pkix@ietfa.amsl.com
Delivered-To: pkix@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 42A991200A4 for <pkix@ietfa.amsl.com>; Fri, 12 Jul 2019 13:05:56 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.9
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Kw-Z9iUUG_LZ for <pkix@ietfa.amsl.com>; Fri, 12 Jul 2019 13:05:53 -0700 (PDT)
Received: from mail.nmhq.net (mail.nmhq.net [95.129.49.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id F06BC120091 for <pkix@ietf.org>; Fri, 12 Jul 2019 13:05:52 -0700 (PDT)
Received: from matthies by mail.nmhq.net with local (Exim 4.89) (envelope-from <pkix@nmhq.net>) id 1hm1nh-0005hQ-H3 for pkix@ietf.org; Fri, 12 Jul 2019 22:05:49 +0200
Date: Fri, 12 Jul 2019 22:05:49 +0200
From: Niklas Matthies <pkix@nmhq.net>
To: pkix@ietf.org
Message-ID: <20190712200549.2kgzjqodj5afnxlt@nmhq.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
X-Clacks-Overhead: GNU Terry Pratchett
X-Editor: VIM - Vi IMproved 8.0
X-Operating-System: Linux 4.4.112 x86_64
User-Agent: NeoMutt/20170113 (1.7.2)
Archived-At: <https://mailarchive.ietf.org/arch/msg/pkix/05UcnxxO5OSZGlSjxetrp9cqe2A>
Subject: [pkix] Clarification on "zero" hash value in SigPolicyHash (CAdES)
X-BeenThere: pkix@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: PKIX Working Group <pkix.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/pkix>, <mailto:pkix-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/pkix/>
List-Post: <mailto:pkix@ietf.org>
List-Help: <mailto:pkix-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/pkix>, <mailto:pkix-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 12 Jul 2019 20:07:12 -0000

Dear all,

I hope that someone can shed some light on the definition and origin 
of the special-case "zero" hash value for SigPolicyHash in CAdES. The 
main question is what exactly constitutes a "zero" hash value on the 
ASN.1 level.

In the most current CAdES specification, ETSI EN 319 122-1 V1.1.1 
(2016-04), the zero hash value is described as follows (clause 
5.2.9.1, page 20): 
    
    The sigPolicyHash field shall contain the identifier of the hash 
    algorithm and the hash of the value of the signature policy.
    The hashValue within the sigPolicyHash may be set to zero to 
    indicate that the policy hash value is not known.

        NOTE: The use of a zero-sigPolicyHash value is to ensure 
        backwards compatibility with earlier versions of ETSI TS 101 733 [1].

The ASN.1 definition of SigPolicyHash is as follows:

    SignaturePolicyId ::= SEQUENCE {
        sigPolicyId SigPolicyId,
        sigPolicyHash SigPolicyHash,
        sigPolicyQualifiers SEQUENCE SIZE (1..MAX) OF 
            SigPolicyQualifierInfo OPTIONAL
    }

    SigPolicyHash ::= OtherHashAlgAndValue

    OtherHashAlgAndValue ::= SEQUENCE {
        hashAlgorithm   AlgorithmIdentifier,
        hashValue       OtherHashValue }

    OtherHashValue ::= OCTET STRING

The question is what constitutes a "zero" hash value. A zero-length 
octet string? Any octet string where all octets are zero? Is the 
length of the octet string relevant, e.g. can or should it match the 
length implied by the hash algorithm?

I spent some time going back the history of the standards to find the 
"earlier version" relevant for the note about backwards compatibility, 
however that search was inconclusive.

All versions of ETSI TS 101 733 from the latest V2.2.1 (2013-04) back 
to V1.7.4 (2008-07) include the following note, which had a second 
sentence added:

        NOTE: The use of a zero-sigPolicyHash value is to ensure 
        backwards compatibility with earlier versions of the
        current document. If sigPolicyHash is zero, then the hash 
        value should not be checked against the calculated hash value 
        of the signature policy.

Confusingly, this now talks about sigPolicyHash being zero (whatever that 
would mean), not about the hashValue field within sigPolicyHash.

The same text appears in RFC 5126 (February 2008).

The previous version ETSI TS 101 733 V1.7.3 (2007-01) is the first 
version to talk about a zero hash value, and the note is just one 
sentence again:

    The hashValue within the sigPolicyHash max [sic] be set to zero to 
    indicate that the policy hash value is not known.

        NOTE: The use of zero policy hash value is to ensure backward 
        compatibility with earlier versions of the current document.

In addition, the annex states the following:

    Annex K (informative): Changes from the previous version

        • if the hash of the signature policy is unknown, then, by 
        convention, the sigPolicyHash shall be set to all zero

Here again, the annex talks about sigPolicyHash being set to zero, 
not the hashValue within sigPolicyHash.

On the RFC side, the same note first appears in 
https://tools.ietf.org/html/draft-ietf-smime-cades-02 (May 2007), 
and the sentence above (without the note) first appears in 
https://tools.ietf.org/html/draft-ietf-smime-cades-01 (April 2006).

In the previous ETSI TS 101 733 V1.6.3 (2005-09), the sigPolicyHash 
field is optional (which is mandatory in all previous and all 
subsequent versions), and the following note is included:

        NOTE: In the previous version of TS 101 733 (i.e. version 1.5.1) 
        sigPolicyHash was mandatory. Implementations requiring to be 
        backward compatible with version 1.5.1 and previous versions 
        of the current document MUST include SigPolicyHash.

None of the previous versions, from ETSI TS 101 733 V1.5.1 (2003-12) 
back to ETSI TS 101 733 V1.2.2 (2000-12) (the earliest version available 
at https://www.etsi.org/deliver/etsi_ts/101700_101799/101733/), as 
well as RFC 3126 (September 2001), do mention anything about zero hash 
values.

So it remains unclear to which specification backwards compatiblity is 
intended. The point where the wording about zero hash values was 
introduced suggests that this may be about V1.6.3, where the
sigPolicyHash field was optional. However, it's not clear how a "zero" 
hash value would achieve compatibility with the case of a missing 
sigPolicyHash field.

I would appreciate any clarification on that topic.

Kind regards,
Niklas


From nobody Mon Jul 15 01:21:59 2019
Return-Path: <stefan@aaa-sec.com>
X-Original-To: pkix@ietfa.amsl.com
Delivered-To: pkix@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id E077612001E for <pkix@ietfa.amsl.com>; Mon, 15 Jul 2019 01:21:57 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.597
X-Spam-Level: 
X-Spam-Status: No, score=-2.597 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, MIME_QP_LONG_LINE=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_NONE=0.001] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2sYR4Ni8K9wS for <pkix@ietfa.amsl.com>; Mon, 15 Jul 2019 01:21:55 -0700 (PDT)
Received: from smtp.outgoing.loopia.se (smtp.outgoing.loopia.se [194.9.95.112]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 3BB1A120074 for <pkix@ietf.org>; Mon, 15 Jul 2019 01:21:54 -0700 (PDT)
Received: from s554.loopia.se (localhost [127.0.0.1]) by s554.loopia.se (Postfix) with ESMTP id 19DE11F18620 for <pkix@ietf.org>; Mon, 15 Jul 2019 10:21:52 +0200 (CEST)
Received: from s499.loopia.se (unknown [172.21.200.35]) by s554.loopia.se (Postfix) with ESMTP id EFD3E794AEA; Mon, 15 Jul 2019 10:21:51 +0200 (CEST)
Received: from s473.loopia.se (unknown [172.22.191.6]) by s499.loopia.se (Postfix) with ESMTP id EB0A11CDADEC; Mon, 15 Jul 2019 10:21:51 +0200 (CEST)
X-Virus-Scanned: amavisd-new at amavis.loopia.se
Received: from s500.loopia.se ([172.22.191.5]) by s473.loopia.se (s473.loopia.se [172.22.190.13]) (amavisd-new, port 10024) with LMTP id zO0xaDXkgV69; Mon, 15 Jul 2019 10:21:51 +0200 (CEST)
X-Loopia-Auth: user
X-Loopia-User: mailstore2@aaa-sec.com
X-Loopia-Originating-IP: 85.235.7.89
Received: from [192.168.1.217] (gw.aaa-sec.ideon.se [85.235.7.89]) (Authenticated sender: mailstore2@aaa-sec.com) by s500.loopia.se (Postfix) with ESMTPSA id 584101E1460C; Mon, 15 Jul 2019 10:21:51 +0200 (CEST)
User-Agent: Microsoft-MacOutlook/10.1a.0.190609
Date: Mon, 15 Jul 2019 10:21:51 +0200
From: Stefan Santesson <stefan@aaa-sec.com>
To: Niklas Matthies <pkix@nmhq.net>, <pkix@ietf.org>
Message-ID: <A17C1A7A-F0D4-4347-B51C-4F432B385511@aaa-sec.com>
Thread-Topic: [pkix] Clarification on "zero" hash value in SigPolicyHash (CAdES)
References: <20190712200549.2kgzjqodj5afnxlt@nmhq.net>
In-Reply-To: <20190712200549.2kgzjqodj5afnxlt@nmhq.net>
Mime-version: 1.0
Content-type: text/plain; charset="UTF-8"
Content-transfer-encoding: quoted-printable
Archived-At: <https://mailarchive.ietf.org/arch/msg/pkix/6-uzBm2KQDtAvP8V6Xy1yzNllmU>
Subject: Re: [pkix] Clarification on "zero" hash value in SigPolicyHash (CAdES)
X-BeenThere: pkix@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: PKIX Working Group <pkix.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/pkix>, <mailto:pkix-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/pkix/>
List-Post: <mailto:pkix@ietf.org>
List-Help: <mailto:pkix-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/pkix>, <mailto:pkix-request@ietf.org?subject=subscribe>
X-List-Received-Date: Mon, 15 Jul 2019 08:21:58 -0000

Hi Niklas,

A very interesting question to which I have absolutely no answer. But I hav=
e forwarded your question to the ESI group in ETSI who wrote that standard a=
s I'm still a member of that group.
I'll forward any answer I can get out of this group


Stefan Santesson=20

=EF=BB=BFOn 2019-07-12, 22:07, "pkix on behalf of Niklas Matthies" <pkix-bounces@=
ietf.org on behalf of pkix@nmhq.net> wrote:

    Dear all,
   =20
    I hope that someone can shed some light on the definition and origin=20
    of the special-case "zero" hash value for SigPolicyHash in CAdES. The=20
    main question is what exactly constitutes a "zero" hash value on the=20
    ASN.1 level.
   =20
    In the most current CAdES specification, ETSI EN 319 122-1 V1.1.1=20
    (2016-04), the zero hash value is described as follows (clause=20
    5.2.9.1, page 20):=20
       =20
        The sigPolicyHash field shall contain the identifier of the hash=20
        algorithm and the hash of the value of the signature policy.
        The hashValue within the sigPolicyHash may be set to zero to=20
        indicate that the policy hash value is not known.
   =20
            NOTE: The use of a zero-sigPolicyHash value is to ensure=20
            backwards compatibility with earlier versions of ETSI TS 101 73=
3 [1].
   =20
    The ASN.1 definition of SigPolicyHash is as follows:
   =20
        SignaturePolicyId ::=3D SEQUENCE {
            sigPolicyId SigPolicyId,
            sigPolicyHash SigPolicyHash,
            sigPolicyQualifiers SEQUENCE SIZE (1..MAX) OF=20
                SigPolicyQualifierInfo OPTIONAL
        }
   =20
        SigPolicyHash ::=3D OtherHashAlgAndValue
   =20
        OtherHashAlgAndValue ::=3D SEQUENCE {
            hashAlgorithm   AlgorithmIdentifier,
            hashValue       OtherHashValue }
   =20
        OtherHashValue ::=3D OCTET STRING
   =20
    The question is what constitutes a "zero" hash value. A zero-length=20
    octet string? Any octet string where all octets are zero? Is the=20
    length of the octet string relevant, e.g. can or should it match the=20
    length implied by the hash algorithm?
   =20
    I spent some time going back the history of the standards to find the=20
    "earlier version" relevant for the note about backwards compatibility,=20
    however that search was inconclusive.
   =20
    All versions of ETSI TS 101 733 from the latest V2.2.1 (2013-04) back=20
    to V1.7.4 (2008-07) include the following note, which had a second=20
    sentence added:
   =20
            NOTE: The use of a zero-sigPolicyHash value is to ensure=20
            backwards compatibility with earlier versions of the
            current document. If sigPolicyHash is zero, then the hash=20
            value should not be checked against the calculated hash value=20
            of the signature policy.
   =20
    Confusingly, this now talks about sigPolicyHash being zero (whatever th=
at=20
    would mean), not about the hashValue field within sigPolicyHash.
   =20
    The same text appears in RFC 5126 (February 2008).
   =20
    The previous version ETSI TS 101 733 V1.7.3 (2007-01) is the first=20
    version to talk about a zero hash value, and the note is just one=20
    sentence again:
   =20
        The hashValue within the sigPolicyHash max [sic] be set to zero to=20
        indicate that the policy hash value is not known.
   =20
            NOTE: The use of zero policy hash value is to ensure backward=20
            compatibility with earlier versions of the current document.
   =20
    In addition, the annex states the following:
   =20
        Annex K (informative): Changes from the previous version
   =20
            =E2=80=A2 if the hash of the signature policy is unknown, then, by=20
            convention, the sigPolicyHash shall be set to all zero
   =20
    Here again, the annex talks about sigPolicyHash being set to zero,=20
    not the hashValue within sigPolicyHash.
   =20
    On the RFC side, the same note first appears in=20
    https://tools.ietf.org/html/draft-ietf-smime-cades-02 (May 2007),=20
    and the sentence above (without the note) first appears in=20
    https://tools.ietf.org/html/draft-ietf-smime-cades-01 (April 2006).
   =20
    In the previous ETSI TS 101 733 V1.6.3 (2005-09), the sigPolicyHash=20
    field is optional (which is mandatory in all previous and all=20
    subsequent versions), and the following note is included:
   =20
            NOTE: In the previous version of TS 101 733 (i.e. version 1.5.1=
)=20
            sigPolicyHash was mandatory. Implementations requiring to be=20
            backward compatible with version 1.5.1 and previous versions=20
            of the current document MUST include SigPolicyHash.
   =20
    None of the previous versions, from ETSI TS 101 733 V1.5.1 (2003-12)=20
    back to ETSI TS 101 733 V1.2.2 (2000-12) (the earliest version availabl=
e=20
    at https://www.etsi.org/deliver/etsi_ts/101700_101799/101733/), as=20
    well as RFC 3126 (September 2001), do mention anything about zero hash=20
    values.
   =20
    So it remains unclear to which specification backwards compatiblity is=20
    intended. The point where the wording about zero hash values was=20
    introduced suggests that this may be about V1.6.3, where the
    sigPolicyHash field was optional. However, it's not clear how a "zero"=20
    hash value would achieve compatibility with the case of a missing=20
    sigPolicyHash field.
   =20
    I would appreciate any clarification on that topic.
   =20
    Kind regards,
    Niklas
   =20
    _______________________________________________
    pkix mailing list
    pkix@ietf.org
    https://www.ietf.org/mailman/listinfo/pkix
   =20



From nobody Tue Jul 16 01:43:37 2019
Return-Path: <stefan@aaa-sec.com>
X-Original-To: pkix@ietfa.amsl.com
Delivered-To: pkix@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 47967120086 for <pkix@ietfa.amsl.com>; Tue, 16 Jul 2019 01:43:36 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.596
X-Spam-Level: 
X-Spam-Status: No, score=-2.596 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, MIME_QP_LONG_LINE=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_NONE=0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Qv35w6U3eLUJ for <pkix@ietfa.amsl.com>; Tue, 16 Jul 2019 01:43:33 -0700 (PDT)
Received: from smtp.outgoing.loopia.se (smtp.outgoing.loopia.se [194.9.95.112]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id D058412004F for <pkix@ietf.org>; Tue, 16 Jul 2019 01:43:32 -0700 (PDT)
Received: from s554.loopia.se (localhost [127.0.0.1]) by s554.loopia.se (Postfix) with ESMTP id 96EAB1F15B40 for <pkix@ietf.org>; Tue, 16 Jul 2019 10:43:29 +0200 (CEST)
Received: from s499.loopia.se (unknown [172.21.200.36]) by s554.loopia.se (Postfix) with ESMTP id 78E7479421F; Tue, 16 Jul 2019 10:43:29 +0200 (CEST)
Received: from s475.loopia.se (unknown [172.22.191.6]) by s499.loopia.se (Postfix) with ESMTP id 744F51CDADC5; Tue, 16 Jul 2019 10:43:29 +0200 (CEST)
X-Virus-Scanned: amavisd-new at amavis.loopia.se
Received: from s500.loopia.se ([172.22.191.5]) by s475.loopia.se (s475.loopia.se [172.22.190.15]) (amavisd-new, port 10024) with LMTP id j7upg6M7U5vm; Tue, 16 Jul 2019 10:43:28 +0200 (CEST)
X-Loopia-Auth: user
X-Loopia-User: mailstore2@aaa-sec.com
X-Loopia-Originating-IP: 85.235.7.89
Received: from [192.168.2.38] (gw.aaa-sec.ideon.se [85.235.7.89]) (Authenticated sender: mailstore2@aaa-sec.com) by s500.loopia.se (Postfix) with ESMTPSA id C88401E145ED; Tue, 16 Jul 2019 10:43:28 +0200 (CEST)
User-Agent: Microsoft-MacOutlook/10.1a.0.190609
Date: Tue, 16 Jul 2019 10:43:28 +0200
From: Stefan Santesson <stefan@aaa-sec.com>
To: Niklas Matthies <pkix@nmhq.net>, <pkix@ietf.org>
Message-ID: <0FDBEEC9-0FBA-4C47-BD04-EE7F6053426D@aaa-sec.com>
Thread-Topic: [pkix] Clarification on "zero" hash value in SigPolicyHash (CAdES)
References: <20190712200549.2kgzjqodj5afnxlt@nmhq.net>
In-Reply-To: <20190712200549.2kgzjqodj5afnxlt@nmhq.net>
Mime-version: 1.0
Content-type: text/plain; charset="UTF-8"
Content-transfer-encoding: quoted-printable
Archived-At: <https://mailarchive.ietf.org/arch/msg/pkix/XY5dOm3oKWb_CEaQkGkdQOisIaY>
Subject: Re: [pkix] Clarification on "zero" hash value in SigPolicyHash (CAdES)
X-BeenThere: pkix@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: PKIX Working Group <pkix.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/pkix>, <mailto:pkix-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/pkix/>
List-Post: <mailto:pkix@ietf.org>
List-Help: <mailto:pkix-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/pkix>, <mailto:pkix-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 16 Jul 2019 08:43:36 -0000

Hi Niklas,

I posted your question on the ETSI ESI list and it created some very intere=
sting discussions.

Very briefly there are 3 possible interpretations:

1) Empty. (The value is a empty OCTET STRING of zero bytes)
2) Zero. (The value is the byte 0x00)
3) All zeros. (The value is an OCTET STRING of the intended hash value leng=
th containing only 0x00 bytes).


There are actually some evidence that suggests that the original intent was=
 option 3.
However, option 3 is the absolute worst from an implementation perspective =
as it is the hardest to programmatically distinguish from a real hash value.

My conclusion is that the standard is so ambiguous that any receiving imple=
mentation should be able to handle all 3 alternatives.
The standard need to be clarified by ETSI. Until that is done my proposal f=
or sending applications is to use option 1 (empty) because:

1) It is the only option that makes sense and it can be expected as the mos=
t probable future resolution
2) The standard is so ambiguous that validators anyway must expect all opti=
ons.
3) This feature is probably not widely implemented. Doing it one way or the=
 other probably has very little impact on interop.

I'll keep you posted if any opinion emerges that materially contradicts thi=
s conclusion.

Stefan Santesson=20

=EF=BB=BFOn 2019-07-12, 22:07, "pkix on behalf of Niklas Matthies" <pkix-bounces@=
ietf.org on behalf of pkix@nmhq.net> wrote:

    Dear all,
   =20
    I hope that someone can shed some light on the definition and origin=20
    of the special-case "zero" hash value for SigPolicyHash in CAdES. The=20
    main question is what exactly constitutes a "zero" hash value on the=20
    ASN.1 level.
   =20
    In the most current CAdES specification, ETSI EN 319 122-1 V1.1.1=20
    (2016-04), the zero hash value is described as follows (clause=20
    5.2.9.1, page 20):=20
       =20
        The sigPolicyHash field shall contain the identifier of the hash=20
        algorithm and the hash of the value of the signature policy.
        The hashValue within the sigPolicyHash may be set to zero to=20
        indicate that the policy hash value is not known.
   =20
            NOTE: The use of a zero-sigPolicyHash value is to ensure=20
            backwards compatibility with earlier versions of ETSI TS 101 73=
3 [1].
   =20
    The ASN.1 definition of SigPolicyHash is as follows:
   =20
        SignaturePolicyId ::=3D SEQUENCE {
            sigPolicyId SigPolicyId,
            sigPolicyHash SigPolicyHash,
            sigPolicyQualifiers SEQUENCE SIZE (1..MAX) OF=20
                SigPolicyQualifierInfo OPTIONAL
        }
   =20
        SigPolicyHash ::=3D OtherHashAlgAndValue
   =20
        OtherHashAlgAndValue ::=3D SEQUENCE {
            hashAlgorithm   AlgorithmIdentifier,
            hashValue       OtherHashValue }
   =20
        OtherHashValue ::=3D OCTET STRING
   =20
    The question is what constitutes a "zero" hash value. A zero-length=20
    octet string? Any octet string where all octets are zero? Is the=20
    length of the octet string relevant, e.g. can or should it match the=20
    length implied by the hash algorithm?
   =20
    I spent some time going back the history of the standards to find the=20
    "earlier version" relevant for the note about backwards compatibility,=20
    however that search was inconclusive.
   =20
    All versions of ETSI TS 101 733 from the latest V2.2.1 (2013-04) back=20
    to V1.7.4 (2008-07) include the following note, which had a second=20
    sentence added:
   =20
            NOTE: The use of a zero-sigPolicyHash value is to ensure=20
            backwards compatibility with earlier versions of the
            current document. If sigPolicyHash is zero, then the hash=20
            value should not be checked against the calculated hash value=20
            of the signature policy.
   =20
    Confusingly, this now talks about sigPolicyHash being zero (whatever th=
at=20
    would mean), not about the hashValue field within sigPolicyHash.
   =20
    The same text appears in RFC 5126 (February 2008).
   =20
    The previous version ETSI TS 101 733 V1.7.3 (2007-01) is the first=20
    version to talk about a zero hash value, and the note is just one=20
    sentence again:
   =20
        The hashValue within the sigPolicyHash max [sic] be set to zero to=20
        indicate that the policy hash value is not known.
   =20
            NOTE: The use of zero policy hash value is to ensure backward=20
            compatibility with earlier versions of the current document.
   =20
    In addition, the annex states the following:
   =20
        Annex K (informative): Changes from the previous version
   =20
            =E2=80=A2 if the hash of the signature policy is unknown, then, by=20
            convention, the sigPolicyHash shall be set to all zero
   =20
    Here again, the annex talks about sigPolicyHash being set to zero,=20
    not the hashValue within sigPolicyHash.
   =20
    On the RFC side, the same note first appears in=20
    https://tools.ietf.org/html/draft-ietf-smime-cades-02 (May 2007),=20
    and the sentence above (without the note) first appears in=20
    https://tools.ietf.org/html/draft-ietf-smime-cades-01 (April 2006).
   =20
    In the previous ETSI TS 101 733 V1.6.3 (2005-09), the sigPolicyHash=20
    field is optional (which is mandatory in all previous and all=20
    subsequent versions), and the following note is included:
   =20
            NOTE: In the previous version of TS 101 733 (i.e. version 1.5.1=
)=20
            sigPolicyHash was mandatory. Implementations requiring to be=20
            backward compatible with version 1.5.1 and previous versions=20
            of the current document MUST include SigPolicyHash.
   =20
    None of the previous versions, from ETSI TS 101 733 V1.5.1 (2003-12)=20
    back to ETSI TS 101 733 V1.2.2 (2000-12) (the earliest version availabl=
e=20
    at https://www.etsi.org/deliver/etsi_ts/101700_101799/101733/), as=20
    well as RFC 3126 (September 2001), do mention anything about zero hash=20
    values.
   =20
    So it remains unclear to which specification backwards compatiblity is=20
    intended. The point where the wording about zero hash values was=20
    introduced suggests that this may be about V1.6.3, where the
    sigPolicyHash field was optional. However, it's not clear how a "zero"=20
    hash value would achieve compatibility with the case of a missing=20
    sigPolicyHash field.
   =20
    I would appreciate any clarification on that topic.
   =20
    Kind regards,
    Niklas
   =20
    _______________________________________________
    pkix mailing list
    pkix@ietf.org
    https://www.ietf.org/mailman/listinfo/pkix
   =20



From nobody Tue Jul 16 02:32:23 2019
Return-Path: <pgut001@cs.auckland.ac.nz>
X-Original-To: pkix@ietfa.amsl.com
Delivered-To: pkix@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 2B1161201C3 for <pkix@ietfa.amsl.com>; Tue, 16 Jul 2019 02:32:22 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -4.197
X-Spam-Level: 
X-Spam-Status: No, score=-4.197 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=auckland.ac.nz
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PmrmqGC9wauD for <pkix@ietfa.amsl.com>; Tue, 16 Jul 2019 02:32:20 -0700 (PDT)
Received: from mx4-int.auckland.ac.nz (mx4-int.auckland.ac.nz [130.216.125.246]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id BC41B1201CA for <pkix@ietf.org>; Tue, 16 Jul 2019 02:32:19 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=auckland.ac.nz; i=@auckland.ac.nz; q=dns/txt; s=mail; t=1563269541; x=1594805541; h=from:to:subject:date:message-id:references:in-reply-to: content-transfer-encoding:mime-version; bh=DTK9nVxxJvVLcuYbWyXuif7Cn5C7TavfHdOgT7sfIvU=; b=a2nryr7Z4NsRSbfV5AOd4IIppCmU7E+jaK5Dy1IpO+7P5Edu9u4MfGe6 XaWOut5v9kqI2hJApyLe1uU/ZOUCaDaLE4vjI6kZJuw3Qdbx9vvaJ4+3Y aYXx9M9MsBQgBlbNDJyfjMIXkDjdYtj3hIUBq9Z3TqwrZNQRpUtmA+Kd8 kqR2soFbuHedznEe35sdMqiUgsYOCIczobHIEqDV5nYrkXlsinIYrbYju 0RSMl98ss/O64UC5c/YnhLSwcXkA8B/BqHnD7IWnbt1BoU0AKrzMOmQ2L sppc5diFc5snQF6YGDxs/9vIVAtmDxpsam+jV51EYF032oAeuSeuNlKBD Q==;
X-IronPort-AV: E=Sophos;i="5.63,497,1557144000"; d="scan'208";a="70954784"
X-Ironport-HAT: MAIL-SERVERS - $RELAYED
X-Ironport-Source: 10.6.3.3 - Outgoing - Outgoing
Received: from uxcn13-tdc-b.uoa.auckland.ac.nz ([10.6.3.3]) by mx4-int.auckland.ac.nz with ESMTP/TLS/AES256-SHA; 16 Jul 2019 21:32:17 +1200
Received: from uxcn13-ogg-d.UoA.auckland.ac.nz (10.6.2.5) by uxcn13-tdc-b.UoA.auckland.ac.nz (10.6.3.3) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 16 Jul 2019 21:32:15 +1200
Received: from uxcn13-ogg-d.UoA.auckland.ac.nz ([10.6.2.5]) by uxcn13-ogg-d.UoA.auckland.ac.nz ([10.6.2.5]) with mapi id 15.00.1395.000; Tue, 16 Jul 2019 21:32:16 +1200
From: Peter Gutmann <pgut001@cs.auckland.ac.nz>
To: Stefan Santesson <stefan@aaa-sec.com>, Niklas Matthies <pkix@nmhq.net>, "pkix@ietf.org" <pkix@ietf.org>
Thread-Topic: [pkix] Clarification on "zero" hash value in SigPolicyHash (CAdES)
Thread-Index: AQHVOO1wcGGXPXcfd0KYugWNDx4HUabMKg4AgADWgxg=
Date: Tue, 16 Jul 2019 09:32:15 +0000
Message-ID: <1563269533626.58560@cs.auckland.ac.nz>
References: <20190712200549.2kgzjqodj5afnxlt@nmhq.net>, <0FDBEEC9-0FBA-4C47-BD04-EE7F6053426D@aaa-sec.com>
In-Reply-To: <0FDBEEC9-0FBA-4C47-BD04-EE7F6053426D@aaa-sec.com>
Accept-Language: en-NZ, en-GB, en-US
Content-Language: en-NZ
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-ms-exchange-transport-fromentityheader: Hosted
x-originating-ip: [130.216.158.4]
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Archived-At: <https://mailarchive.ietf.org/arch/msg/pkix/pEz71mx7soxKHc5vgwbzhZBYU1Q>
Subject: Re: [pkix] Clarification on "zero" hash value in SigPolicyHash (CAdES)
X-BeenThere: pkix@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: PKIX Working Group <pkix.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/pkix>, <mailto:pkix-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/pkix/>
List-Post: <mailto:pkix@ietf.org>
List-Help: <mailto:pkix-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/pkix>, <mailto:pkix-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 16 Jul 2019 09:32:22 -0000

Stefan Santesson <stefan@aaa-sec.com> writes:=0A=
=0A=
>However, option 3 is the absolute worst from an implementation perspective=
 as=0A=
>it is the hardest to programmatically distinguish from a real hash value.=
=0A=
=0A=
I would say it's the best from an implementation perspective, you don't nee=
d=0A=
to make any code changes, it's a normal looking hash value that's guarantee=
d=0A=
not to match anything.  Existing implementations that expect a hash there w=
ill=0A=
continue to work as normal.=0A=
=0A=
>My conclusion is that the standard is so ambiguous that any receiving=0A=
>implementation should be able to handle all 3 alternatives.=0A=
=0A=
A slightly different interpretation is that since that part of the standard=
 is=0A=
essentially unimplementable, it's likely no-one has ever implemented it, so=
 it=0A=
can be safely dropped.  Given earlier evidence that it's only there for=0A=
backwards compatibility with something no-one can identify, this enhances t=
he=0A=
case for dropping it from the standard.=0A=
=0A=
Peter.=0A=


From nobody Tue Jul 16 06:30:03 2019
Return-Path: <stefan@aaa-sec.com>
X-Original-To: pkix@ietfa.amsl.com
Delivered-To: pkix@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 767C01204DA for <pkix@ietfa.amsl.com>; Tue, 16 Jul 2019 06:30:02 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.596
X-Spam-Level: 
X-Spam-Status: No, score=-2.596 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, MIME_QP_LONG_LINE=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_NONE=0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fzhOaYNDlq_m for <pkix@ietfa.amsl.com>; Tue, 16 Jul 2019 06:30:00 -0700 (PDT)
Received: from smtp.outgoing.loopia.se (smtp.outgoing.loopia.se [194.9.95.112]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 7BE661204D6 for <pkix@ietf.org>; Tue, 16 Jul 2019 06:29:54 -0700 (PDT)
Received: from s554.loopia.se (localhost [127.0.0.1]) by s554.loopia.se (Postfix) with ESMTP id E98201F154C5 for <pkix@ietf.org>; Tue, 16 Jul 2019 15:29:51 +0200 (CEST)
Received: from s498.loopia.se (unknown [172.21.200.35]) by s554.loopia.se (Postfix) with ESMTP id CB1237949FB; Tue, 16 Jul 2019 15:29:51 +0200 (CEST)
Received: from s474.loopia.se (unknown [172.22.191.6]) by s498.loopia.se (Postfix) with ESMTP id C6F9C470796; Tue, 16 Jul 2019 15:29:51 +0200 (CEST)
X-Virus-Scanned: amavisd-new at amavis.loopia.se
Received: from s499.loopia.se ([172.22.191.6]) by s474.loopia.se (s474.loopia.se [172.22.190.14]) (amavisd-new, port 10024) with LMTP id DGRw3bzXlzEX; Tue, 16 Jul 2019 15:29:51 +0200 (CEST)
X-Loopia-Auth: user
X-Loopia-User: mailstore2@aaa-sec.com
X-Loopia-Originating-IP: 85.235.7.89
Received: from [192.168.2.38] (gw.aaa-sec.ideon.se [85.235.7.89]) (Authenticated sender: mailstore2@aaa-sec.com) by s499.loopia.se (Postfix) with ESMTPSA id 617B71CDADDD; Tue, 16 Jul 2019 15:29:51 +0200 (CEST)
User-Agent: Microsoft-MacOutlook/10.1a.0.190609
Date: Tue, 16 Jul 2019 15:29:51 +0200
From: Stefan Santesson <stefan@aaa-sec.com>
To: Peter Gutmann <pgut001@cs.auckland.ac.nz>, Niklas Matthies <pkix@nmhq.net>, "pkix@ietf.org" <pkix@ietf.org>
Message-ID: <218E69B7-036E-45FF-AD3B-9F017FCAF40E@aaa-sec.com>
Thread-Topic: [pkix] Clarification on "zero" hash value in SigPolicyHash (CAdES)
References: <20190712200549.2kgzjqodj5afnxlt@nmhq.net> <0FDBEEC9-0FBA-4C47-BD04-EE7F6053426D@aaa-sec.com> <1563269533626.58560@cs.auckland.ac.nz>
In-Reply-To: <1563269533626.58560@cs.auckland.ac.nz>
Mime-version: 1.0
Content-type: text/plain; charset="UTF-8"
Content-transfer-encoding: quoted-printable
Archived-At: <https://mailarchive.ietf.org/arch/msg/pkix/nLhSYuXoytXhpHtvrff1Am5tJJU>
Subject: Re: [pkix] Clarification on "zero" hash value in SigPolicyHash (CAdES)
X-BeenThere: pkix@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: PKIX Working Group <pkix.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/pkix>, <mailto:pkix-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/pkix/>
List-Post: <mailto:pkix@ietf.org>
List-Help: <mailto:pkix-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/pkix>, <mailto:pkix-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 16 Jul 2019 13:30:02 -0000

To assign a specific meaning to one out of all possible but syntactically v=
alid hash values, is exactly the type of specification work that leads to im=
plementation errors and security vulnerabilities.

Stefan Santesson=20

=EF=BB=BFOn 2019-07-16, 11:32, "Peter Gutmann" <pgut001@cs.auckland.ac.nz> wrote:

    Stefan Santesson <stefan@aaa-sec.com> writes:
   =20
    >However, option 3 is the absolute worst from an implementation perspec=
tive as
    >it is the hardest to programmatically distinguish from a real hash val=
ue.
   =20
    I would say it's the best from an implementation perspective, you don't=
 need
    to make any code changes, it's a normal looking hash value that's guara=
nteed
    not to match anything.  Existing implementations that expect a hash the=
re will
    continue to work as normal.
   =20
    >My conclusion is that the standard is so ambiguous that any receiving
    >implementation should be able to handle all 3 alternatives.
   =20
    A slightly different interpretation is that since that part of the stan=
dard is
    essentially unimplementable, it's likely no-one has ever implemented it=
, so it
    can be safely dropped.  Given earlier evidence that it's only there for
    backwards compatibility with something no-one can identify, this enhanc=
es the
    case for dropping it from the standard.
   =20
    Peter.
   =20



From nobody Tue Jul 16 06:42:23 2019
Return-Path: <pkix@nmhq.net>
X-Original-To: pkix@ietfa.amsl.com
Delivered-To: pkix@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 3F5FD120086 for <pkix@ietfa.amsl.com>; Tue, 16 Jul 2019 06:42:21 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.9
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ffpTCKlX15JV for <pkix@ietfa.amsl.com>; Tue, 16 Jul 2019 06:42:18 -0700 (PDT)
Received: from mail.nmhq.net (mail.nmhq.net [95.129.49.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 796F4120609 for <pkix@ietf.org>; Tue, 16 Jul 2019 06:42:18 -0700 (PDT)
Received: from matthies by mail.nmhq.net with local (Exim 4.89) (envelope-from <pkix@nmhq.net>) id 1hnNih-0002zy-Rf for pkix@ietf.org; Tue, 16 Jul 2019 15:42:15 +0200
Date: Tue, 16 Jul 2019 15:42:15 +0200
From: Niklas Matthies <pkix@nmhq.net>
To: pkix@ietf.org
Message-ID: <20190716134215.txzqvcgghajh2es3@nmhq.net>
Mail-Followup-To: pkix@ietf.org
References: <20190712200549.2kgzjqodj5afnxlt@nmhq.net> <0FDBEEC9-0FBA-4C47-BD04-EE7F6053426D@aaa-sec.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <0FDBEEC9-0FBA-4C47-BD04-EE7F6053426D@aaa-sec.com>
X-Clacks-Overhead: GNU Terry Pratchett
X-Editor: VIM - Vi IMproved 8.0
X-Operating-System: Linux 4.4.112 x86_64
User-Agent: NeoMutt/20170113 (1.7.2)
Archived-At: <https://mailarchive.ietf.org/arch/msg/pkix/W3LwEb67ZXf7FkhbkSPM4rucR5c>
Subject: Re: [pkix] Clarification on "zero" hash value in SigPolicyHash (CAdES)
X-BeenThere: pkix@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: PKIX Working Group <pkix.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/pkix>, <mailto:pkix-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/pkix/>
List-Post: <mailto:pkix@ietf.org>
List-Help: <mailto:pkix-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/pkix>, <mailto:pkix-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 16 Jul 2019 13:42:21 -0000

Hi Stefano,

Thanks for the information.

I agree that option 3 is somewhat problematic. All-bits-zero can 
conceivably be a valid hash value (I believe for SHA-1 and SHA-2 it's 
actually unknown whether all-bits-zero is reachable), and the standard 
probably shouldn't start disallowing all-bits-zero as a valid hash 
value for all hash algorithms.

I also agree with Peter Gutmann that dropping the feature altogether 
should be a strong consideration, in particular if the original 
motivation can't be identified, and also given that XAdES does not 
have an equivalent feature. Implementations would still be free to 
support older versions of the standard (with an interpretation of 
their choosing) for backwards compatibility, depending on local policy 
and configuration.

Just FYI, I'm maintaining an implementation that (only) supports 
option 2, however it is probably only interoperable with itself 
reagrding that aspect.

Niklas


On Tue 2019-07-16 at 10:43h, Stefan Santesson wrote on pkix:
>Hi Niklas,
>
>I posted your question on the ETSI ESI list and it created some very interesting discussions.
>
>Very briefly there are 3 possible interpretations:
>
>1) Empty. (The value is a empty OCTET STRING of zero bytes)
>2) Zero. (The value is the byte 0x00)
>3) All zeros. (The value is an OCTET STRING of the intended hash value length containing only 0x00 bytes).
>
>
>There are actually some evidence that suggests that the original intent was option 3.
>However, option 3 is the absolute worst from an implementation perspective as it is the hardest to programmatically distinguish from a real hash value.
>
>My conclusion is that the standard is so ambiguous that any receiving implementation should be able to handle all 3 alternatives.
>The standard need to be clarified by ETSI. Until that is done my proposal for sending applications is to use option 1 (empty) because:
>
>1) It is the only option that makes sense and it can be expected as the most probable future resolution
>2) The standard is so ambiguous that validators anyway must expect all options.
>3) This feature is probably not widely implemented. Doing it one way or the other probably has very little impact on interop.
>
>I'll keep you posted if any opinion emerges that materially contradicts this conclusion.
>
>Stefan Santesson
>
>﻿On 2019-07-12, 22:07, "pkix on behalf of Niklas Matthies" <pkix-bounces@ietf.org on behalf of pkix@nmhq.net> wrote:
>
>    Dear all,
>
>    I hope that someone can shed some light on the definition and origin
>    of the special-case "zero" hash value for SigPolicyHash in CAdES. The
>    main question is what exactly constitutes a "zero" hash value on the
>    ASN.1 level.
>
>    In the most current CAdES specification, ETSI EN 319 122-1 V1.1.1
>    (2016-04), the zero hash value is described as follows (clause
>    5.2.9.1, page 20):
>
>        The sigPolicyHash field shall contain the identifier of the hash
>        algorithm and the hash of the value of the signature policy.
>        The hashValue within the sigPolicyHash may be set to zero to
>        indicate that the policy hash value is not known.
>
>            NOTE: The use of a zero-sigPolicyHash value is to ensure
>            backwards compatibility with earlier versions of ETSI TS 101 733 [1].
>
>    The ASN.1 definition of SigPolicyHash is as follows:
>
>        SignaturePolicyId ::= SEQUENCE {
>            sigPolicyId SigPolicyId,
>            sigPolicyHash SigPolicyHash,
>            sigPolicyQualifiers SEQUENCE SIZE (1..MAX) OF
>                SigPolicyQualifierInfo OPTIONAL
>        }
>
>        SigPolicyHash ::= OtherHashAlgAndValue
>
>        OtherHashAlgAndValue ::= SEQUENCE {
>            hashAlgorithm   AlgorithmIdentifier,
>            hashValue       OtherHashValue }
>
>        OtherHashValue ::= OCTET STRING
>
>    The question is what constitutes a "zero" hash value. A zero-length
>    octet string? Any octet string where all octets are zero? Is the
>    length of the octet string relevant, e.g. can or should it match the
>    length implied by the hash algorithm?
>
>    I spent some time going back the history of the standards to find the
>    "earlier version" relevant for the note about backwards compatibility,
>    however that search was inconclusive.
>
>    All versions of ETSI TS 101 733 from the latest V2.2.1 (2013-04) back
>    to V1.7.4 (2008-07) include the following note, which had a second
>    sentence added:
>
>            NOTE: The use of a zero-sigPolicyHash value is to ensure
>            backwards compatibility with earlier versions of the
>            current document. If sigPolicyHash is zero, then the hash
>            value should not be checked against the calculated hash value
>            of the signature policy.
>
>    Confusingly, this now talks about sigPolicyHash being zero (whatever that
>    would mean), not about the hashValue field within sigPolicyHash.
>
>    The same text appears in RFC 5126 (February 2008).
>
>    The previous version ETSI TS 101 733 V1.7.3 (2007-01) is the first
>    version to talk about a zero hash value, and the note is just one
>    sentence again:
>
>        The hashValue within the sigPolicyHash max [sic] be set to zero to
>        indicate that the policy hash value is not known.
>
>            NOTE: The use of zero policy hash value is to ensure backward
>            compatibility with earlier versions of the current document.
>
>    In addition, the annex states the following:
>
>        Annex K (informative): Changes from the previous version
>
>            • if the hash of the signature policy is unknown, then, by
>            convention, the sigPolicyHash shall be set to all zero
>
>    Here again, the annex talks about sigPolicyHash being set to zero,
>    not the hashValue within sigPolicyHash.
>
>    On the RFC side, the same note first appears in
>    https://tools.ietf.org/html/draft-ietf-smime-cades-02 (May 2007),
>    and the sentence above (without the note) first appears in
>    https://tools.ietf.org/html/draft-ietf-smime-cades-01 (April 2006).
>
>    In the previous ETSI TS 101 733 V1.6.3 (2005-09), the sigPolicyHash
>    field is optional (which is mandatory in all previous and all
>    subsequent versions), and the following note is included:
>
>            NOTE: In the previous version of TS 101 733 (i.e. version 1.5.1)
>            sigPolicyHash was mandatory. Implementations requiring to be
>            backward compatible with version 1.5.1 and previous versions
>            of the current document MUST include SigPolicyHash.
>
>    None of the previous versions, from ETSI TS 101 733 V1.5.1 (2003-12)
>    back to ETSI TS 101 733 V1.2.2 (2000-12) (the earliest version available
>    at https://www.etsi.org/deliver/etsi_ts/101700_101799/101733/), as
>    well as RFC 3126 (September 2001), do mention anything about zero hash
>    values.
>
>    So it remains unclear to which specification backwards compatiblity is
>    intended. The point where the wording about zero hash values was
>    introduced suggests that this may be about V1.6.3, where the
>    sigPolicyHash field was optional. However, it's not clear how a "zero"
>    hash value would achieve compatibility with the case of a missing
>    sigPolicyHash field.
>
>    I would appreciate any clarification on that topic.
>
>    Kind regards,
>    Niklas
>
>    _______________________________________________
>    pkix mailing list
>    pkix@ietf.org
>    https://www.ietf.org/mailman/listinfo/pkix
>
>
>


From nobody Tue Jul 16 07:58:15 2019
Return-Path: <pkix@nmhq.net>
X-Original-To: pkix@ietfa.amsl.com
Delivered-To: pkix@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id D2501120614 for <pkix@ietfa.amsl.com>; Tue, 16 Jul 2019 07:58:13 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.9
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EPeaqjBY9gyL for <pkix@ietfa.amsl.com>; Tue, 16 Jul 2019 07:58:11 -0700 (PDT)
Received: from mail.nmhq.net (mail.nmhq.net [95.129.49.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 78EAF1206BB for <pkix@ietf.org>; Tue, 16 Jul 2019 07:58:11 -0700 (PDT)
Received: from matthies by mail.nmhq.net with local (Exim 4.89) (envelope-from <pkix@nmhq.net>) id 1hnOu8-0003UF-9I for pkix@ietf.org; Tue, 16 Jul 2019 16:58:08 +0200
Date: Tue, 16 Jul 2019 16:58:08 +0200
From: Niklas Matthies <pkix@nmhq.net>
To: pkix@ietf.org
Message-ID: <20190716145808.x6slwzijkvdkodyg@nmhq.net>
Mail-Followup-To: pkix@ietf.org
References: <20190712200549.2kgzjqodj5afnxlt@nmhq.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20190712200549.2kgzjqodj5afnxlt@nmhq.net>
X-Clacks-Overhead: GNU Terry Pratchett
X-Editor: VIM - Vi IMproved 8.0
X-Operating-System: Linux 4.4.112 x86_64
User-Agent: NeoMutt/20170113 (1.7.2)
Archived-At: <https://mailarchive.ietf.org/arch/msg/pkix/sQa75_6w60VOJnE0qeB2oDt_Zb0>
Subject: Re: [pkix] Clarification on "zero" hash value in SigPolicyHash (CAdES)
X-BeenThere: pkix@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: PKIX Working Group <pkix.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/pkix>, <mailto:pkix-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/pkix/>
List-Post: <mailto:pkix@ietf.org>
List-Help: <mailto:pkix-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/pkix>, <mailto:pkix-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 16 Jul 2019 14:58:14 -0000

It now occurred to me that sigPolicyHash field being optional in ETSI 
TS 101 733 V1.6.3 (2005-09) probably was discovered to be a mistake 
because (1) it introduces a parsing ambiguity with 
sigPolicyQualifiers, as both are optional SEQUENCEs, and (2) because 
it broke compatibility with existing implementation.

So it would seem that the zero hash value was introduced as a 
workaround to still be able to have an optional hash, syntactically 
masquerading as a real hash, and thus maintaining compatibility with 
the earlier versions at least on the ASN.1 level. Then the note about 
backwards compatibility would not be referring to the support of 
"zero" hash values, but to the fact that keeping the sigPolicyHash 
field mandatory for backwards compatibility reasons leaves no other 
choice than to use a "compatible" encoding for a missing hash value.

This interpretation would favor option 3 (using the length implied by 
the hash algorithm), as this arguably causes the least disruption for 
pre-V1.6.3 (and RFC-3126-based) implementations.

Niklas


On Fri 2019-07-12 at 22:05h, Niklas Matthies wrote on pkix:
>Dear all,
>
>I hope that someone can shed some light on the definition and origin 
>of the special-case "zero" hash value for SigPolicyHash in CAdES. The 
>main question is what exactly constitutes a "zero" hash value on the 
>ASN.1 level.
>
>In the most current CAdES specification, ETSI EN 319 122-1 V1.1.1 
>(2016-04), the zero hash value is described as follows (clause 
>5.2.9.1, page 20):        The sigPolicyHash field shall contain the 
>identifier of the hash    algorithm and the hash of the value of the 
>signature policy.
>   The hashValue within the sigPolicyHash may be set to zero to    
>indicate that the policy hash value is not known.
>
>       NOTE: The use of a zero-sigPolicyHash value is to ensure        
>backwards compatibility with earlier versions of ETSI TS 101 733 [1].
>
>The ASN.1 definition of SigPolicyHash is as follows:
>
>   SignaturePolicyId ::= SEQUENCE {
>       sigPolicyId SigPolicyId,
>       sigPolicyHash SigPolicyHash,
>       sigPolicyQualifiers SEQUENCE SIZE (1..MAX) OF            
>SigPolicyQualifierInfo OPTIONAL
>   }
>
>   SigPolicyHash ::= OtherHashAlgAndValue
>
>   OtherHashAlgAndValue ::= SEQUENCE {
>       hashAlgorithm   AlgorithmIdentifier,
>       hashValue       OtherHashValue }
>
>   OtherHashValue ::= OCTET STRING
>
>The question is what constitutes a "zero" hash value. A zero-length 
>octet string? Any octet string where all octets are zero? Is the 
>length of the octet string relevant, e.g. can or should it match the 
>length implied by the hash algorithm?
>
>I spent some time going back the history of the standards to find the 
>"earlier version" relevant for the note about backwards compatibility, 
>however that search was inconclusive.
>
>All versions of ETSI TS 101 733 from the latest V2.2.1 (2013-04) back 
>to V1.7.4 (2008-07) include the following note, which had a second 
>sentence added:
>
>       NOTE: The use of a zero-sigPolicyHash value is to ensure        
>backwards compatibility with earlier versions of the
>       current document. If sigPolicyHash is zero, then the hash        
>value should not be checked against the calculated hash value        
>of the signature policy.
>
>Confusingly, this now talks about sigPolicyHash being zero (whatever 
>that would mean), not about the hashValue field within sigPolicyHash.
>
>The same text appears in RFC 5126 (February 2008).
>
>The previous version ETSI TS 101 733 V1.7.3 (2007-01) is the first 
>version to talk about a zero hash value, and the note is just one 
>sentence again:
>
>   The hashValue within the sigPolicyHash max [sic] be set to zero to    
>indicate that the policy hash value is not known.
>
>       NOTE: The use of zero policy hash value is to ensure backward        
>compatibility with earlier versions of the current document.
>
>In addition, the annex states the following:
>
>   Annex K (informative): Changes from the previous version
>
>       • if the hash of the signature policy is unknown, then, by        
>convention, the sigPolicyHash shall be set to all zero
>
>Here again, the annex talks about sigPolicyHash being set to zero, not 
>the hashValue within sigPolicyHash.
>
>On the RFC side, the same note first appears in 
>https://tools.ietf.org/html/draft-ietf-smime-cades-02 (May 2007), and 
>the sentence above (without the note) first appears in 
>https://tools.ietf.org/html/draft-ietf-smime-cades-01 (April 2006).
>
>In the previous ETSI TS 101 733 V1.6.3 (2005-09), the sigPolicyHash 
>field is optional (which is mandatory in all previous and all 
>subsequent versions), and the following note is included:
>
>       NOTE: In the previous version of TS 101 733 (i.e. version 
>1.5.1)        sigPolicyHash was mandatory. Implementations requiring 
>to be        backward compatible with version 1.5.1 and previous 
>versions        of the current document MUST include SigPolicyHash.
>
>None of the previous versions, from ETSI TS 101 733 V1.5.1 (2003-12) 
>back to ETSI TS 101 733 V1.2.2 (2000-12) (the earliest version 
>available at 
>https://www.etsi.org/deliver/etsi_ts/101700_101799/101733/), as well 
>as RFC 3126 (September 2001), do mention anything about zero hash 
>values.
>
>So it remains unclear to which specification backwards compatiblity is 
>intended. The point where the wording about zero hash values was 
>introduced suggests that this may be about V1.6.3, where the
>sigPolicyHash field was optional. However, it's not clear how a "zero" 
>hash value would achieve compatibility with the case of a missing 
>sigPolicyHash field.
>
>I would appreciate any clarification on that topic.
>
>Kind regards,
>Niklas
>
>_______________________________________________
>pkix mailing list
>pkix@ietf.org
>https://www.ietf.org/mailman/listinfo/pkix


From nobody Tue Jul 16 08:21:42 2019
Return-Path: <andrea.caccia@studiocaccia.com>
X-Original-To: pkix@ietfa.amsl.com
Delivered-To: pkix@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 7439212076B for <pkix@ietfa.amsl.com>; Tue, 16 Jul 2019 08:21:40 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.899
X-Spam-Level: 
X-Spam-Status: No, score=-1.899 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=aruba.it
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oeuYQRtw-_zA for <pkix@ietfa.amsl.com>; Tue, 16 Jul 2019 08:21:37 -0700 (PDT)
Received: from smtpcmd04131.aruba.it (smtpcmd04131.aruba.it [62.149.158.131]) by ietfa.amsl.com (Postfix) with ESMTP id DE171120757 for <pkix@ietf.org>; Tue, 16 Jul 2019 08:21:36 -0700 (PDT)
Received: from acmac1.station ([2.34.126.254]) by smtpcmd04.ad.aruba.it with bizsmtp id dTMa2000m5VT1yS01TMaFP; Tue, 16 Jul 2019 17:21:35 +0200
From: Andrea Caccia <andrea.caccia@studiocaccia.com>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\))
Date: Tue, 16 Jul 2019 17:21:33 +0200
References: <20190712200549.2kgzjqodj5afnxlt@nmhq.net> <20190716145808.x6slwzijkvdkodyg@nmhq.net>
To: pkix@ietf.org
In-Reply-To: <20190716145808.x6slwzijkvdkodyg@nmhq.net>
Message-Id: <A307DBA2-DE9F-455F-9711-047119D41751@studiocaccia.com>
X-Mailer: Apple Mail (2.3445.104.11)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aruba.it; s=a1; t=1563290495; bh=MJKhuOq7R4w83liuGCGCXqYefAvl/kXguDWcM004aZs=; h=From:Content-Type:Mime-Version:Subject:Date:To; b=jiCgZtu8dkWbS8f300VpXoaesNWjpJYh4tMLQiRxPucDNf9TaFhrM6bGyR9d2OzTv Mu7nF38qmVfBGueDmc2alrSc1gpOLmOEPgtTZP5u6aGgR6LtO8eElKFPKtZYIlycoq 7YQ1tEHJ6PWAg67yqPBIjgLjoTJe4hLNqypVRlSeGwmD9kn66EzMo1s++cn2sQbagk anhjci3rmcyZra1UJy4urZTnupmtxzlJVQuFJZTHaT4vGPPFxjzFqIo2spvdScv/Kg xdXyEyHaoAbYYcObyr1qDvpkV7ZsNvyJwRB0vI/X8xK/iR/jsnm5cYf/+5kvoxys0y uIqjtI6H7dU0Q==
Archived-At: <https://mailarchive.ietf.org/arch/msg/pkix/1ZuDB70h8_EY4DQcn1N3v15iCHQ>
Subject: Re: [pkix] Clarification on "zero" hash value in SigPolicyHash (CAdES)
X-BeenThere: pkix@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: PKIX Working Group <pkix.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/pkix>, <mailto:pkix-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/pkix/>
List-Post: <mailto:pkix@ietf.org>
List-Help: <mailto:pkix-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/pkix>, <mailto:pkix-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 16 Jul 2019 15:21:41 -0000

Dear Niklas and all,
option 3 seems the original intention, also looking at the "shall be set =
to all zero" in Annex K.=20
Being the correct interpretation of the text does not imply also to be =
the best option of course...

Regards,
Andrea


> Il giorno 16 lug 2019, alle ore 16:58, Niklas Matthies <pkix@nmhq.net> =
ha scritto:
>=20
> It now occurred to me that sigPolicyHash field being optional in ETSI =
TS 101 733 V1.6.3 (2005-09) probably was discovered to be a mistake =
because (1) it introduces a parsing ambiguity with sigPolicyQualifiers, =
as both are optional SEQUENCEs, and (2) because it broke compatibility =
with existing implementation.
>=20
> So it would seem that the zero hash value was introduced as a =
workaround to still be able to have an optional hash, syntactically =
masquerading as a real hash, and thus maintaining compatibility with the =
earlier versions at least on the ASN.1 level. Then the note about =
backwards compatibility would not be referring to the support of "zero" =
hash values, but to the fact that keeping the sigPolicyHash field =
mandatory for backwards compatibility reasons leaves no other choice =
than to use a "compatible" encoding for a missing hash value.
>=20
> This interpretation would favor option 3 (using the length implied by =
the hash algorithm), as this arguably causes the least disruption for =
pre-V1.6.3 (and RFC-3126-based) implementations.
>=20
> Niklas
>=20
>=20
> On Fri 2019-07-12 at 22:05h, Niklas Matthies wrote on pkix:
>> Dear all,
>>=20
>> I hope that someone can shed some light on the definition and origin =
of the special-case "zero" hash value for SigPolicyHash in CAdES. The =
main question is what exactly constitutes a "zero" hash value on the =
ASN.1 level.
>>=20
>> In the most current CAdES specification, ETSI EN 319 122-1 V1.1.1 =
(2016-04), the zero hash value is described as follows (clause 5.2.9.1, =
page 20):        The sigPolicyHash field shall contain the identifier of =
the hash    algorithm and the hash of the value of the signature policy.
>>  The hashValue within the sigPolicyHash may be set to zero to    =
indicate that the policy hash value is not known.
>>=20
>>      NOTE: The use of a zero-sigPolicyHash value is to ensure        =
backwards compatibility with earlier versions of ETSI TS 101 733 [1].
>>=20
>> The ASN.1 definition of SigPolicyHash is as follows:
>>=20
>>  SignaturePolicyId ::=3D SEQUENCE {
>>      sigPolicyId SigPolicyId,
>>      sigPolicyHash SigPolicyHash,
>>      sigPolicyQualifiers SEQUENCE SIZE (1..MAX) OF            =
SigPolicyQualifierInfo OPTIONAL
>>  }
>>=20
>>  SigPolicyHash ::=3D OtherHashAlgAndValue
>>=20
>>  OtherHashAlgAndValue ::=3D SEQUENCE {
>>      hashAlgorithm   AlgorithmIdentifier,
>>      hashValue       OtherHashValue }
>>=20
>>  OtherHashValue ::=3D OCTET STRING
>>=20
>> The question is what constitutes a "zero" hash value. A zero-length =
octet string? Any octet string where all octets are zero? Is the length =
of the octet string relevant, e.g. can or should it match the length =
implied by the hash algorithm?
>>=20
>> I spent some time going back the history of the standards to find the =
"earlier version" relevant for the note about backwards compatibility, =
however that search was inconclusive.
>>=20
>> All versions of ETSI TS 101 733 from the latest V2.2.1 (2013-04) back =
to V1.7.4 (2008-07) include the following note, which had a second =
sentence added:
>>=20
>>      NOTE: The use of a zero-sigPolicyHash value is to ensure        =
backwards compatibility with earlier versions of the
>>      current document. If sigPolicyHash is zero, then the hash        =
value should not be checked against the calculated hash value        of =
the signature policy.
>>=20
>> Confusingly, this now talks about sigPolicyHash being zero (whatever =
that would mean), not about the hashValue field within sigPolicyHash.
>>=20
>> The same text appears in RFC 5126 (February 2008).
>>=20
>> The previous version ETSI TS 101 733 V1.7.3 (2007-01) is the first =
version to talk about a zero hash value, and the note is just one =
sentence again:
>>=20
>>  The hashValue within the sigPolicyHash max [sic] be set to zero to   =
 indicate that the policy hash value is not known.
>>=20
>>      NOTE: The use of zero policy hash value is to ensure backward    =
    compatibility with earlier versions of the current document.
>>=20
>> In addition, the annex states the following:
>>=20
>>  Annex K (informative): Changes from the previous version
>>=20
>>      =E2=80=A2 if the hash of the signature policy is unknown, then, =
by        convention, the sigPolicyHash shall be set to all zero
>>=20
>> Here again, the annex talks about sigPolicyHash being set to zero, =
not the hashValue within sigPolicyHash.
>>=20
>> On the RFC side, the same note first appears in =
https://tools.ietf.org/html/draft-ietf-smime-cades-02 (May 2007), and =
the sentence above (without the note) first appears in =
https://tools.ietf.org/html/draft-ietf-smime-cades-01 (April 2006).
>>=20
>> In the previous ETSI TS 101 733 V1.6.3 (2005-09), the sigPolicyHash =
field is optional (which is mandatory in all previous and all subsequent =
versions), and the following note is included:
>>=20
>>      NOTE: In the previous version of TS 101 733 (i.e. version 1.5.1) =
       sigPolicyHash was mandatory. Implementations requiring to be      =
  backward compatible with version 1.5.1 and previous versions        of =
the current document MUST include SigPolicyHash.
>>=20
>> None of the previous versions, from ETSI TS 101 733 V1.5.1 (2003-12) =
back to ETSI TS 101 733 V1.2.2 (2000-12) (the earliest version available =
at https://www.etsi.org/deliver/etsi_ts/101700_101799/101733/), as well =
as RFC 3126 (September 2001), do mention anything about zero hash =
values.
>>=20
>> So it remains unclear to which specification backwards compatiblity =
is intended. The point where the wording about zero hash values was =
introduced suggests that this may be about V1.6.3, where the
>> sigPolicyHash field was optional. However, it's not clear how a =
"zero" hash value would achieve compatibility with the case of a missing =
sigPolicyHash field.
>>=20
>> I would appreciate any clarification on that topic.
>>=20
>> Kind regards,
>> Niklas
>>=20
>> _______________________________________________
>> pkix mailing list
>> pkix@ietf.org
>> https://www.ietf.org/mailman/listinfo/pkix
>=20
> _______________________________________________
> pkix mailing list
> pkix@ietf.org
> https://www.ietf.org/mailman/listinfo/pkix


From nobody Tue Jul 16 19:57:17 2019
Return-Path: <pgut001@cs.auckland.ac.nz>
X-Original-To: pkix@ietfa.amsl.com
Delivered-To: pkix@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id C770C120129 for <pkix@ietfa.amsl.com>; Tue, 16 Jul 2019 19:57:14 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.572
X-Spam-Level: 
X-Spam-Status: No, score=-2.572 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HK_SCAM=1.625, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=auckland.ac.nz
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3fZFCF92WNba for <pkix@ietfa.amsl.com>; Tue, 16 Jul 2019 19:57:12 -0700 (PDT)
Received: from mx4-int.auckland.ac.nz (mx4-int.auckland.ac.nz [130.216.125.246]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 322D01200DB for <pkix@ietf.org>; Tue, 16 Jul 2019 19:57:11 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=auckland.ac.nz; i=@auckland.ac.nz; q=dns/txt; s=mail; t=1563332232; x=1594868232; h=from:to:subject:date:message-id:references:in-reply-to: content-transfer-encoding:mime-version; bh=1oVsht4dlvfRL4Usu6y5W9cYiZ1e72C1snkIzrOksBI=; b=wKOxwGlbwo+x5SG2E6g4eYuPSkMyf43/9HezoGGEvilQtOSjf1dcJbGW AiDB/tCSnIiEpjim3l/TeXfse18Rzf99hzFo2ardosargyEsWzj011Bnk 6O1qkK8qm25qe2o1YKmYu3PKL1OXFzVXxS7aiBQMfxhu/aTPV3d28vXa4 MxyC3x9ic/E7KHCJp4ubf5b2M1ftMCL0bjXKEy47UJ4sD9nhUMnr/2PPz +ADnCDE+QveMkMKw2bjmFnAviQiDRqqVWaQ6rqKgEPvylqNR7Du+FXtpw iqq8GCj+liycyzpd0hul0UYs4wLLaCiTR2Ty52dRmWwGrHyPpO3SS12yP Q==;
X-IronPort-AV: E=Sophos;i="5.64,272,1559476800"; d="scan'208";a="71078266"
X-Ironport-HAT: MAIL-SERVERS - $RELAYED
X-Ironport-Source: 10.6.2.2 - Outgoing - Outgoing
Received: from uxcn13-ogg-a.uoa.auckland.ac.nz ([10.6.2.2]) by mx4-int.auckland.ac.nz with ESMTP/TLS/AES256-SHA; 17 Jul 2019 14:57:09 +1200
Received: from uxcn13-ogg-d.UoA.auckland.ac.nz (10.6.2.5) by uxcn13-ogg-a.UoA.auckland.ac.nz (10.6.2.2) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 17 Jul 2019 14:57:08 +1200
Received: from uxcn13-ogg-d.UoA.auckland.ac.nz ([10.6.2.5]) by uxcn13-ogg-d.UoA.auckland.ac.nz ([10.6.2.5]) with mapi id 15.00.1395.000; Wed, 17 Jul 2019 14:57:08 +1200
From: Peter Gutmann <pgut001@cs.auckland.ac.nz>
To: Niklas Matthies <pkix@nmhq.net>, "pkix@ietf.org" <pkix@ietf.org>
Thread-Topic: [pkix] Clarification on "zero" hash value in SigPolicyHash (CAdES)
Thread-Index: AQHVOO1wcGGXPXcfd0KYugWNDx4HUabMKg4AgABTe4CAAacpqg==
Date: Wed, 17 Jul 2019 02:57:08 +0000
Message-ID: <1563332225748.54393@cs.auckland.ac.nz>
References: <20190712200549.2kgzjqodj5afnxlt@nmhq.net> <0FDBEEC9-0FBA-4C47-BD04-EE7F6053426D@aaa-sec.com>, <20190716134215.txzqvcgghajh2es3@nmhq.net>
In-Reply-To: <20190716134215.txzqvcgghajh2es3@nmhq.net>
Accept-Language: en-NZ, en-GB, en-US
Content-Language: en-NZ
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-ms-exchange-transport-fromentityheader: Hosted
x-originating-ip: [130.216.158.4]
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Archived-At: <https://mailarchive.ietf.org/arch/msg/pkix/rcmpd6vHnOVIYjGPskHSFzb2BRg>
Subject: Re: [pkix] Clarification on "zero" hash value in SigPolicyHash (CAdES)
X-BeenThere: pkix@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: PKIX Working Group <pkix.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/pkix>, <mailto:pkix-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/pkix/>
List-Post: <mailto:pkix@ietf.org>
List-Help: <mailto:pkix-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/pkix>, <mailto:pkix-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 17 Jul 2019 02:57:15 -0000

Niklas Matthies <pkix@nmhq.net> writes:=0A=
=0A=
>All-bits-zero can conceivably be a valid hash value=0A=
=0A=
If someone has a means of reaching not even all-zero-bits but just a=0A=
significant number of leading zero bits for a hash, please contact me off-=
=0A=
list, I have a very lucrative Bitcoin-based business proposition for you.=
=0A=
=0A=
Peter.=0A=


From nobody Tue Jul 16 20:28:18 2019
Return-Path: <pgut001@cs.auckland.ac.nz>
X-Original-To: pkix@ietfa.amsl.com
Delivered-To: pkix@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id B6F74120088 for <pkix@ietfa.amsl.com>; Tue, 16 Jul 2019 20:28:16 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -4.197
X-Spam-Level: 
X-Spam-Status: No, score=-4.197 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=auckland.ac.nz
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HzYUcXaXrXzI for <pkix@ietfa.amsl.com>; Tue, 16 Jul 2019 20:28:15 -0700 (PDT)
Received: from mx4-int.auckland.ac.nz (mx4-int.auckland.ac.nz [130.216.125.246]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 4248B1200DB for <pkix@ietf.org>; Tue, 16 Jul 2019 20:28:14 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=auckland.ac.nz; i=@auckland.ac.nz; q=dns/txt; s=mail; t=1563334095; x=1594870095; h=from:to:subject:date:message-id:references:in-reply-to: content-transfer-encoding:mime-version; bh=8pWrIHEAj7U3zBiehZZ9WHShD5uZXwMPfuSdqXZ4xFU=; b=LYXqQWf0qt1Omihu8h4nffbL/YxL3pGCApGPGC3LkN10rLtIydfw7eXb 0N0iLrvhPAOi2fxsW1q70iLBXm3jfMUZ5mNS45H5kK/UdrxXtbSxOXsXV jicIMtNtzRrpwA7GN1Hogw/qgyCYgC2kbULe94gXvkXW/gl++KCxC3ksM 7LOm/fq649GktsVIvmYZWDa1sbyTE/Lk42pkhhjeX+DKytgrAGpLSKpjk oKLVu+A+/S9ZF4sGvykCv9nKHgyXtZiKvflTbVf8O82ktNf7ANzMFgxiN K+U+qnrZq6E6kpknVyZ/KuJX9mO1lc2fbE/0mnIxxRuD024qMEUsGrnyI A==;
X-IronPort-AV: E=Sophos;i="5.64,272,1559476800"; d="scan'208";a="71083721"
X-Ironport-HAT: MAIL-SERVERS - $RELAYED
X-Ironport-Source: 10.6.3.5 - Outgoing - Outgoing
Received: from exchangemx.uoa.auckland.ac.nz (HELO uxcn13-tdc-d.UoA.auckland.ac.nz) ([10.6.3.5]) by mx4-int.auckland.ac.nz with ESMTP/TLS/AES256-SHA; 17 Jul 2019 15:28:12 +1200
Received: from uxcn13-ogg-d.UoA.auckland.ac.nz (10.6.2.5) by uxcn13-tdc-d.UoA.auckland.ac.nz (10.6.3.5) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 17 Jul 2019 15:28:11 +1200
Received: from uxcn13-ogg-d.UoA.auckland.ac.nz ([10.6.2.5]) by uxcn13-ogg-d.UoA.auckland.ac.nz ([10.6.2.5]) with mapi id 15.00.1395.000; Wed, 17 Jul 2019 15:28:11 +1200
From: Peter Gutmann <pgut001@cs.auckland.ac.nz>
To: Stefan Santesson <stefan@aaa-sec.com>, Niklas Matthies <pkix@nmhq.net>, "pkix@ietf.org" <pkix@ietf.org>
Thread-Topic: [pkix] Clarification on "zero" hash value in SigPolicyHash (CAdES)
Thread-Index: AQHVOO1wcGGXPXcfd0KYugWNDx4HUabMKg4AgADWgxj//3mBgIABs0VG
Date: Wed, 17 Jul 2019 03:28:10 +0000
Message-ID: <1563334087967.97714@cs.auckland.ac.nz>
References: <20190712200549.2kgzjqodj5afnxlt@nmhq.net> <0FDBEEC9-0FBA-4C47-BD04-EE7F6053426D@aaa-sec.com> <1563269533626.58560@cs.auckland.ac.nz>, <218E69B7-036E-45FF-AD3B-9F017FCAF40E@aaa-sec.com>
In-Reply-To: <218E69B7-036E-45FF-AD3B-9F017FCAF40E@aaa-sec.com>
Accept-Language: en-NZ, en-GB, en-US
Content-Language: en-NZ
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-ms-exchange-transport-fromentityheader: Hosted
x-originating-ip: [130.216.158.4]
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Archived-At: <https://mailarchive.ietf.org/arch/msg/pkix/5DW0KraOfN_Yq8-7XNwAhGu5vE8>
Subject: Re: [pkix] Clarification on "zero" hash value in SigPolicyHash (CAdES)
X-BeenThere: pkix@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: PKIX Working Group <pkix.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/pkix>, <mailto:pkix-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/pkix/>
List-Post: <mailto:pkix@ietf.org>
List-Help: <mailto:pkix-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/pkix>, <mailto:pkix-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 17 Jul 2019 03:28:17 -0000

Stefan Santesson <stefan@aaa-sec.com> writes:=0A=
=0A=
>To assign a specific meaning to one out of all possible but syntactically=
=0A=
>valid hash values, is exactly the type of specification work that leads to=
=0A=
>implementation errors and security vulnerabilities.=0A=
=0A=
How would it lead to implementation errors and security vulns?  It's a valu=
e=0A=
that's guaranteed to not match anything while requiring zero changes to=0A=
existing code, what sort of implementation error would it lead to?=0A=
=0A=
Peter.=0A=


From nobody Tue Jul 16 23:34:01 2019
Return-Path: <giessman@informatik.hu-berlin.de>
X-Original-To: pkix@ietfa.amsl.com
Delivered-To: pkix@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 7E468120162 for <pkix@ietfa.amsl.com>; Tue, 16 Jul 2019 23:33:59 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -4.299
X-Spam-Level: 
X-Spam-Status: No, score=-4.299 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=informatik.hu-berlin.de
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KYV9HGpXr2yw for <pkix@ietfa.amsl.com>; Tue, 16 Jul 2019 23:33:57 -0700 (PDT)
Received: from mailout2.informatik.hu-berlin.de (mailout2.informatik.hu-berlin.de [141.20.20.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 32FB612006D for <pkix@ietf.org>; Tue, 16 Jul 2019 23:33:56 -0700 (PDT)
Received: from mailbox.informatik.hu-berlin.de (mailbox [141.20.20.63]) by mailslv1.informatik.hu-berlin.de (8.15.1/8.15.1/INF-2.0-MA-SOLARIS-2.10-25) with ESMTPS id x6H6XO0j017717 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Jul 2019 08:33:24 +0200 (MEST)
Received: from [192.168.2.110] (p548E67AE.dip0.t-ipconnect.de [84.142.103.174]) (authenticated bits=0) by mailbox.informatik.hu-berlin.de (8.15.1/8.15.1/INF-2.0-MA-SOLARIS-2.10-AUTH-26-465-587) with ESMTPSA id x6H6XKZj021680 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=OK); Wed, 17 Jul 2019 08:33:23 +0200 (MEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=informatik.hu-berlin.de; s=mailbox; t=1563345204; bh=g9ub9FP6DJ7bT2rXRRAXCO5ktDsXdwOgP0IwWH8TmCQ=; h=Subject:To:References:From:Date:In-Reply-To; b=XvOag+B6rpzA4Fq758YY87gMxrCuvev8C2HMWvJQ71NkxwRXPcQZr5eZ+aP6NQCVI 6YImFd2AKvg+mJUs6Q40sSA0lWik2qSwadXDd9F5ZxPrUH78S/SkZPapDQgYzl7IGn aR+04B4HS2p2K3mDO1CPnt8bd5GInSPoQyhPT+9Y=
To: Stefan Santesson <stefan@aaa-sec.com>, Peter Gutmann <pgut001@cs.auckland.ac.nz>, "pkix@ietf.org" <pkix@ietf.org>, "esi : etsi tc esi (electronic signatures and infrastructures)" <ESI@LIST.ETSI.ORG>
References: <20190712200549.2kgzjqodj5afnxlt@nmhq.net> <0FDBEEC9-0FBA-4C47-BD04-EE7F6053426D@aaa-sec.com> <1563269533626.58560@cs.auckland.ac.nz> <218E69B7-036E-45FF-AD3B-9F017FCAF40E@aaa-sec.com>
From: Ernst G Giessmann <giessman@informatik.hu-berlin.de>
Openpgp: preference=signencrypt
Autocrypt: addr=giessman@informatik.hu-berlin.de; prefer-encrypt=mutual; keydata= xsBNBEs9Ow0BCACmbNqkEfzjXjR9MmVQxUsJVwMNeFNR//ErnstG+Giessmann//XRR+v7Ux HGaFHyzuR1aVPlRqjd7FyGt2RdjoumhVG9neqThI6B7BApKqD+z8XofzBwtmOVog/bQel/CH IbRTlKaoLz6X/5stCnYS9GUj3oqrnIoqr41DpMlipXHAEQstUSNtHa8uTa8zolCtaaKYm2gs A9k2D02M+jJBtOwFZeOfMcStxp+epnA1qygDRgWvCqEc5lyG9pQw8V8ZmGiULjQlUSmjvkNh SN+gKY2vGJcxVuLr64fCDTtCHFHin471n+MvCMdetAnzk869M4vHVyQeYhd2Jx59qc2jABdA AIHNNEVybnN0IEcgR2llc3NtYW5uIDxnaWVzc21hbkBpbmZvcm1hdGlrLmh1LWJlcmxpbi5k ZT7CwLsEEwEIAGUCG6MCHgECF4AFCRLV3ec4Gmh0dHA6Ly93d3cuaW5mb3JtYXRpay5odS1i ZXJsaW4uZGUvfmdpZXNzbWFuL2dwZy1jcC50eHQCGQEFAlvEXDwHCwkIBwMCAQYVCAoJCwIE FgIDAQAKCRAOAnyymmjvHY6zB/9BxC+TAWxjR0/Qgds40aaIBysDjXxtGwfCO4Ny2RP8EkSY OVDsq5fdb/xzfqN5x5yjlYQhYK6WtD/vG0WFJYOGGueH3L0KGhlIhZUB/7I7Uh87rwVG8ZB9 ArJHdwGXiQbKLLsELnu9KyJXPZOJNmFWitoC93UZkhfFHzits7g5LgtbIfscPbRBUYUVz1Xy 2VY6YUrr7uoTxEkC7NlTIIxWIsJ1Aqctg5PhVxjiad/L+rYGc9wh2GHTCUWmKExbgkKvbm9a jE1vXXt7kaMZ9hjLrrogQUQnlOEZyGaseIW4UTWUiSQz9N3nF/o5Ckn4iHB+HhAH2nxI5SPd pVANUWDnzsBFBEtHGqMBB8C226uIsivcmIJ0p8h1s3hZkXWNT/OsWgr/XClW8DNNQ0hehn3d scxNiQCToavpkqRfQMumRCuhUoYpbqV09q1eNnIlmWTQwsvxjbe4RGeKKiuVIGScMDZC94CE S0HBhGtwcw3zgORvJ8bgm+yjFt5HO/EMuQr8bbK5WIgT7SmywCz/wyMzpulM3LDB70pyrUCY DyHbz8sWUN/yOwAKpEl1hU6PHFJu9eWOx3WpBxLJE77unUKvBiBJZRoxXq+OBjSl4ShBSWp1 61PSvTWu1s2OtdGJIR0BijIf3Jt2zO5TrO1AwD1qrrzf2GravNxVxbbPogsalCn/EwARAQAB wsBfBBgBCAAJBQJLRxqjAhsMAAoJEA4CfLKaaO8dNpsIAKL/Rqud7r2RtNHxMpKlFbUw/WVd WSaN3ZGLlnlYx/rKgH5YLEB2Vft6wab6/C4BPaD0E/gRi7Uw1/bbvqhyyMHbf/QVR2qkOQUW Ettyj+LzOjftdg59UyBqaX9CRtJcqwVOqZYSUKH1l+Ip/NoP0lO/nfoF2jdum09uRIQOoPHM uoT7IT7DwdcJ1URkUqGD9QV6uiT3oGXdJmkyCCURm5EksXG0Inbo28d+cuHkNV0O+DpXDgep ja1934KN5guvaNQqXJQEo5V9f/m4LgRUd+KCbYfyFvbTEu6WIhD3wCxzlvNuAfPAKrV7VU3h 3wKe/PMysE+k8LdtVs6GeYWCfqA=
Message-ID: <66ca08a2-13e5-3c6a-c7db-2c95104c1e2d@informatik.hu-berlin.de>
Date: Wed, 17 Jul 2019 08:33:19 +0200
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0
MIME-Version: 1.0
In-Reply-To: <218E69B7-036E-45FF-AD3B-9F017FCAF40E@aaa-sec.com>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
X-Virus-Scanned: clamav-milter 0.100.2 at mailbox
X-Virus-Status: Clean
X-Greylist: Sender succeeded STARTTLS authentication, not delayed by milter-greylist-4.6.1 (mailslv1.informatik.hu-berlin.de [141.20.20.51]); Wed, 17 Jul 2019 08:33:24 +0200 (MEST)
Archived-At: <https://mailarchive.ietf.org/arch/msg/pkix/DOZtbPGlNtd6FH-Qj5648VUc0Yk>
Subject: Re: [pkix] Clarification on "zero" hash value in SigPolicyHash (CAdES)
X-BeenThere: pkix@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: PKIX Working Group <pkix.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/pkix>, <mailto:pkix-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/pkix/>
List-Post: <mailto:pkix@ietf.org>
List-Help: <mailto:pkix-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/pkix>, <mailto:pkix-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 17 Jul 2019 06:33:59 -0000

Stefan,
what about the implementation of EC-RDSA (RFC 7091), where exactly this
"one out of all" is required:
https://tools.ietf.org/html/rfc7091#section-6.1

-----
Step 2.
...
If e = 0, then assign e = 1.
-----

;-)

/Ernst.

Note, that in this case it is crystal clear said what to do, which is
missing in the TS.

Am 2019-07-16 um 15:29 schrieb Stefan Santesson:
> To assign a specific meaning to one out of all possible but
> syntactically valid hash values, is exactly the type of specification
> work that leads to implementation errors and security vulnerabilities.
> Stefan Santesson 
...


From nobody Wed Jul 17 00:46:46 2019
Return-Path: <stefan@aaa-sec.com>
X-Original-To: pkix@ietfa.amsl.com
Delivered-To: pkix@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 55074120111 for <pkix@ietfa.amsl.com>; Wed, 17 Jul 2019 00:46:36 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.596
X-Spam-Level: 
X-Spam-Status: No, score=-2.596 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, MIME_QP_LONG_LINE=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_NONE=0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SQ_oUClCG9yT for <pkix@ietfa.amsl.com>; Wed, 17 Jul 2019 00:46:34 -0700 (PDT)
Received: from smtp.outgoing.loopia.se (smtp.outgoing.loopia.se [194.9.95.112]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id DD5D312009C for <pkix@ietf.org>; Wed, 17 Jul 2019 00:46:33 -0700 (PDT)
Received: from s554.loopia.se (localhost [127.0.0.1]) by s554.loopia.se (Postfix) with ESMTP id 9A3F01F165EE for <pkix@ietf.org>; Wed, 17 Jul 2019 09:46:30 +0200 (CEST)
Received: from s498.loopia.se (unknown [172.21.200.36]) by s554.loopia.se (Postfix) with ESMTP id 7BD6779537F; Wed, 17 Jul 2019 09:46:30 +0200 (CEST)
Received: from s472.loopia.se (unknown [172.22.191.5]) by s498.loopia.se (Postfix) with ESMTP id 77F424707A3; Wed, 17 Jul 2019 09:46:30 +0200 (CEST)
X-Virus-Scanned: amavisd-new at amavis.loopia.se
Received: from s500.loopia.se ([172.22.191.5]) by s472.loopia.se (s472.loopia.se [172.22.190.12]) (amavisd-new, port 10024) with LMTP id jqW8S1vylBbT; Wed, 17 Jul 2019 09:46:29 +0200 (CEST)
X-Loopia-Auth: user
X-Loopia-User: mailstore2@aaa-sec.com
X-Loopia-Originating-IP: 85.235.7.89
Received: from [192.168.2.38] (gw.aaa-sec.ideon.se [85.235.7.89]) (Authenticated sender: mailstore2@aaa-sec.com) by s500.loopia.se (Postfix) with ESMTPSA id B414A1E1462B; Wed, 17 Jul 2019 09:46:29 +0200 (CEST)
User-Agent: Microsoft-MacOutlook/10.1a.0.190609
Date: Wed, 17 Jul 2019 09:46:28 +0200
From: Stefan Santesson <stefan@aaa-sec.com>
To: Peter Gutmann <pgut001@cs.auckland.ac.nz>, Niklas Matthies <pkix@nmhq.net>, "pkix@ietf.org" <pkix@ietf.org>
Message-ID: <0A77452C-112C-4326-A5DA-661DBD4DDD69@aaa-sec.com>
Thread-Topic: [pkix] Clarification on "zero" hash value in SigPolicyHash (CAdES)
References: <20190712200549.2kgzjqodj5afnxlt@nmhq.net> <0FDBEEC9-0FBA-4C47-BD04-EE7F6053426D@aaa-sec.com> <1563269533626.58560@cs.auckland.ac.nz> <218E69B7-036E-45FF-AD3B-9F017FCAF40E@aaa-sec.com> <1563334087967.97714@cs.auckland.ac.nz>
In-Reply-To: <1563334087967.97714@cs.auckland.ac.nz>
Mime-version: 1.0
Content-type: text/plain; charset="UTF-8"
Content-transfer-encoding: quoted-printable
Archived-At: <https://mailarchive.ietf.org/arch/msg/pkix/DhUapQPTxSTuKN9MGPkckzscEEs>
Subject: Re: [pkix] Clarification on "zero" hash value in SigPolicyHash (CAdES)
X-BeenThere: pkix@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: PKIX Working Group <pkix.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/pkix>, <mailto:pkix-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/pkix/>
List-Post: <mailto:pkix@ietf.org>
List-Help: <mailto:pkix-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/pkix>, <mailto:pkix-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 17 Jul 2019 07:46:36 -0000

The spec says: Don't match hash to a real document if the hash value is A, =
but ignore matching for any hash values other than A.
(A =3D all zero in this case).

That (quite obviously) may lead to security vulnerabilities if matching is =
important for security and implementers don't get it right.
Example: An implementer gets this wrong and only test if the first byte of =
the hash (he forgot to increment the index counter). I can then cause this i=
mplementation to skip matching if I produce a hash with first byte set to 0x=
00.

All I'm saying is that a safer design is to say "Don't match if value is ab=
sent". Implementers are more likely to get that right, but there are no guar=
antees.

Stefan Santesson=20

=EF=BB=BFOn 2019-07-17, 05:28, "Peter Gutmann" <pgut001@cs.auckland.ac.nz> wrote:

    Stefan Santesson <stefan@aaa-sec.com> writes:
   =20
    >To assign a specific meaning to one out of all possible but syntactica=
lly
    >valid hash values, is exactly the type of specification work that lead=
s to
    >implementation errors and security vulnerabilities.
   =20
    How would it lead to implementation errors and security vulns?  It's a =
value
    that's guaranteed to not match anything while requiring zero changes to
    existing code, what sort of implementation error would it lead to?
   =20
    Peter.
   =20



From nobody Wed Jul 17 00:53:49 2019
Return-Path: <stefan@aaa-sec.com>
X-Original-To: pkix@ietfa.amsl.com
Delivered-To: pkix@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id A97FF120140 for <pkix@ietfa.amsl.com>; Wed, 17 Jul 2019 00:53:46 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.596
X-Spam-Level: 
X-Spam-Status: No, score=-2.596 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, MIME_QP_LONG_LINE=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_NONE=0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kud1Y5XDb7Q3 for <pkix@ietfa.amsl.com>; Wed, 17 Jul 2019 00:53:44 -0700 (PDT)
Received: from smtp.outgoing.loopia.se (smtp.outgoing.loopia.se [194.9.95.112]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id E196312009C for <pkix@ietf.org>; Wed, 17 Jul 2019 00:53:43 -0700 (PDT)
Received: from s554.loopia.se (localhost [127.0.0.1]) by s554.loopia.se (Postfix) with ESMTP id 916AC1F1608C for <pkix@ietf.org>; Wed, 17 Jul 2019 09:53:41 +0200 (CEST)
Received: from s498.loopia.se (unknown [172.21.200.36]) by s554.loopia.se (Postfix) with ESMTP id 7349F7953EB; Wed, 17 Jul 2019 09:53:41 +0200 (CEST)
Received: from s476.loopia.se (unknown [172.22.191.5]) by s498.loopia.se (Postfix) with ESMTP id 7000347074B; Wed, 17 Jul 2019 09:53:41 +0200 (CEST)
X-Virus-Scanned: amavisd-new at amavis.loopia.se
Received: from s500.loopia.se ([172.22.191.5]) by s476.loopia.se (s476.loopia.se [172.22.190.16]) (amavisd-new, port 10024) with UTF8LMTP id XeBwYcJvMmlZ; Wed, 17 Jul 2019 09:53:40 +0200 (CEST)
X-Loopia-Auth: user
X-Loopia-User: mailstore2@aaa-sec.com
X-Loopia-Originating-IP: 85.235.7.89
Received: from [192.168.2.38] (gw.aaa-sec.ideon.se [85.235.7.89]) (Authenticated sender: mailstore2@aaa-sec.com) by s500.loopia.se (Postfix) with ESMTPSA id C0FB71E14600; Wed, 17 Jul 2019 09:53:40 +0200 (CEST)
User-Agent: Microsoft-MacOutlook/10.1a.0.190609
Date: Wed, 17 Jul 2019 09:53:39 +0200
From: Stefan Santesson <stefan@aaa-sec.com>
To: Niklas Matthies <pkix@nmhq.net>, <pkix@ietf.org>
Message-ID: <32262DB0-BA95-4ECD-ACF9-B5BD50F7B442@aaa-sec.com>
Thread-Topic: [pkix] Clarification on "zero" hash value in SigPolicyHash (CAdES)
References: <20190712200549.2kgzjqodj5afnxlt@nmhq.net> <20190716145808.x6slwzijkvdkodyg@nmhq.net>
In-Reply-To: <20190716145808.x6slwzijkvdkodyg@nmhq.net>
Mime-version: 1.0
Content-type: text/plain; charset="UTF-8"
Content-transfer-encoding: quoted-printable
Archived-At: <https://mailarchive.ietf.org/arch/msg/pkix/vJsikLAC96BTHpq2xxqDWTin-88>
Subject: Re: [pkix] Clarification on "zero" hash value in SigPolicyHash (CAdES)
X-BeenThere: pkix@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: PKIX Working Group <pkix.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/pkix>, <mailto:pkix-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/pkix/>
List-Post: <mailto:pkix@ietf.org>
List-Help: <mailto:pkix-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/pkix>, <mailto:pkix-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 17 Jul 2019 07:53:47 -0000

Niklas,

Thanks for your analysis, which quite possibly is very true.

However, I would just add that an empty OCTET STRING value would also be "s=
yntactically correct" on the ASN.1 level.

Stefan Santesson=20

=EF=BB=BFOn 2019-07-16, 16:58, "pkix on behalf of Niklas Matthies" <pkix-bounces@=
ietf.org on behalf of pkix@nmhq.net> wrote:

    It now occurred to me that sigPolicyHash field being optional in ETSI=20
    TS 101 733 V1.6.3 (2005-09) probably was discovered to be a mistake=20
    because (1) it introduces a parsing ambiguity with=20
    sigPolicyQualifiers, as both are optional SEQUENCEs, and (2) because=20
    it broke compatibility with existing implementation.
   =20
    So it would seem that the zero hash value was introduced as a=20
    workaround to still be able to have an optional hash, syntactically=20
    masquerading as a real hash, and thus maintaining compatibility with=20
    the earlier versions at least on the ASN.1 level. Then the note about=20
    backwards compatibility would not be referring to the support of=20
    "zero" hash values, but to the fact that keeping the sigPolicyHash=20
    field mandatory for backwards compatibility reasons leaves no other=20
    choice than to use a "compatible" encoding for a missing hash value.
   =20
    This interpretation would favor option 3 (using the length implied by=20
    the hash algorithm), as this arguably causes the least disruption for=20
    pre-V1.6.3 (and RFC-3126-based) implementations.
   =20
    Niklas
   =20
   =20
    On Fri 2019-07-12 at 22:05h, Niklas Matthies wrote on pkix:
    >Dear all,
    >
    >I hope that someone can shed some light on the definition and origin=20
    >of the special-case "zero" hash value for SigPolicyHash in CAdES. The=20
    >main question is what exactly constitutes a "zero" hash value on the=20
    >ASN.1 level.
    >
    >In the most current CAdES specification, ETSI EN 319 122-1 V1.1.1=20
    >(2016-04), the zero hash value is described as follows (clause=20
    >5.2.9.1, page 20):        The sigPolicyHash field shall contain the=20
    >identifier of the hash    algorithm and the hash of the value of the=20
    >signature policy.
    >   The hashValue within the sigPolicyHash may be set to zero to   =20
    >indicate that the policy hash value is not known.
    >
    >       NOTE: The use of a zero-sigPolicyHash value is to ensure       =
=20
    >backwards compatibility with earlier versions of ETSI TS 101 733 [1].
    >
    >The ASN.1 definition of SigPolicyHash is as follows:
    >
    >   SignaturePolicyId ::=3D SEQUENCE {
    >       sigPolicyId SigPolicyId,
    >       sigPolicyHash SigPolicyHash,
    >       sigPolicyQualifiers SEQUENCE SIZE (1..MAX) OF           =20
    >SigPolicyQualifierInfo OPTIONAL
    >   }
    >
    >   SigPolicyHash ::=3D OtherHashAlgAndValue
    >
    >   OtherHashAlgAndValue ::=3D SEQUENCE {
    >       hashAlgorithm   AlgorithmIdentifier,
    >       hashValue       OtherHashValue }
    >
    >   OtherHashValue ::=3D OCTET STRING
    >
    >The question is what constitutes a "zero" hash value. A zero-length=20
    >octet string? Any octet string where all octets are zero? Is the=20
    >length of the octet string relevant, e.g. can or should it match the=20
    >length implied by the hash algorithm?
    >
    >I spent some time going back the history of the standards to find the=20
    >"earlier version" relevant for the note about backwards compatibility,=
=20
    >however that search was inconclusive.
    >
    >All versions of ETSI TS 101 733 from the latest V2.2.1 (2013-04) back=20
    >to V1.7.4 (2008-07) include the following note, which had a second=20
    >sentence added:
    >
    >       NOTE: The use of a zero-sigPolicyHash value is to ensure       =
=20
    >backwards compatibility with earlier versions of the
    >       current document. If sigPolicyHash is zero, then the hash      =
 =20
    >value should not be checked against the calculated hash value       =20
    >of the signature policy.
    >
    >Confusingly, this now talks about sigPolicyHash being zero (whatever=20
    >that would mean), not about the hashValue field within sigPolicyHash.
    >
    >The same text appears in RFC 5126 (February 2008).
    >
    >The previous version ETSI TS 101 733 V1.7.3 (2007-01) is the first=20
    >version to talk about a zero hash value, and the note is just one=20
    >sentence again:
    >
    >   The hashValue within the sigPolicyHash max [sic] be set to zero to =
  =20
    >indicate that the policy hash value is not known.
    >
    >       NOTE: The use of zero policy hash value is to ensure backward  =
     =20
    >compatibility with earlier versions of the current document.
    >
    >In addition, the annex states the following:
    >
    >   Annex K (informative): Changes from the previous version
    >
    >       =E2=80=A2 if the hash of the signature policy is unknown, then, by   =
    =20
    >convention, the sigPolicyHash shall be set to all zero
    >
    >Here again, the annex talks about sigPolicyHash being set to zero, not=
=20
    >the hashValue within sigPolicyHash.
    >
    >On the RFC side, the same note first appears in=20
    >https://tools.ietf.org/html/draft-ietf-smime-cades-02 (May 2007), and=20
    >the sentence above (without the note) first appears in=20
    >https://tools.ietf.org/html/draft-ietf-smime-cades-01 (April 2006).
    >
    >In the previous ETSI TS 101 733 V1.6.3 (2005-09), the sigPolicyHash=20
    >field is optional (which is mandatory in all previous and all=20
    >subsequent versions), and the following note is included:
    >
    >       NOTE: In the previous version of TS 101 733 (i.e. version=20
    >1.5.1)        sigPolicyHash was mandatory. Implementations requiring=20
    >to be        backward compatible with version 1.5.1 and previous=20
    >versions        of the current document MUST include SigPolicyHash.
    >
    >None of the previous versions, from ETSI TS 101 733 V1.5.1 (2003-12)=20
    >back to ETSI TS 101 733 V1.2.2 (2000-12) (the earliest version=20
    >available at=20
    >https://www.etsi.org/deliver/etsi_ts/101700_101799/101733/), as well=20
    >as RFC 3126 (September 2001), do mention anything about zero hash=20
    >values.
    >
    >So it remains unclear to which specification backwards compatiblity is=
=20
    >intended. The point where the wording about zero hash values was=20
    >introduced suggests that this may be about V1.6.3, where the
    >sigPolicyHash field was optional. However, it's not clear how a "zero"=
=20
    >hash value would achieve compatibility with the case of a missing=20
    >sigPolicyHash field.
    >
    >I would appreciate any clarification on that topic.
    >
    >Kind regards,
    >Niklas
    >
    >_______________________________________________
    >pkix mailing list
    >pkix@ietf.org
    >https://www.ietf.org/mailman/listinfo/pkix
   =20
    _______________________________________________
    pkix mailing list
    pkix@ietf.org
    https://www.ietf.org/mailman/listinfo/pkix
   =20



From nobody Wed Jul 17 17:03:27 2019
Return-Path: <kaduk@mit.edu>
X-Original-To: pkix@ietfa.amsl.com
Delivered-To: pkix@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 091BC12015C for <pkix@ietfa.amsl.com>; Wed, 17 Jul 2019 17:03:26 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -4.199
X-Spam-Level: 
X-Spam-Status: No, score=-4.199 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id uqNSWeNwtDIL for <pkix@ietfa.amsl.com>; Wed, 17 Jul 2019 17:03:24 -0700 (PDT)
Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id EA3B8120108 for <pkix@ietf.org>; Wed, 17 Jul 2019 17:03:23 -0700 (PDT)
Received: from kduck.mit.edu ([24.16.140.251]) (authenticated bits=56) (User authenticated as kaduk@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id x6I033Pi011008 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 17 Jul 2019 20:03:06 -0400
Date: Wed, 17 Jul 2019 19:03:02 -0500
From: Benjamin Kaduk <kaduk@mit.edu>
To: RFC Errata System <rfc-editor@rfc-editor.org>
Cc: pritikin@cisco.com, peter@akayla.com, dharkins@arubanetworks.com, rdd@cert.org, kent@bbn.com, stefan@aaa-sec.com, ediz_cracked@hotmail.com, pkix@ietf.org
Message-ID: <20190718000302.GB83144@kduck.mit.edu>
References: <20190713012609.ADF9DB80B1C@rfc-editor.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20190713012609.ADF9DB80B1C@rfc-editor.org>
User-Agent: Mutt/1.10.1 (2018-07-13)
Archived-At: <https://mailarchive.ietf.org/arch/msg/pkix/3hZ_fV2mIkYjVbvcCFXsVFnK1js>
Subject: Re: [pkix] [Editorial Errata Reported] RFC7030 (5779)
X-BeenThere: pkix@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: PKIX Working Group <pkix.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/pkix>, <mailto:pkix-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/pkix/>
List-Post: <mailto:pkix@ietf.org>
List-Help: <mailto:pkix-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/pkix>, <mailto:pkix-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 18 Jul 2019 00:03:26 -0000

On Fri, Jul 12, 2019 at 06:26:09PM -0700, RFC Errata System wrote:
> The following errata report has been submitted for RFC7030,
> "Enrollment over Secure Transport".
> 
> --------------------------------------
> You may review the report below and at:
> https://www.rfc-editor.org/errata/eid5779
> 
> --------------------------------------
> Type: Editorial
> Reported by: Simon Edänge <ediz_cracked@hotmail.com>
> 
> Section: A.4
> 
> Original Text
> -------------
>  Because the DecryptKeyIdentifier attribute is not included in this
>    request, the response does not include additional encryption beyond
>    the TLS session.  The EST server response is:
> 
>    HTTP/1.1 200 OK
>    Status: 200 OK
>    Content-Type: multipart/mixed ; boundary=estServerExampleBoundary
>    Content-Length: 3219
> 
>    This is the preamble.  It is to be ignored, though it
>    is a handy place for estServer to include an explanatory note,
>    including contact or support information.
>    --estServerExampleBoundary
>    Content-Type: application/pkcs8
>    Content-Transfer-Encoding: base64
> 
> Corrected Text
> --------------
>  Because the DecryptKeyIdentifier attribute is not included in this
>    request, the response does not include additional encryption beyond
>    the TLS session.  The EST server response is:
> 
>    HTTP/1.1 200 OK
>    Status: 200 OK
>    Content-Type: multipart/mixed; boundary=estServerExampleBoundary
>    Content-Length: 3219
> 
>    This is the preamble.  It is to be ignored, though it
>    is a handy place for estServer to include an explanatory note,
>    including contact or support information.
>    --estServerExampleBoundary
>    Content-Type: application/pkcs8
>    Content-Transfer-Encoding: base64
> 
> Notes
> -----
> Content-Type: multipart/mixed ; boundary=estServerExampleBoundary
> 
> The ; has a space, believe it or not, we implemented it that way.

https://tools.ietf.org/html/rfc7231#section-3.1.1.1 says

     media-type = type "/" subtype *( OWS ";" OWS parameter )

which would seem to allow for whitespace before the semicolon.
So  I think this should be rejected.

-Ben

