---
sourceDocument: Référence API Brésil
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/fr-FR/api-reference

 Release :

    - brazil

ft:locale :

    - fr-FR

ft:publication_title :

    - Référence API Brésil

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# Chiffrement du certificat : délimité

# Chiffrement du certificat : délimité {#ariaid-title1}

Rversion finale: Brazil  
Mis à jour 10 sept. 2026  
![](https://www.servicenow.com/docs/portal-asset/ico-clock) 2 minutes de lecture  
L'API CertificateEncryption fournit des méthodes de chiffrement des certificats dans les applications incluses dans le périmètre.

Utilisez ces méthodes pour générer un hachage pour le certificat, signer des données à l'aide d'une clé privée et générer un code d'authentification de message.

## CertificateEncryption : CertificateEncryption() {#ariaid-title2}

Instancie un objet CertificateEncryption dans une application incluse dans le périmètre.
{#r-SCE-CE__table_e1m_npx_vz__entry__3}

| Nom | Type | Description |
|-|-|-|
| Aucune |   |   |
[Tableau 1. Paramètres]

{#r-SCE-CE__table_e1m_npx_vz}

## CertificateEncryption : generateMac (clé de chaîne, algorithme de chaîne, données de chaîne) {#ariaid-title3}

Génère le code d'authentification de message (MAC), qui est utilisé pour authentifier un message.
{#r_SCE-generateMac_S_S_S__table_nm3_gcc_ks__entry__3}

| Nom | Type | Description |
|-|-|-|
| key | Chaîne | Clé à utiliser pour signer le message. Doit être codé Base64. |
| algorithme | Chaîne | Algorithme à utiliser pour générer le MAC : HmacSHA256, HmacSHA1, HmacMD5, etc. |
| Données | Chaîne | Données à traiter. |
[Tableau 2. Paramètres]

{#r_SCE-generateMac_S_S_S__table_nm3_gcc_ks} {#r_SCE-generateMac_S_S_S__table_om3_gcc_ks__entry__2}

| Type | Description |
|-|-|
| Chaîne | MAC au format base64. |
[Tableau 3. Renvoie]

{#r_SCE-generateMac_S_S_S__table_om3_gcc_ks}  
Cet exemple montre comment utiliser un MAC en utilisant sample_key comme données et HmacSHA256 comme algorithme.

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

## Chiffrement du certificat : getThumbPrint(String certificateID, String algorithm) {#ariaid-title4}

Génère un hachage (SHA-1, SHA-256, et ainsi de suite) pour le certificat à partir du certificat de magasin de confiance.
{#r_SCE-getThumbPrint_S_S__table_edb_rmv_js__entry__3}

| Nom | Type | Description |
|-|-|-|
| ID certificat | Chaîne | Sys_id de l'enregistrement de certificat dans la table Certificat X.509 \[sys_certificate\]. |
| algorithme | Chaîne | Algorithme à utiliser pour créer le hachage, tel que SHA-1, SHA-256, etc. |
[Tableau 4. Paramètres]

{#r_SCE-getThumbPrint_S_S__table_edb_rmv_js} {#r_SCE-getThumbPrint_S_S__table_fdb_rmv_js__entry__2}

| Type | Description |
|-|-|
| Chaîne | Empreinte digitale au format base64. |
[Tableau 5. Renvoie]

{#r_SCE-getThumbPrint_S_S__table_fdb_rmv_js}  
Cet exemple montre comment générer l'empreinte (hachage) du certificat AzureAAD.

    //Create a GlideRecord to the certificate table
    var x509GR = new GlideRecord('sys_certificate');

    //If there is a certificate of a name of AzureAAD, get the certificate thumbprint
    if(x509GR.get('name', 'AzureAAD')){

    //Use the sys_id and algorithm we want to create a thumbprint
    var thumbPrint = CertificateEncryption.getThumbPrint(x509GR.getUniqueValue(), "SHA-1");

    //Print the created thumbprint
    gs.print("Thumbprint for " + x509GR.getDisplayValue() + " is " + thumbPrint);
    }

Sortie :

    V1X+aguDBTZVVbWMGTXxdzJLmaY=

## Chiffrement du certificat : getThumbPrintFromKeyStore(ID de certificat de chaîne, alias de chaîne, algorithme de chaîne) {#ariaid-title5}

Génère un hachage (SHA-1, SHA-256, etc.) pour le certificat à partir de l'entrée du magasin de clés.
{#r_SCE-getThumbPrintFromKeyStore_S_S_S__table_edb_rmv_js__entry__3}

| Nom | Type | Description |
|-|-|-|
| ID certificat | Chaîne | Sys_id de l'enregistrement de certificat dans la table Certificat X.509 \[sys_certificate\]. |
| alias | Chaîne | Nom d'alias du certificat. |
| algorithme | Chaîne | Algorithme à utiliser pour créer le hachage, tel que SHA-1, SHA-256, etc. |
[Tableau 6. Paramètres]

{#r_SCE-getThumbPrintFromKeyStore_S_S_S__table_edb_rmv_js} {#r_SCE-getThumbPrintFromKeyStore_S_S_S__table_fdb_rmv_js__entry__2}

| Type | Description |
|-|-|
| Chaîne | Empreinte digitale au format base64. |
[Tableau 7. Renvoie]

{#r_SCE-getThumbPrintFromKeyStore_S_S_S__table_fdb_rmv_js}

## CertificateEncryption : sign(Chaîne certificateID, String alias, String aliaspassword, String algorithm, String datatosign) {#ariaid-title6}

Signe les données à l'aide de la clé privée et de l'algorithme spécifié.
{#r_SCE-sign_certificateID_S_S_S_S__table_edb_rmv_js__entry__3}

| Nom | Type | Description |
|-|-|-|
| ID certificat | Chaîne | sys_id de l'enregistrement de certificat dans la table Certificat X.509 \[sys_certificate\]. |
| alias | Chaîne | Nom de clé privée. |
| aliasmot de passe | Chaîne | Mot de passe de la clé privée. |
| algorithme | Chaîne | Algorithme à utiliser. Doit être l'une des valeurs suivantes : * NONEwithRSA * MD2withRSA * MD5withRSA * SHA1withRSA * SHA224withRSA * SHA256withRSA * SHA384withRSA * SHA512withRSA * AUCUNavecDSA * SHA1withDSA * SHA224withDSA * SHA256withDSA * AUCUNavecECDSA * SHA1withECDSA * SHA224withECDSA * SHA256withECDSA * SHA384withECDSA * SHA512avecECDSA {#r_SCE-sign_certificateID_S_S_S_S__ul_pr3_nvv_pkb} |
| DataToSign | Chaîne | Données à signer. |
[Tableau 8. Paramètres]

{#r_SCE-sign_certificateID_S_S_S_S__table_edb_rmv_js} {#r_SCE-sign_certificateID_S_S_S_S__table_r3m_jcb_ks__entry__2}

| Type | Description |
|-|-|
| Chaîne | Données signées au format base64. |
[Tableau 9. Renvoie]

{#r_SCE-sign_certificateID_S_S_S_S__table_r3m_jcb_ks}  

    var ce = new CertificateEncryption;
    ce.sign("recordID", "alias", "password", "SHA1withRSA", "sign this data");


