]>
Commit | Line | Data |
---|---|---|
b1ab9ed8 | 1 | /* |
d8f41ccd | 2 | * Copyright (c) 2008,2011 Apple Inc. All Rights Reserved. |
b1ab9ed8 A |
3 | * |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
6 | * This file contains Original Code and/or Modifications of Original Code | |
7 | * as defined in and that are subject to the Apple Public Source License | |
8 | * Version 2.0 (the 'License'). You may not use this file except in | |
9 | * compliance with the License. Please obtain a copy of the License at | |
10 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
11 | * file. | |
12 | * | |
13 | * The Original Code and all software distributed under the License are | |
14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | |
18 | * Please see the License for the specific language governing rights and | |
19 | * limitations under the License. | |
20 | * | |
21 | * @APPLE_LICENSE_HEADER_END@ | |
22 | */ | |
23 | ||
24 | /* | |
25 | * siginfoUtils.cpp - private C++ routines for cmssiginfo | |
26 | */ | |
27 | ||
28 | #include <Security/SecCmsSignerInfo.h> | |
29 | #include <security_utilities/simpleprefs.h> | |
30 | #include "cmspriv.h" /* prototype */ | |
31 | ||
32 | /* | |
33 | * RFC 3278 section section 2.1.1 states that the signatureAlgorithm | |
34 | * field contains the full ecdsa-with-SHA1 OID, not plain old ecPublicKey | |
35 | * as would appear in other forms of signed datas. However Microsoft doesn't | |
36 | * do this, it puts ecPublicKey there, and if we put ecdsa-with-SHA1 there, | |
37 | * MS can't verify - presumably because it takes the digest of the digest | |
38 | * before feeding it to ECDSA. | |
39 | * We handle this with a preference; default if it's not there is | |
40 | * "Microsoft compatibility mode". | |
41 | */ | |
42 | ||
43 | bool SecCmsMsEcdsaCompatMode() | |
44 | { | |
45 | bool msCompat = true; | |
46 | Dictionary *pd = Dictionary::CreateDictionary(kMSCompatibilityDomain, Dictionary::US_User, false); | |
47 | if(pd == NULL) { | |
48 | pd = Dictionary::CreateDictionary(kMSCompatibilityDomain, Dictionary::US_System, false); | |
49 | } | |
50 | if(pd != NULL) { | |
51 | /* | |
52 | * not present means true, the opposite of getBoolValue(), so we have to see if | |
53 | * it's there... | |
54 | */ | |
55 | if(pd->getValue(kMSCompatibilityMode)) { | |
56 | msCompat = pd->getBoolValue(kMSCompatibilityMode); | |
57 | } | |
58 | delete pd; | |
59 | } | |
60 | return msCompat; | |
61 | } | |
62 |