How to modify Glideencrypter API methods ?

SIVASANKARA
Tera Contributor

Hai I am using the run script for reset AD password through workflow but in script we are used the  GlideEncrypter  but servicenow The GlideEncrypter API is planned for deprecation so how to modify that script

 

script:

//Generate Random Password and Set AD password.

               var encr= new GlideEncrypter();

                var clearString = new PwdCryptoSecureAutoGenPassword().generatePassword();

                var encrString = encr.encrypt(clearString);  //Encrypted password for use in the Set AD Password Activity.

               

                workflow.scratchpad.pass = encrString;  //Set scratchpad password variable to the encrypted password string.

                var decrString = workflow.scratchpad.clearpass = encr.decrypt(encrString);  //Can be used as the clear text password

4 REPLIES 4

Jeenet1
Tera Contributor

@SIVASANKARA Did you find any solutions that work?

Hi @Jeenet1  No 

Hi @SIVASANKARA ,

 

We tried using OOTB script include (PasswordResetUtil) and it seems working.


Our old code:

var encr = new GlideEncrypter();
var clearString = new ADPwdCryptoSecureAutoGenPassword().generatePassword()+"1D";
var encrString = encr.encrypt(clearString);
workflow.scratchpad.password = encrString;
var decrString = workflow.scratchpad.clearpass = encr.decrypt(encrString);

 

Updated code:

var encr = new PasswordResetUtil();
var clearString = new ADPwdCryptoSecureAutoGenPassword().generatePassword()+"1D";
var encrString = encr .encryptWithKMFModule(clearString);
workflow.scratchpad.password = encrString;
var decrString = workflow.scratchpad.clearpass =encr.decryptWithKMFModule(encrString);

siva44
Tera Contributor

Hi @Jeenet1  Thank u for update We also using Same OOB function