---
sourceDocument: Xanadu API Reference
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - en-US

ft:publication_title :

    - Xanadu API Reference

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# GlideCertificateEncryption - Global

# GlideCertificateEncryption - Global {#ariaid-title1}

* Release version: Xanadu
* 
* Updated August 1, 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 2 minutes to read

The GlideCertificateEncryption API provides methods for encrypting certificates.

Use these methods to generate a hash for the certificate, sign data using a private key, and
generate a message authentication code.

## GlideCertificateEncryption - GlideCertificateEncryption() {#ariaid-title2}

Instantiates a GlideCertificateEncryption object.
{#r-GCE-GCE__table_e1m_npx_vz__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 1. Parameters]

{#r-GCE-GCE__table_e1m_npx_vz}

### Scoped equivalent {#r-GCE-GCE__section_bmt_1qx_vz}

To use the GlideCertificateEncryption() constructor in a scoped
application, use the corresponding scoped constructor: [CertificateEncryption()](https://servicenow-prod.fluidtopics.net/0pJTkyvfOqvTc2eWhnDfog#r-SCE-CE "Instantiates a CertificateEncryption object in a scoped application.").

## GlideCertificateEncryption - generateMac(String key, String algorithm, String data) {#ariaid-title3}

Generates the Message Authentication Code (MAC), which is used to authenticate a
message.
{#r_GCE-generateMac_S_S_S__table_nm3_gcc_ks__entry__3}

| Name | Type | Description |
|-|-|-|
| key | String | Key to use to sign the message. Must be Base64 encoded. |
| algorithm | String | Algorithm to use to generate the MAC: HmacSHA256, HmacSHA1, HmacMD5, and so on. |
| data | String | Data to process. |
[Table 2. Parameters]

{#r_GCE-generateMac_S_S_S__table_nm3_gcc_ks} {#r_GCE-generateMac_S_S_S__table_om3_gcc_ks__entry__2}

| Type | Description |
|-|-|
| String | MAC in base64 format. |
[Table 3. Returns]

{#r_GCE-generateMac_S_S_S__table_om3_gcc_ks}  

    var mac = new GlideCertificateEncryption;
    var key = "sample_key"; 
    key = GlideStringUtil.base64Encode(key);
    mac.generateMac(key, "HmacSHA256", "sample_data");

### Scoped equivalent {#r_GCE-generateMac_S_S_S__section_bmt_1qx_vz}

To use the generateMac() method in a scoped application, use the
corresponding scoped method: [generateMac()](https://servicenow-prod.fluidtopics.net/0pJTkyvfOqvTc2eWhnDfog#r_SCE-generateMac_S_S_S "Generates the Message Authentication Code (MAC), which is used to authenticate a message.").

## GlideCertificateEncryption - getThumbPrint(String certificateID, String algorithm) {#ariaid-title4}

Generates a hash (SHA-1, SHA-256, and so on) for the certificate from Trust Store
Cert.
{#r_GCE-getThumbPrint_S_S__table_edb_rmv_js__entry__3}

| Name | Type | Description |
|-|-|-|
| certificateID | String | sys_id of the certificate record in the X.509 Certificate \[sys_certificate\] table. |
| algorithm | String | SHA-1, SHA-256, and so on |
[Table 4. Parameters]

{#r_GCE-getThumbPrint_S_S__table_edb_rmv_js} {#r_GCE-getThumbPrint_S_S__table_fdb_rmv_js__entry__2}

| Type | Description |
|-|-|
| String | Thumbprint in base64 format. |
[Table 5. Returns]

{#r_GCE-getThumbPrint_S_S__table_fdb_rmv_js}

### Scoped equivalent {#r_GCE-getThumbPrint_S_S__section_bmt_1qx_vz}

To use the getThumbPrint() method in a scoped application, use the
corresponding scoped method: [getThumbPrint()](https://servicenow-prod.fluidtopics.net/0pJTkyvfOqvTc2eWhnDfog#r_SCE-getThumbPrint_S_S "Generates a hash (SHA-1, SHA-256, and so on) for the certificate from Trust Store Cert.").

## GlideCertificateEncryption - getThumbPrintFromKeystore(String certificateID, String alias,
String algorithm) {#ariaid-title5}

Generates a hash (SHA-1, SHA-256, and so on) for the certificate from the key store
entry.
{#r_GCE-getThumbPrintFromKeyStore_S_S_S__table_edb_rmv_js__entry__3}

| Name | Type | Description |
|-|-|-|
| certificateID | String | sys_id of the certificate record in the X.509 Certificate \[sys_certificate\] table. |
| alias | String | Alias name for the certificate. |
| algorithm | String | SHA-1, SHA-256, and so on. |
[Table 6. Parameters]

{#r_GCE-getThumbPrintFromKeyStore_S_S_S__table_edb_rmv_js} {#r_GCE-getThumbPrintFromKeyStore_S_S_S__table_fdb_rmv_js__entry__2}

| Type | Description |
|-|-|
| String | Thumbprint in base64 format. |
[Table 7. Returns]

{#r_GCE-getThumbPrintFromKeyStore_S_S_S__table_fdb_rmv_js}

### Scoped equivalent {#r_GCE-getThumbPrintFromKeyStore_S_S_S__section_bmt_1qx_vz}

To use the getThumbPrintFromKeystore() method in a scoped application,
use the corresponding scoped method: [getThumbPrintFromKeystore()](https://servicenow-prod.fluidtopics.net/0pJTkyvfOqvTc2eWhnDfog#r_SCE-getThumbPrintFromKeyStore_S_S_S "Generates a hash (SHA-1, SHA-256, and so on) for the certificate from the keystore entry.").

## GlideCertificateEncryption - sign(String certificateID, String alias, String aliaspassword,
String algorithm, String datatosign) {#ariaid-title6}

Signs the data using the private key and the given algorithm.
{#r_GCE-sign_certificateID_S_S_S_S__table_edb_rmv_js__entry__3}

| Name | Type | Description |
|-|-|-|
| certificateID | String | sys_id of the certificate record in the X.509 Certificate \[sys_certificate\] table. |
| alias | String | Private key name. |
| aliaspassword | String | Password for the private key. |
| datatosign | String | Data to sign. |
| algorithm | String | SHA-1, SHA-256, and so on. |
[Table 8. Parameters]

{#r_GCE-sign_certificateID_S_S_S_S__table_edb_rmv_js} {#r_GCE-sign_certificateID_S_S_S_S__table_r3m_jcb_ks__entry__2}

| Type | Description |
|-|-|
| String | Signed data in base64 format. |
[Table 9. Returns]

{#r_GCE-sign_certificateID_S_S_S_S__table_r3m_jcb_ks}  

    var gce = new GlideCertificateEncryption;
    gce.sign("recordID", "alias", "password", "SHA-1", "sign this data");

### Scoped equivalent {#r_GCE-sign_certificateID_S_S_S_S__section_bmt_1qx_vz}

To use the sign() method in a scoped application, use the corresponding
scoped method: [sign()](https://servicenow-prod.fluidtopics.net/0pJTkyvfOqvTc2eWhnDfog#r_SCE-sign_certificateID_S_S_S_S "Signs the data using the private key and the specified algorithm.").

