{"id":5647,"date":"2014-04-04T15:17:12","date_gmt":"2014-04-04T15:17:12","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/04\/04\/uncaught-error-invalidcharactererror-dom-exception-5-when-aes256-encrypted-and-base64-encoded-string-is-decoded-on-browser-collection-of-common-programming-errors\/"},"modified":"2014-04-04T15:17:12","modified_gmt":"2014-04-04T15:17:12","slug":"uncaught-error-invalidcharactererror-dom-exception-5-when-aes256-encrypted-and-base64-encoded-string-is-decoded-on-browser-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/04\/04\/uncaught-error-invalidcharactererror-dom-exception-5-when-aes256-encrypted-and-base64-encoded-string-is-decoded-on-browser-collection-of-common-programming-errors\/","title":{"rendered":"&ldquo;Uncaught Error: InvalidCharacterError: DOM Exception 5&rdquo; when AES256 encrypted and base64 encoded string is decoded on browser-Collection of common programming errors"},"content":{"rendered":"<p>At first, by ruby (I am using Rails), I made <strong>AES256<\/strong> encrypted and <strong>base64<\/strong> encoded string on server-side.<\/p>\n<pre><code>require 'aes'\n\n# encrypt with AES256 and encode with base64\nbase64 = AES.encrypt(\"secret word\", \"pass\")\n<\/code><\/pre>\n<p>Then, I want to <strong>decode this on browser<\/strong> with below libraries.<\/p>\n<p>My JavaScript code is below.<\/p>\n<pre><code>base64encoded = $('span.base64:first').text();\nencrypted = Base64.decode(base64encoded); \/\/<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>At first, by ruby (I am using Rails), I made AES256 encrypted and base64 encoded string on server-side. require &#8216;aes&#8217; # encrypt with AES256 and encode with base64 base64 = AES.encrypt(&#8220;secret word&#8221;, &#8220;pass&#8221;) Then, I want to decode this on browser with below libraries. My JavaScript code is below. base64encoded = $(&#8216;span.base64:first&#8217;).text(); encrypted = Base64.decode(base64encoded); [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5647","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5647","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=5647"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5647\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=5647"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=5647"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=5647"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}