CryptRegisterOIDFunction function

The CryptRegisterOIDFunction function registers a DLL that contains the function to be called for the specified encoding type, function name, and object identifier (OID).

By default, new function names are installed at the end of the list. To register a new function before the installed functions, call the CryptSetOIDFunctionValue function with dwValueType set to REG_DWORD and pwszValueName set to CRYPT_OID_REG_FLAGS_VALUE_NAME.

CRYPT_OID_REG_FLAGS_VALUE_NAME is defined as L"CryptFlags".

In addition to registering a DLL, the name of the function to be called can be overridden. For example, the pszFuncName parameter can be set to CryptDllEncodeObject and the pszOverrideFuncName parameter to MyEncodeXyz. The new form of CryptDllEncodeObject can then be referred to by using the name MyEncodeXyz. This allows a DLL to export multiple OID functions for the same function name without needing to interpose its own OID dispatcher function.

Syntax

BOOL CryptRegisterOIDFunction(
  DWORD   dwEncodingType,
  LPCSTR  pszFuncName,
  LPCSTR  pszOID,
  LPCWSTR pwszDll,
  LPCSTR  pszOverrideFuncName
);

Parameters

dwEncodingType

Specifies the encoding type to be matched. Currently, only X509_ASN_ENCODING and PKCS_7_ASN_ENCODING are being used; however, additional encoding types may be added in the future. To match both current encoding types, use:

X509_ASN_ENCODING | PKCS_7_ASN_ENCODING.

pszFuncName

Name of the function being registered.

pszOID

OID of the function to be registered. If the high-order word of the OID is nonzero, pszOID is a pointer to either an OID string such as "2.5.29.1" or an ASCII string such as "file." If the high-order word of the OID is zero, the low-order word specifies the numeric identifier to be used as the object identifier.

pwszDll

Name of the DLL file to be registered. It can contain environment-variable strings to be expanded by using the ExpandEnvironmentStrings function before loading the DLL.

pszOverrideFuncName

String that specifies a name for the function exported in the DLL. If pszOverrideFuncName is NULL, the function name specified by pszFuncName is used.

Return Value

If the function succeeds, the return value is nonzero (TRUE).

If the function fails, the return value is zero (FALSE).

Remarks

When you have finished using an OID function, unregister it by calling the CryptUnregisterOIDFunction function.

Requirements

   
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header wincrypt.h
Library Crypt32.lib
DLL Crypt32.dll

See Also

CryptSetOIDFunctionValue

CryptUnregisterOIDFunction

OID Support Functions