Page 1 of 1

Load User Private Key

Posted: 28 Apr 2021, 10:22
by CarelC
Hi,

I am trying to load the certificate and private key file for "CertificateUserIdentity" for a Client connection.

I could not find any information in the documentation on how to do this, thus searching the forum I got the following two related posts:
  • https://forum.unified-automation.com/topic323.html using

    Code: Select all

    UaPkiRsaKeyPair::fromPEMFile(sFileName, szPassword, ...)
  • https://forum.unified-automation.com/topic3311.html using

    Code: Select all

    UaPkiProviderOpenSSL::loadPrivateKey(sPrivateKeyName, fileFormat, sPassword, ...)
Both seems to work, which one is the better one to use and when would one use the other?

Regards,

Re: Load User Private Key

Posted: 21 May 2021, 12:27
by Support Team
Hi,

actually both alternatives work fine. The main difference is:

UaPkiProvider::loadPrivateKey() can load different key formats / encodings (PEM, PKCS12).

UaPkiRsaKeyPair::fromPEMFile can only load PEM format / encoding.