Click or drag to resize

X509GetCertFromP7Chain Method

Extract an X.509 certificate from a PKCS-7 "certs-only" certificate chain file, saving the output directly as a new file.

Namespace: CryptoSysPKI
Assembly: diCrSysPKINet (in diCrSysPKINet.dll) Version: 23.0.0.30549 (23.1.0.0)
Syntax
public static int GetCertFromP7Chain(
	string outputFile,
	string inputFile,
	int index
)

Parameters

outputFile  String
Name of output file to be created
inputFile  String
Name of the PKCS-7 "certs-only" file, or a string containing its PEM textual representation.
index  Int32
specifying which certificate (1,2,...) in the chain to extract.

Return Value

Int32
If successful and index is greater than zero, it returns the number of bytes written to the output file, which may be zero if no certificate could be found at the given index. If an error occurred, it returns a negative error code.
Remarks
[New in v12.2] To find the number of certificates in the chain, use GetCertCountInP7Chain. The old (deprecated) way to find the count of certificates was to set index to zero.
See Also