Skip to main content
1-Visitor
November 26, 2019
Question

Decrypt password in Service

  • November 26, 2019
  • 2 replies
  • 3200 views

Hi guys,

 

I have a password as a property on a thing.  I however need the password to run a service.

 

Where or how do I generate the key required to decrypt the password with the decrypt service in the EncryptionServices resource?

 

var result = Resources["EncryptionServices"].DecryptWithKey({

data: "" /* STRING */,
key: "" /* STRING */
});

2 replies

20-Turquoise
November 26, 2019
1-Visitor
December 2, 2019

Hi @posipova ,

 

Thank you for the response.  

 

I read through the documentation but it appears that is for licence encrypting.  I want to use a user password in a service.  I want to figure out if there is a way to safely decrypt it as an administrator user to be able to use the password in a service.


The decrypt service needs a key which I am not sure how to generate.  Can you perhaps give any suggestions?

18-Opal
December 2, 2019

Hello @AndreaSteyn,

 

When you say "I want to use a user password in a service" you mean you want to use the password of a selected User entity? I'm not sure ThingWorx even stores user passwords, so there's nothing to decrypt, only hashes.

 

/ Constantine

16-Pearl
December 2, 2019

use encrpt/decrypt with custom key.

use 128 bit key

 

****************************


var params1 = {
data: passwd_input /* STRING */,
key: "FEDCBA98765432100123456789ABCDEF" /* STRING */
};

// result: STRING
var result1 = Resources["EncryptionServices"].EncryptWithCustomKey(params1);


var params2 = {
encryptedData: result1 /* STRING */,
key: "FEDCBA98765432100123456789ABCDEF" /* STRING */
};

// result: STRING
var result = Resources["EncryptionServices"].DecryptWithCustomKey(params2);