Load User Private Key

Questions regarding the use of the C++ SDK for Server or Client development or integration into customer products ...

Moderator: uasdkcpp

Post Reply
CarelC
Jr. Member
Jr. Member
Posts: 3
Joined: 08 Apr 2021, 13:45

Load User Private Key

Post 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,

User avatar
Support Team
Hero Member
Hero Member
Posts: 2649
Joined: 18 Mar 2011, 15:09

Re: Load User Private Key

Post 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.
Best regards
Unified Automation Support Team

Post Reply