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
Mega Patron

Everything you need is in here: https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB1320986

 


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

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
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

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

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.