2 * Copyright 2005 Juan Lang
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #ifndef __CRYPT32_PRIVATE_H__
20 #define __CRYPT32_PRIVATE_H__
22 /* a few asn.1 tags we need */
23 #define ASN_BOOL (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x01)
24 #define ASN_BITSTRING (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x03)
25 #define ASN_ENUMERATED (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x0a)
26 #define ASN_SETOF (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x11)
27 #define ASN_NUMERICSTRING (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x12)
28 #define ASN_PRINTABLESTRING (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x13)
29 #define ASN_IA5STRING (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x16)
30 #define ASN_UTCTIME (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x17)
31 #define ASN_GENERALTIME (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x18)
33 /* The following aren't defined in wincrypt.h, as they're "reserved" */
34 #define CERT_CERT_PROP_ID 32
35 #define CERT_CRL_PROP_ID 33
36 #define CERT_CTL_PROP_ID 34
38 /* Returns a handle to the default crypto provider; loads it if necessary.
39 * Returns NULL on failure.
41 HCRYPTPROV CRYPT_GetDefaultProvider(void);
43 void crypt_oid_init(HINSTANCE hinst);
44 void crypt_oid_free(void);
46 /* Helper function for store reading functions and
47 * CertAddSerializedElementToStore. Returns a context of the appropriate type
48 * if it can, or NULL otherwise. Doesn't validate any of the properties in
49 * the serialized context (for example, bad hashes are retained.)
50 * *pdwContentType is set to the type of the returned context.
52 const void *CRYPT_ReadSerializedElement(const BYTE *pbElement,
53 DWORD cbElement, DWORD dwContextTypeFlags, DWORD *pdwContentType);
56 * Context property list functions
58 struct _CONTEXT_PROPERTY_LIST;
59 typedef struct _CONTEXT_PROPERTY_LIST *PCONTEXT_PROPERTY_LIST;
61 PCONTEXT_PROPERTY_LIST ContextPropertyList_Create(void);
63 /* Searches for the property with ID id in the context. Returns TRUE if found,
64 * and copies the property's length and a pointer to its data to blob.
65 * Otherwise returns FALSE.
67 BOOL ContextPropertyList_FindProperty(PCONTEXT_PROPERTY_LIST list, DWORD id,
68 PCRYPT_DATA_BLOB blob);
70 BOOL ContextPropertyList_SetProperty(PCONTEXT_PROPERTY_LIST list, DWORD id,
71 const BYTE *pbData, size_t cbData);
73 void ContextPropertyList_RemoveProperty(PCONTEXT_PROPERTY_LIST list, DWORD id);
75 DWORD ContextPropertyList_EnumPropIDs(PCONTEXT_PROPERTY_LIST list, DWORD id);
77 void ContextPropertyList_Copy(PCONTEXT_PROPERTY_LIST to,
78 PCONTEXT_PROPERTY_LIST from);
80 void ContextPropertyList_Free(PCONTEXT_PROPERTY_LIST list);