{"id":9,"date":"2011-09-06T01:46:00","date_gmt":"2011-09-06T01:46:00","guid":{"rendered":"http:\/\/www.automationrepository.com\/?p=9"},"modified":"2012-02-05T15:52:30","modified_gmt":"2012-02-05T10:22:30","slug":"how-to-encrypt-passwords-using-qtp","status":"publish","type":"post","link":"https:\/\/www.automationrepository.com\/wordpress\/2011\/09\/how-to-encrypt-passwords-using-qtp\/","title":{"rendered":"How to Encrypt Passwords using QTP"},"content":{"rendered":"<div style=\"text-align: justify; font-family: Verdana;\">\n<p>This article covers the different aspects of password encryption in QTP. It talks about why password encryption may be needed, how to encrypt passwords using QTP and how to use the encrypted passwords in our scripts. Lets discuss all these points one by one.<br \/>\n<!--more--><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" title=\"Encrypt Password using QTP\" src=\"https:\/\/www.automationrepository.com\/wordpress\/wp-content\/uploads\/ar\/qtp-encrypt-decrypt-password.png\" alt=\"Encrypt Password using QTP\" width=\"204\" height=\"138\" \/><\/p>\n<h3><span style=\"color: #000080;\">Why Password Encryption is Needed?<\/span><\/h3>\n<p>In most of the automation projects, the scripts would be dealing with various user ids and passwords, be it application credentials, DB passwords and other similar things. And in many cases, the automation scripts would be maintained by multiple people\/teams. In such situations, encrypted passwords can be used so that the original passwords are not exposed unnecessarily.<br \/>\n<span><br \/>\n<\/span><\/p>\n<h3><span style=\"color: #000080;\">How to Encrypt Passwords in QTP<\/span><\/h3>\n<p>QTP provides the following two methods to encrypt passwords &#8211;<br \/>\n<em> <\/em><br \/>\n<span style=\"color: #000000;\"><strong>a) Using Password Encoder Utility:<\/strong><\/span> Password Encoder is a tool\/utility provided by QTP to encode passwords. To encode any password using this tool &#8211;<br \/>\n<strong>i)<\/strong> Go to All Programs &gt; HP QuickTest Professional &gt; Tools &gt; Password Encoder<br \/>\n<strong>ii)<\/strong> Enter the password to be encrypted in the Password field and click on Generate button. The encrypted password will be displayed in the &#8216;Encoded string&#8217; field (as shown in the below figure).<\/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\/-duORp9TtoII\/TmUkajmszrI\/AAAAAAAAAFQ\/o-ZXjab16ME\/s1600\/PasswordEncoder.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/2.bp.blogspot.com\/-duORp9TtoII\/TmUkajmszrI\/AAAAAAAAAFQ\/o-ZXjab16ME\/s320\/PasswordEncoder.jpg\" alt=\"\" width=\"320\" height=\"178\" border=\"0\" \/><\/a><\/td>\n<\/tr>\n<tr>\n<td class=\"tr-caption\" style=\"text-align: center;\">Encrypted Password for &#8216;qwerty&#8217;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><em> <\/em><br \/>\n<span style=\"color: #000000;\"><strong>b) Using Crypt Object, Encrypt Method:<\/strong><\/span> Crypt is a QTP utility object which provides a method called Encrypt to encode strings. The below code shows how a password can be encoded using Encrypt method.<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\npassword = &quot;qwerty&quot;\r\nmsgbox Crypt.Encrypt(password)\r\n<\/pre>\n<p><span><br \/>\n<\/span><\/p>\n<h3><span style=\"color: #000080;\">How to use encrypted passwords in your scripts<\/span><\/h3>\n<p>QTP provides SetSecure method to set encrypted values in text fields. Unlike the normal Set method, which sets the plain text in a text field, SetSecure method decrypts the encrypted password first, and then sets the original decrypted value in a password field. Let&#8217;s see an example for this.<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\npassword = &quot;qwerty&quot;\r\nsEncryptedPwd = Crypt.Encrypt(password)\r\n'Enter Login Id &amp; password\r\nBrowser(&quot;&quot;).Page(&quot;&quot;).WebEdit(&quot;userid&quot;).Set &quot;user1&quot;\r\nBrowser(&quot;&quot;).Page(&quot;&quot;).WebEdit(&quot;password&quot;).SetSecure sEncryptedPwd\r\n<\/pre>\n<p><em>In the above example, sEncryptedPwd variable contains the encrypted password. SetSecure method first decodes this password internally and then sets the decoded\/decrypted password in the password field.<\/em><br \/>\n<em> <\/em><br \/>\n<strong>Note: SetSecure method decrypts a password only when it is in encrypted state. If we try to pass a plain (non encrypted) password to SetSecure method, then rather than decrypting the password, it just sets the same value in the text field.<\/strong><br \/>\n<em> <\/em><br \/>\nYou can also read: <a href=\"http:\/\/www.automationrepository.com\/2011\/09\/how-to-decrypt-an-encrypted-password-in-qtp\/\">How to obtain the decrypted value of an encrypted password<\/a><br \/>\n<span><br \/>\n<\/span><\/p>\n<\/div>\n<div style=\"font-family: Verdana,sans-serif; border: 1px solid #C8B560; padding: 3mm; background: #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: #EBDDE2;\"><strong>You can also visit <a title=\"Automation Repository\" href=\"http:\/\/www.automationrepository.com\">Automation Repository Home Page<\/a> or the <a title=\"All Articles\" href=\"http:\/\/www.automationrepository.com\/archive\/\">Archives Page<\/a> to view the other articles.<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article covers the different aspects of password encryption in QTP. It talks about why password encryption may be needed, how to encrypt passwords using QTP and how to use the encrypted passwords in our scripts. Lets discuss all these points one by one.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[5,45],"class_list":["post-9","post","type-post","status-publish","format-standard","hentry","category-qtp-basic-stuff","tag-encrypt-password","tag-qtp-tools"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Encrypt Passwords using 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-encrypt-passwords-using-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-encrypt-passwords-using-qtp\/\",\"url\":\"https:\/\/www.automationrepository.com\/wordpress\/2011\/09\/how-to-encrypt-passwords-using-qtp\/\",\"name\":\"How to Encrypt Passwords using QTP - XX\",\"isPartOf\":{\"@id\":\"https:\/\/www.automationrepository.com\/wordpress\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.automationrepository.com\/wordpress\/2011\/09\/how-to-encrypt-passwords-using-qtp\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.automationrepository.com\/wordpress\/2011\/09\/how-to-encrypt-passwords-using-qtp\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.automationrepository.com\/wordpress\/wp-content\/uploads\/ar\/qtp-encrypt-decrypt-password.png\",\"datePublished\":\"2011-09-06T01:46:00+00:00\",\"dateModified\":\"2012-02-05T10:22:30+00:00\",\"author\":{\"@id\":\"https:\/\/www.automationrepository.com\/wordpress\/#\/schema\/person\/9fb56e00b93c7e939604cdfb05d62078\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.automationrepository.com\/wordpress\/2011\/09\/how-to-encrypt-passwords-using-qtp\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.automationrepository.com\/wordpress\/2011\/09\/how-to-encrypt-passwords-using-qtp\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.automationrepository.com\/wordpress\/2011\/09\/how-to-encrypt-passwords-using-qtp\/#primaryimage\",\"url\":\"https:\/\/www.automationrepository.com\/wordpress\/wp-content\/uploads\/ar\/qtp-encrypt-decrypt-password.png\",\"contentUrl\":\"https:\/\/www.automationrepository.com\/wordpress\/wp-content\/uploads\/ar\/qtp-encrypt-decrypt-password.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.automationrepository.com\/wordpress\/2011\/09\/how-to-encrypt-passwords-using-qtp\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.automationrepository.com\/wordpress\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Encrypt Passwords using 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 Encrypt Passwords using 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-encrypt-passwords-using-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-encrypt-passwords-using-qtp\/","url":"https:\/\/www.automationrepository.com\/wordpress\/2011\/09\/how-to-encrypt-passwords-using-qtp\/","name":"How to Encrypt Passwords using QTP - XX","isPartOf":{"@id":"https:\/\/www.automationrepository.com\/wordpress\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.automationrepository.com\/wordpress\/2011\/09\/how-to-encrypt-passwords-using-qtp\/#primaryimage"},"image":{"@id":"https:\/\/www.automationrepository.com\/wordpress\/2011\/09\/how-to-encrypt-passwords-using-qtp\/#primaryimage"},"thumbnailUrl":"https:\/\/www.automationrepository.com\/wordpress\/wp-content\/uploads\/ar\/qtp-encrypt-decrypt-password.png","datePublished":"2011-09-06T01:46:00+00:00","dateModified":"2012-02-05T10:22:30+00:00","author":{"@id":"https:\/\/www.automationrepository.com\/wordpress\/#\/schema\/person\/9fb56e00b93c7e939604cdfb05d62078"},"breadcrumb":{"@id":"https:\/\/www.automationrepository.com\/wordpress\/2011\/09\/how-to-encrypt-passwords-using-qtp\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.automationrepository.com\/wordpress\/2011\/09\/how-to-encrypt-passwords-using-qtp\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.automationrepository.com\/wordpress\/2011\/09\/how-to-encrypt-passwords-using-qtp\/#primaryimage","url":"https:\/\/www.automationrepository.com\/wordpress\/wp-content\/uploads\/ar\/qtp-encrypt-decrypt-password.png","contentUrl":"https:\/\/www.automationrepository.com\/wordpress\/wp-content\/uploads\/ar\/qtp-encrypt-decrypt-password.png"},{"@type":"BreadcrumbList","@id":"https:\/\/www.automationrepository.com\/wordpress\/2011\/09\/how-to-encrypt-passwords-using-qtp\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.automationrepository.com\/wordpress\/"},{"@type":"ListItem","position":2,"name":"How to Encrypt Passwords using 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\/9","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=9"}],"version-history":[{"count":19,"href":"https:\/\/www.automationrepository.com\/wordpress\/wp-json\/wp\/v2\/posts\/9\/revisions"}],"predecessor-version":[{"id":1145,"href":"https:\/\/www.automationrepository.com\/wordpress\/wp-json\/wp\/v2\/posts\/9\/revisions\/1145"}],"wp:attachment":[{"href":"https:\/\/www.automationrepository.com\/wordpress\/wp-json\/wp\/v2\/media?parent=9"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.automationrepository.com\/wordpress\/wp-json\/wp\/v2\/categories?post=9"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.automationrepository.com\/wordpress\/wp-json\/wp\/v2\/tags?post=9"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}