Official Content

This is part of GeneXus Cryptography Module. and allows to manage a PublicKey, for asymmetric Encryption.

PublicKey

This data type is available since GeneXus 18 Upgrade 4

Valid key formats

  • Encoded Base64 key PKCS8 formatted (.pem extension). It can contain a public key, private key, certificate or both.  
    • Encrypted .pem files are not admitted.
    • Encrypted PKCS8 private keys are admitted since GeneXus 17 Upgrade 2
    • Files with .key extensions are supported since GeneXus 16 Upgrade 11
  • PKCS12 certificate or keystore (.p12 or .pfx or .jks extension). It contains only private keys or both.
    • JKS format (JavaKeyStore) is available only for Java implementation.
    • For PKCS12 certificates the file password is needed for both Java and .Net implementations.
    • .Net implementation does not use the PKCS12 alias; it takes the public key from the first certificate on the certificate chain and the first default private key listed on the file.
    • Files with .pkcs12 extensions are supported since GeneXus 16 Upgrade 11
  • Every certificate must implement the X509 standard.
  • Public keys outside certificates are admitted in PKCS8 format. Supported since GeneXus 18 Upgrade 4

Load

PublicKey.Load(path)
  • Input path: VarChar(256) path of the public key file
  • Returns: Boolean true if it is correctly loaded

Loads a public key.

ToBase64

PublicKey.ToBase64()
  • Returns: Varchar(256) base64 en BER/DER encoded public key

Returns the BER/DER encoded base64 preloaded public key.

FromBase64

PublicKey.FromBase64(base64)
  • Input base64: VarChar(256) base64 BER/DER encoded public key
  • Returns: Boolean true if it is correctly loaded

Loads a BER/DER encoded base64 public key




Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant