Join us Dec. 16 for The Community Hour, our first global virtual User Group event!

Help Needed : GlideEncrypter API Deprecated & not permitted beginning with the Xanadu release

ukti
Tera Contributor

Hi All,

 

We are using GlideEncrypter API to Generate Password . 

As per the KB article mentioned by ServiceNow, it says all about how to use alternatives for password2 field.

I wanted to update my script include with proper alternatives . Can somebody please help me how can i use alternative of GlideEncrypter api to generate password.

 

 

var Generate_password = Class.create();
Generate_password.prototype = {
    initialize: function() {
        
    },

    //var password='';
	encrypt : function(){
		var password = this._randomString(12, '0123456789abcdefghijlkmnopqrstuvwxyzABCDEFGHIJLKMNOPQRSTUVWXYZ@!&*#?');
		return password;
	},
    _randomString: function(length, chars) {
        var result = '';
        for (var i = length; i > 0; --i) result += chars[Math.floor(Math.random() * chars.length)];
        var encpwd = new GlideEncrypter();
        var encpwd2 = encpwd.encrypt(result);
		var decryptpwd = encpwd.decrypt(encpwd2);
        return encpwd2+":"+decryptpwd;
    },

	
    type: 'Generate_password'
};

 

 

 

 

4 REPLIES 4

Mark Manders
Tera Patron

This KB article talks about only setting the value to the password2 field but not how to use it to generate password.

Mark Roethof
Tera Patron

Hello,

 

Perhaps this helps:

- 2024-01-15 - Article - GlideEncrypter API not permitted beginning with the Xanadu release

And good to know, not Xanadu anymore:

GlydeEncrypter.png

Priyank Joshi
Tera Contributor

Please look at OOB Script Include ScopedEncrypter as an example it is using Key Management Framework as mentioned in KB Article https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB1320986

 

1. You can either use OOB ScopedEncrypter or

2. Create new Script Include and create a new KMF module.

 

Hope this helps.