Export (0) Print
Expand All
Expand Minimize
1 out of 1 rated this helpful - Rate this topic

CryptXmlSign function

The CryptXmlSign function creates a cryptographic signature of a SignedInfo element.

Syntax


HRESULT WINAPI CryptXmlSign(
  _In_      HCRYPTXML hSignature,
  _In_opt_  HCRYPTPROV_OR_NCRYPT_KEY_HANDLE hKey,
  DWORD dwKeySpec,
  DWORD dwFlags,
  CRYPT_XML_KEYINFO_SPEC dwKeyInfoSpec,
  _In_opt_  const void pvKeyInfoSpec,
  _In_      const CRYPT_XML_ALGORITHM pSignatureMethod,
  _In_      const CRYPT_XML_ALGORITHM pCanonicalization
);

Parameters

hSignature [in]

The handle to a CRYPT_XML_SIGNATURE structure.

hKey [in, optional]

The handle of a private key used to sign the SignedInfo element. This parameter must be NULL for HMAC-based signature algorithms.

dwKeySpec

A DWORD value that specifies the key type. This parameter can be one of the following values.

ValueMeaning
AT_KEYEXCHANGE
1

The key pair is a key exchange pair.

AT_SIGNATURE
2

The key pair is a signature pair.

CERT_NCRYPT_KEY_SPEC
0xFFFFFFFF

The key is a Cryptography API: Next Generation (CNG) key.

 

dwFlags

A DWORD value that controls how the data is signed. This parameter can be one of the following values.

ValueMeaning
CRYPT_XML_SIGN_ADD_KEYVALUE
0x00000001

Populate the KeyValue element from the handle specified in the hKey parameter.

Important  The CRYPT_XML_SIGN_ADD_KEYVALUE flag cannot be used when the dwKeyInfoSpec parameter is set to CRYPT_XML_KEYINFO_SPEC_ENCODED.

CRYPT_XML_FLAG_DISABLE_EXTENSIONS
0x10000000

Only default implementations for the signature and digest are used. When this flag is set, no other registered extensions are loaded.

 

dwKeyInfoSpec

The type of data structure pointed to by the pvKeyInfoSpec parameter. Here are some possible combinations.

dwKeyInfecpvKeyInfoSpec

CRYPT_XML_KEYINFO_SPEC_NONE

Is set to NULL

CRYPT_XML_KEYINFO_SPEC_ENCODED

Points to a CRYPT_XML_BLOB structure

CRYPT_XML_KEYINFO_SPEC_PARAM

Points to a CRYPT_XML_KEYINFO_PARAM structure

 

pvKeyInfoSpec [in, optional]

A pointer to a structure, the type of which is determined by the value of the dwKeyInfoSpec parameter.

pSignatureMethod [in]

A pointer to a CRYPT_XML_ALGORITHM structure that specifies the signature method.

pCanonicalization [in]

A pointer to a CRYPT_XML_ALGORITHM structure that specifies the canonicalization method.

Return value

If the function succeeds, the function returns zero.

If the function fails, it returns an HRESULT value that indicates the error.

Requirements

Minimum supported client

Windows 7 [desktop apps only]

Minimum supported server

Windows Server 2008 R2 [desktop apps only]

Header

Cryptxml.h

Library

Cryptxml.lib

DLL

Cryptxml.dll

 

 

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.