{"id":2349,"date":"2013-07-15T21:00:04","date_gmt":"2013-07-15T13:00:04","guid":{"rendered":"http:\/\/rmohan.com\/?p=2349"},"modified":"2013-07-15T21:00:04","modified_gmt":"2013-07-15T13:00:04","slug":"encryptdecrypt-string-with-openssl","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=2349","title":{"rendered":"Encrypt\/Decrypt string with openssl"},"content":{"rendered":"<p>Sometimes it can be helpfull to encrypt\/decrypt strings on Linux.<\/p>\n<p>Of course we can install tools like crypt but is not always available after default installation.<\/p>\n<p>Good thing is that we also have openssl which is nearly always installed on a linux server.<\/p>\n<p>How to encrypt a string with openssl :<\/p>\n<p>    $ echo \u201cjuicy\u201d | openssl aes-256-cbc -a -salt<\/p>\n<p>    enter aes-256-cbc encryption password:<\/p>\n<p>    Verifying \u2013 enter aes-256-cbc encryption password:<\/p>\n<p>    U2FsdGVkX1+0ouL4Ewo0SDicF69rjllKwpKWtGfm9wI=<\/p>\n<p>So how do we decrypt this string ?<\/p>\n<p>    $ echo \u201cU2FsdGVkX1+0ouL4Ewo0SDicF69rjllKwpKWtGfm9wI=\u201d | openssl aes-256-cbc -a -d -salt<\/p>\n<p>    enter aes-256-cbc decryption password:<\/p>\n<p>    juicy<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes it can be helpfull to encrypt\/decrypt strings on Linux.<\/p>\n<p>Of course we can install tools like crypt but is not always available after default installation.<\/p>\n<p>Good thing is that we also have openssl which is nearly always installed on a linux server.<\/p>\n<p>How to encrypt a string with openssl :<\/p>\n<p> $ echo \u201cjuicy\u201d [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/2349"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2349"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/2349\/revisions"}],"predecessor-version":[{"id":2350,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/2349\/revisions\/2350"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2349"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2349"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2349"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}