X509CertStoreBuildChain (FUN)

FUNCTION X509CertStoreBuildChain : RTS_IEC_RESULT

Attempts to create the chain of the specified certificate. The chain is not validated. The purpose of this function is to retrieve the chain in a specific format and then send it via a protocol, for example. All certificates found are merged one after one in a data blob. If the chain could not be created completely, a partial chain is created. If no chain can be created at all, only the specified certificate is copied to pChain. The sequence within the chain is: hCert -> Issuer -> Issuer -> … -> Root.

InOut:

Scope

Name

Type

Comment

Return

X509CertStoreBuildChain

RTS_IEC_RESULT

Result of the operation
  • ERR_OK: The complete chain could be built.

  • ERR_PARAMETER: One of the parameters was invalid.

  • ERR_INVALID_HANDLE: hCertStore or hCert was not a valid handle.

  • ERR_FAILED: Failed to build the chain, or to copy at least one element to pChain.

  • ERR_BUFFERSIZE: pChain has to less memory to store the complete chain. A partial chain is copied to pChain.

  • ERR_CERT_CHAIN_INCOMPLETE: The chain could not be built completely.

Input

hCertStore

RTS_IEC_HANDLE

Handle of to certificate store.

hCert

RTS_IEC_HANDLE

Handle the certificate which chain should be built.

encoding

RtsCertEncoding

Encoding to be used for serialising the certificates.

Inout

chain

RtsByteString

Buffer to store the chain to. If no data pointer is given, just the needed length is returend. No data will be copied.