CryptoExportRawAsymmetricKey (FUN)

FUNCTION CryptoExportRawAsymmetricKey : RTS_IEC_RESULT

Exports the public key of a key pair in raw format. This means that no additional data like ASN.1 or BASE64 encoding is generated. Not all key pairs will support this.

InOut:

Scope

Name

Type

Comment

Return

CryptoExportRawAsymmetricKey

RTS_IEC_RESULT

Operation Result:
  • ERR_OK: PUBLIC key was exported.

  • ERR_INVALID_STATE: The component is not in a valid state to do this operation.

  • ERR_PARAMETER: The key or the pKeyData was not valid.

  • ERR_NOT_SUPPORTED: The given key does not support raw export.

  • ERR_SIZE_MISMATCH: The given bytestring is too small.

Input

key

RtsCryptoKey

The key pair or public key to export in raw format.

xPrivateKey

BOOL

TRUE: Export the private key. FALSE: Export the public key.

pKeyData

POINTER TO RtsByteString

The bytestring to store the raw encoded key. If the bytestring is empty (pByData == NULL, ui32MaxLen > 0, ui32Len == 0) the needed size will be returned.