{"id":10,"date":"2011-09-05T03:29:00","date_gmt":"2011-09-05T03:29:00","guid":{"rendered":"http:\/\/www.automationrepository.com\/?p=10"},"modified":"2012-02-05T16:40:27","modified_gmt":"2012-02-05T11:10:27","slug":"how-to-decrypt-an-encrypted-password-in-qtp","status":"publish","type":"post","link":"https:\/\/www.automationrepository.com\/wordpress\/2011\/09\/how-to-decrypt-an-encrypted-password-in-qtp\/","title":{"rendered":"How to Decrypt an Encrypted Password in QTP"},"content":{"rendered":"<div style=\"text-align: justify; font-family: Verdana,sans-serif;\">\n<p>To encode or encrypt a password, QTP provides <strong>Encrypt<\/strong> method and <strong>Password Encoder<\/strong> tool. But what happens when a user wants to find out the decrypted (original) value of an encrypted password? QTP doesn&#8217;t provide a direct way to obtain the decrypted\/decoded password.<br \/>\n<!--more--><br \/>\nThe only method available is the <span style=\"color: #000080;\"><strong>SetSecure<\/strong><\/span> method which internally decrypts the value and sets it in the password fields.<br \/>\n<em> <\/em><br \/>\n<em><strong>The trick here is to use SetSecure method to decrypt the password but instead of entering the decrypted value in a password field (which displays text as ***), we will enter the value in a normal text field (which will display the text to the user in readable format).<\/strong><\/em> Lets see how this can be done.<br \/>\n<span><br \/>\n<\/span><\/p>\n<h3><span style=\"color: #000080;\">Our Approach to Decrypt Password (In Brief)<\/span><\/h3>\n<p><span style=\"color: #0000ff;\">a) Encrypt a password.<\/span><br \/>\n<span style=\"color: #0000ff;\">b) Create a VBScript InputBox.<\/span><br \/>\n<span style=\"color: #0000ff;\">c) Use the SetSecure method to write the decrypted value in the text field inside the InputBox<\/span><br \/>\n<span><br \/>\n<\/span><\/p>\n<h3><span style=\"color: #000080;\">Detailed Steps to Decrypt Password<\/span><\/h3>\n<p>a) Let&#8217;s take an original password first (say &#8211; <strong>qwerty<\/strong>). When we encrypt this password using Password Encoder tool in QTP, we get <strong>4e63eb23edd909f721d59eaa98fecb6d82a7 <\/strong>as the decrypted password (see below pic). Our aim is to use the decrypted password and obtain back the original password.<\/p>\n<table class=\"tr-caption-container\" style=\"margin-left: auto; margin-right: auto; text-align: center;\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">\n<tbody>\n<tr>\n<td style=\"text-align: center;\"><a style=\"margin-left: auto; margin-right: auto;\" href=\"http:\/\/2.bp.blogspot.com\/-ATU0r3ulGAI\/TmPrwNIu4KI\/AAAAAAAAAFA\/r9rNfUZjQPs\/s1600\/PasswordEncoder.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/2.bp.blogspot.com\/-ATU0r3ulGAI\/TmPrwNIu4KI\/AAAAAAAAAFA\/r9rNfUZjQPs\/s320\/PasswordEncoder.jpg\" alt=\"\" width=\"320\" height=\"177\" border=\"0\" \/><\/a><\/td>\n<\/tr>\n<tr>\n<td class=\"tr-caption\" style=\"text-align: center;\">Encrypted String for Password &#8211; qwerty<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><em> <\/em><br \/>\nb) Now the next step is to create an InputBox. To do this, write the following text in a notepad &#8211;<br \/>\n<strong>InputBox &#8220;The text box below displays the Decrypted Password&#8221;, &#8220;Decrypt Password&#8221;<\/strong><\/p>\n<p>Save the notepad as .vbs file in the local\u00a0 disk (In this example, we are saving the notepad as &#8216;DecryptPwd.vbs&#8217; in &#8216;D:&#8217; drive). If we execute the &#8216;DecryptPwd.vbs&#8217; file, it would display the InputBox as shown below.<\/p>\n<table class=\"tr-caption-container\" style=\"margin-left: auto; margin-right: auto; text-align: center;\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">\n<tbody>\n<tr>\n<td style=\"text-align: center;\"><a style=\"margin-left: auto; margin-right: auto;\" href=\"http:\/\/2.bp.blogspot.com\/-7gmjmIlz6e8\/TmPuiZx9o3I\/AAAAAAAAAFE\/dIg5sNynD00\/s1600\/DecryptPassword.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/2.bp.blogspot.com\/-7gmjmIlz6e8\/TmPuiZx9o3I\/AAAAAAAAAFE\/dIg5sNynD00\/s320\/DecryptPassword.jpg\" alt=\"\" width=\"320\" height=\"141\" border=\"0\" \/><\/a><\/td>\n<\/tr>\n<tr>\n<td class=\"tr-caption\" style=\"text-align: center;\">InputBox to display the Decrypted (original) Password<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div style=\"font-family: Verdana,sans-serif;\"><em> <\/em><br \/>\nc)\u00a0 The final step is to use SetSecure method to display the original password in the InputBox. For this write the following code in QTP.<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\n'Execute the .vbs code to display the InputBox\r\nSystemUtil.Run \u201cD:DecryptPwd.vbs\u201d\r\n\r\n'Type the decrypted password in WinEdit field of InputBox\r\nDialog(&quot;nativeclass:=#32770&quot;,&quot;text:=Decrypt Password&quot;).WinEdit(&quot;nativeclass:=Edit&quot;).SetSecure &quot;4e63eb23edd909f721d59eaa98fecb6d82a7&quot;\r\n<\/pre>\n<p><em>When you execute this code, the InputBox gets opened and the SetSecure method enters the original decrypted password in the InputBox as displayed in the figure below. Now you can note down this decrypted password and use it wherever required.<\/em><\/p>\n<table class=\"tr-caption-container\" style=\"margin-left: auto; margin-right: auto; text-align: center;\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">\n<tbody>\n<tr>\n<td style=\"text-align: center;\"><a style=\"margin-left: auto; margin-right: auto;\" href=\"http:\/\/3.bp.blogspot.com\/-Vohe8tk-S3o\/TmPx1FyISaI\/AAAAAAAAAFI\/rs4_uklW6es\/s1600\/DecryptPassword+%255B1%255D.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/3.bp.blogspot.com\/-Vohe8tk-S3o\/TmPx1FyISaI\/AAAAAAAAAFI\/rs4_uklW6es\/s320\/DecryptPassword+%255B1%255D.jpg\" alt=\"\" width=\"320\" height=\"141\" border=\"0\" \/><\/a><\/td>\n<\/tr>\n<tr>\n<td class=\"tr-caption\" style=\"text-align: center;\">The InputBox displays the original password &#8211; <strong>qwerty<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong><span style=\"text-decoration: underline;\">Note:<\/span><\/strong> It is not necessary that the user uses VBScript InputBox to display the decrypted password. The logic van be written for any application where a text field is available.<\/p>\n<\/div>\n<div style=\"font-family: Verdana,sans-serif; border: 1px solid #c8b560; padding: 3mm; background: none repeat scroll 0% 0% #fff8c6; text-align: center;\">\n<p><strong>If you enjoyed this article, you can join our blog to get new articles delivered directly in your inbox.<\/strong><\/p>\n<form style=\"text-align: center;\" action=\"http:\/\/feedburner.google.com\/fb\/a\/mailverify\" method=\"post\" onsubmit=\"window.open('http:\/\/feedburner.google.com\/fb\/a\/mailverify?uri=automationrepository\/feeds', 'popupwindow', 'scrollbars=yes,width=550,height=520');return true\" target=\"popupwindow\"><input style=\"width: 160px; height: 24px;\" onfocus=\"if (this.value == 'Enter Your Email Address') {this.value = '';}\" onblur=\"if (this.value == '') {this.value = 'Enter Your Email Address';}\" type=\"text\" value=\"Enter Your Email Address\" \/> <input type=\"hidden\" name=\"uri\" value=\"automationrepository\/feeds\" \/> <input type=\"hidden\" name=\"loc\" value=\"en_US\" \/> <input type=\"submit\" value=\"Subscribe\" \/><\/p>\n<p style=\"text-align: justify;\">\n<\/form>\n<\/div>\n<p style=\"border: 1px solid #c38ec7; padding: 3mm; background: none repeat scroll 0% 0% #ebdde2;\"><strong>You can also visit <a title=\"Automation Repository\" href=\"http:\/\/automationrepository.com\/\">Automation Repository Home Page<\/a> or the <a title=\"All Articles\" href=\"http:\/\/automationrepository.com\/archive\/\">Archives Page<\/a> to view the other articles.<\/strong><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>To encode or encrypt a password, QTP provides Encrypt method and Password Encoder tool. But what happens when a user wants to find out the decrypted (original) value of an encrypted password? QTP doesn&#8217;t provide a direct way to obtain the decrypted\/decoded password.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[7,8],"class_list":["post-10","post","type-post","status-publish","format-standard","hentry","category-not-so-common-stuff","tag-decrypt-password","tag-setsecure"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Decrypt an Encrypted Password in QTP - XX<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.automationrepository.com\/wordpress\/2011\/09\/how-to-decrypt-an-encrypted-password-in-qtp\/\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Anish Pillai\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.automationrepository.com\/wordpress\/2011\/09\/how-to-decrypt-an-encrypted-password-in-qtp\/\",\"url\":\"https:\/\/www.automationrepository.com\/wordpress\/2011\/09\/how-to-decrypt-an-encrypted-password-in-qtp\/\",\"name\":\"How to Decrypt an Encrypted Password in QTP - XX\",\"isPartOf\":{\"@id\":\"https:\/\/www.automationrepository.com\/wordpress\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.automationrepository.com\/wordpress\/2011\/09\/how-to-decrypt-an-encrypted-password-in-qtp\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.automationrepository.com\/wordpress\/2011\/09\/how-to-decrypt-an-encrypted-password-in-qtp\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/2.bp.blogspot.com\/-ATU0r3ulGAI\/TmPrwNIu4KI\/AAAAAAAAAFA\/r9rNfUZjQPs\/s320\/PasswordEncoder.jpg\",\"datePublished\":\"2011-09-05T03:29:00+00:00\",\"dateModified\":\"2012-02-05T11:10:27+00:00\",\"author\":{\"@id\":\"https:\/\/www.automationrepository.com\/wordpress\/#\/schema\/person\/9fb56e00b93c7e939604cdfb05d62078\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.automationrepository.com\/wordpress\/2011\/09\/how-to-decrypt-an-encrypted-password-in-qtp\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.automationrepository.com\/wordpress\/2011\/09\/how-to-decrypt-an-encrypted-password-in-qtp\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.automationrepository.com\/wordpress\/2011\/09\/how-to-decrypt-an-encrypted-password-in-qtp\/#primaryimage\",\"url\":\"http:\/\/2.bp.blogspot.com\/-ATU0r3ulGAI\/TmPrwNIu4KI\/AAAAAAAAAFA\/r9rNfUZjQPs\/s320\/PasswordEncoder.jpg\",\"contentUrl\":\"http:\/\/2.bp.blogspot.com\/-ATU0r3ulGAI\/TmPrwNIu4KI\/AAAAAAAAAFA\/r9rNfUZjQPs\/s320\/PasswordEncoder.jpg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.automationrepository.com\/wordpress\/2011\/09\/how-to-decrypt-an-encrypted-password-in-qtp\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.automationrepository.com\/wordpress\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Decrypt an Encrypted Password in QTP\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.automationrepository.com\/wordpress\/#website\",\"url\":\"https:\/\/www.automationrepository.com\/wordpress\/\",\"name\":\"XX\",\"description\":\"\\r\\nasas\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.automationrepository.com\/wordpress\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.automationrepository.com\/wordpress\/#\/schema\/person\/9fb56e00b93c7e939604cdfb05d62078\",\"name\":\"Anish Pillai\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.automationrepository.com\/wordpress\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g\",\"caption\":\"Anish Pillai\"},\"url\":\"https:\/\/www.automationrepository.com\/wordpress\/author\/anish-pillai\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Decrypt an Encrypted Password in QTP - XX","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.automationrepository.com\/wordpress\/2011\/09\/how-to-decrypt-an-encrypted-password-in-qtp\/","twitter_misc":{"Written by":"Anish Pillai","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.automationrepository.com\/wordpress\/2011\/09\/how-to-decrypt-an-encrypted-password-in-qtp\/","url":"https:\/\/www.automationrepository.com\/wordpress\/2011\/09\/how-to-decrypt-an-encrypted-password-in-qtp\/","name":"How to Decrypt an Encrypted Password in QTP - XX","isPartOf":{"@id":"https:\/\/www.automationrepository.com\/wordpress\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.automationrepository.com\/wordpress\/2011\/09\/how-to-decrypt-an-encrypted-password-in-qtp\/#primaryimage"},"image":{"@id":"https:\/\/www.automationrepository.com\/wordpress\/2011\/09\/how-to-decrypt-an-encrypted-password-in-qtp\/#primaryimage"},"thumbnailUrl":"http:\/\/2.bp.blogspot.com\/-ATU0r3ulGAI\/TmPrwNIu4KI\/AAAAAAAAAFA\/r9rNfUZjQPs\/s320\/PasswordEncoder.jpg","datePublished":"2011-09-05T03:29:00+00:00","dateModified":"2012-02-05T11:10:27+00:00","author":{"@id":"https:\/\/www.automationrepository.com\/wordpress\/#\/schema\/person\/9fb56e00b93c7e939604cdfb05d62078"},"breadcrumb":{"@id":"https:\/\/www.automationrepository.com\/wordpress\/2011\/09\/how-to-decrypt-an-encrypted-password-in-qtp\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.automationrepository.com\/wordpress\/2011\/09\/how-to-decrypt-an-encrypted-password-in-qtp\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.automationrepository.com\/wordpress\/2011\/09\/how-to-decrypt-an-encrypted-password-in-qtp\/#primaryimage","url":"http:\/\/2.bp.blogspot.com\/-ATU0r3ulGAI\/TmPrwNIu4KI\/AAAAAAAAAFA\/r9rNfUZjQPs\/s320\/PasswordEncoder.jpg","contentUrl":"http:\/\/2.bp.blogspot.com\/-ATU0r3ulGAI\/TmPrwNIu4KI\/AAAAAAAAAFA\/r9rNfUZjQPs\/s320\/PasswordEncoder.jpg"},{"@type":"BreadcrumbList","@id":"https:\/\/www.automationrepository.com\/wordpress\/2011\/09\/how-to-decrypt-an-encrypted-password-in-qtp\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.automationrepository.com\/wordpress\/"},{"@type":"ListItem","position":2,"name":"How to Decrypt an Encrypted Password in QTP"}]},{"@type":"WebSite","@id":"https:\/\/www.automationrepository.com\/wordpress\/#website","url":"https:\/\/www.automationrepository.com\/wordpress\/","name":"XX","description":"\r\nasas","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.automationrepository.com\/wordpress\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.automationrepository.com\/wordpress\/#\/schema\/person\/9fb56e00b93c7e939604cdfb05d62078","name":"Anish Pillai","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.automationrepository.com\/wordpress\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g","caption":"Anish Pillai"},"url":"https:\/\/www.automationrepository.com\/wordpress\/author\/anish-pillai\/"}]}},"_links":{"self":[{"href":"https:\/\/www.automationrepository.com\/wordpress\/wp-json\/wp\/v2\/posts\/10","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.automationrepository.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.automationrepository.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.automationrepository.com\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.automationrepository.com\/wordpress\/wp-json\/wp\/v2\/comments?post=10"}],"version-history":[{"count":12,"href":"https:\/\/www.automationrepository.com\/wordpress\/wp-json\/wp\/v2\/posts\/10\/revisions"}],"predecessor-version":[{"id":38,"href":"https:\/\/www.automationrepository.com\/wordpress\/wp-json\/wp\/v2\/posts\/10\/revisions\/38"}],"wp:attachment":[{"href":"https:\/\/www.automationrepository.com\/wordpress\/wp-json\/wp\/v2\/media?parent=10"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.automationrepository.com\/wordpress\/wp-json\/wp\/v2\/categories?post=10"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.automationrepository.com\/wordpress\/wp-json\/wp\/v2\/tags?post=10"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}