Creates a new instance of the Certificate class by opening a PFX file and retrieving the first certificate from it.
Namespace: LLCryptoLib.Security.CertificatesAssembly: LLCryptoLib (in LLCryptoLib.dll) Version: 2.0.1024.0 (2.0.1024)
Syntax
C# |
---|
public static Certificate CreateFromPfxFile( byte[] file, string password ) |
Visual Basic |
---|
Public Shared Function CreateFromPfxFile ( _ file As Byte(), _ password As String _ ) As Certificate |
Visual C++ |
---|
public: static Certificate^ CreateFromPfxFile( array<unsigned char>^ file, String^ password ) |
Parameters
- file
- Type: array<System..::..Byte>[]()[][]
The contents of a PFX file.
- password
- Type: System..::..String
The password used to encrypt the private key.
Return Value
One of the certificates in the PFX file.
Remarks
Warning: this method returns the first Certificate it can find in the specified PFX file.
Care should be taken to verify whether the correct Certificate instance is returned
when using PFX files that contain more than one certificate.
For more fine-grained control over which certificate is returned, use
the CertificateStore.CreateFromPfxFile method to instantiate a CertificateStore object
and then use the CertificateStore.FindCertificateBy*** methods.
Exceptions
Exception | Condition |
---|---|
System..::..ArgumentNullException | file or password is a null reference (Nothing in Visual Basic). |
LLCryptoLib.Security.Certificates..::..CertificateException | An error occurs while loading certificates from the specified bytes. |
System..::..ArgumentException | password is invalid. |