goody_f9 Absent Member.
Absent Member.
32249 views

How to decode encrypted password

Jump to solution

Is there any method or function to decode password .
Like for logging in to Database we need to set username and password which should be encrypted .
I'm not talking about setsecure method is there anyother way to decode password

 

 

P.S. This thread has been moved from ALM > Quality Center Support and News  Forum to Unified Functional Testing (formerly QTP) News and Support forum - HP Forums Moderator

Tags (2)
0 Likes
1 Solution

Accepted Solutions
Knowledge Partner
Knowledge Partner

Re: How to decode encrypted password

Jump to solution
We use our own encoder/decoder written in a VBScript function.

This function is encrypted for security reasons.


Mark Smith.
10 Replies
Absent Member.. shiv_p Absent Member..
Absent Member..

Re: How to decode encrypted password

Jump to solution
I don't think so.

You have to use Crypt.Encrypt(Data) and then setseure(data)

Knowledge Partner
Knowledge Partner

Re: How to decode encrypted password

Jump to solution
We use our own encoder/decoder written in a VBScript function.

This function is encrypted for security reasons.


Mark Smith.
goody_f9 Absent Member.
Absent Member.

Re: How to decode encrypted password

Jump to solution
Ohh then I might not even get any Sample function for Encryption and decryption ,becos of security reasons no one might provide those functions 😞 ...
Is there any other way to proceed ??
0 Likes
Cody Marcel Absent Member.
Absent Member.

Re: How to decode encrypted password

Jump to solution
Sperk, you should be aware that if the encryption you are using requires that the algorithm itself be private, then it its output is not secure. Granted, its better than nothing.

This is an implementation of RC4 encryption. It is considered secure and it what is used in in SSL and other encryption schemes. It is symmetric. That means the same routine can be used to both encrypt and decrypt. I stole the basic implementation from the web, but I don't remember where I got it form. It was some time ago.

seed = "password you put in script"
pw = "passwordyou want to protect"
encr = EnDeCrypt(seed, pw)
print "Encrypted text: " & encr

myFunc = EnDeCrypt(encr, pw)
print "Decrypted text: " & myFunc


Dim sbox(255)
Dim key(255)


Sub RC4Initialize(strPwd)
':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
'::: This routine called by EnDeCrypt function. Initializes the :::
'::: sbox and the key array) :::
':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

dim tempSwap
dim a
dim b

intLength = len(strPwd)
For a = 0 To 255
key(a) = asc(mid(strpwd, (a mod intLength)+1, 1))
sbox(a) = a
next

b = 0
For a = 0 To 255
b = (b + sbox(a) + key(a)) Mod 256
tempSwap = sbox(a)
sbox(a) = sbox(b)
sbox(b) = tempSwap
Next

End Sub

Function EnDeCrypt(plaintxt, psw)
':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
'::: This routine does all the work. Call it both to ENcrypt :::
'::: and to DEcrypt your data. :::
':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

dim temp
dim a
dim i
dim j
dim k
dim cipherby
dim cipher

i = 0
j = 0

RC4Initialize psw

For a = 1 To Len(plaintxt)
i = (i + 1) Mod 256
j = (j + sbox(i)) Mod 256
temp = sbox(i)
sbox(i) = sbox(j)
sbox(j) = temp

k = sbox((sbox(i) + sbox(j)) Mod 256)

cipherby = Asc(Mid(plaintxt, a, 1)) Xor k
cipher = cipher & Chr(cipherby)
Next

EnDeCrypt = cipher

End Function



Knowledge Partner
Knowledge Partner

Re: How to decode encrypted password

Jump to solution

Sperk, you should be aware that if the encryption you are using requires that the algorithm itself be private, then it its output is not secure. Granted, its better than nothing.


Its just a small safeguard Cody, it doesn't need to be watertight. I suppose we could obfuscate all the VBScript but I'm not sure we need to go that far.

To access the DB a person needs to logon to a Citrix box which is the site security. We just wanted something to makesure no one executed any of our VBScripts by mistake/accident.


Thanks for the heads-up Cody.

Mark.
goody_f9 Absent Member.
Absent Member.

Re: How to decode encrypted password

Jump to solution
Thanks cody you're always der for me to rescue 🙂 ..I'll try to execute the function and let you know if its working
0 Likes
qaexpert
Visitor.

Re: How to decode encrypted password

Jump to solution

'seed = "password you put in script"
'pw = "passwordyou want to protect"

 

seed = "abc123"
pw = "test123"

 

encr = EnDeCrypt(seed, pw)
print "Encrypted text: " & encr

myFunc = EnDeCrypt(encr, pw)
print "Decrypted text: " & myFunc

 

Browser("Login").Page("Login").WebEdit("UserName").Set "<UserName>"
Browser("Login").Page("Login").WebEdit("Password").SetSecure encr
Browser("Login").Page("Login").WebButton("Login").Click

 

Output:

 

Encrypted text: y¿á Àg
Decrypted text: abc123

 

Actual password is test123 and i am using encer to login to the application and it is not working.

 

 

Any suggestion and help way i am doing?

 

 

Tags (1)
0 Likes
Highlighted
Absent Member.. Trudy Claspill Absent Member..
Absent Member..

Re: How to decode encrypted password

Jump to solution
@qaexpert

Given the age of the original post, and the fact that posts marked "Solved" are often ignored, I suggest you repost your question on the QTP-specific forum. You will be more likely to get help there.
http://h30499.www3.hp.com/t5/Unified-Functional-Te​sting/bd-p/sws-Fun_TEST_SF
[If this post solves or helps solve your issue, mark the thread as solved and give KUDOS to the author for their assistance.]

(Opinions expressed in my postings are mine alone, and do not reflect the opinions of my employer.No warranties express or implied for any solution/suggestion posted.)
qaexpert
Visitor.

Re: How to decode encrypted password

Jump to solution

I am able to make this work now. Thanks.

0 Likes
Super Contributor.. Michaeldx Super Contributor..
Super Contributor..

Re: How to decode encrypted password

Jump to solution

You could also check out the method in this post http://eyeontesting.com/questions/10797/decrypt-password-at-run-time-in-uft.html

This shows that the encrypted password is not a secure method but as someone else mentioned, it is better than nothing.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.