How to read encrypted "secret_key" from AWS Credential in script?

David Hubbard
Tera Guru

I am trying to get the encrypted "secret_key" out of an AWS Credential without success.

 

I have tried reading via "GlideRecord" and then using "rec.secret_key.getDecryptedValue()" but this returns the still encrypted value.  This is all in "global" scope at the moment.

 

Is there any setup required like:

- Cryptographic Modules - I see a "com_glide_record_glideencrypter" which is "Published"

- Module Access Policy - there isn't one linked to that module - nor can I create one - shows "invalid reference"

 

What am I missing?

 

Plus - I have tried to use "sn_credential.CredentialsAccessor" as flagged in this forum post.  However I am getting '"sn_credential" is not defined.'  As per my reply in that thread - I am unclear if:

a) this is an installable plugin - no reference in Application Manager

b) if it handles AWS Credential.

 

I have my script running using "password 2" System property - which does return a decrypted value - but would prefer to use the "AWS Credential" approach.

 

Thanks

David 

 

1 ACCEPTED SOLUTION

David Hubbard
Tera Guru

I have found that using "sn_cc.StandardCredentialsProvider" works for this.

 

var provider = new sn_cc.StandardCredentialsProvider();
var credential = provider.getCredentialByID(credrec.sys_id);
var secret_key = credential.getAttribute("secret_key");

gs.info('Secret Key ['+secret_key+']');

 

The documentation for this is here.

View solution in original post

1 REPLY 1

David Hubbard
Tera Guru

I have found that using "sn_cc.StandardCredentialsProvider" works for this.

 

var provider = new sn_cc.StandardCredentialsProvider();
var credential = provider.getCredentialByID(credrec.sys_id);
var secret_key = credential.getAttribute("secret_key");

gs.info('Secret Key ['+secret_key+']');

 

The documentation for this is here.