{"id":53,"date":"2006-10-16T18:10:23","date_gmt":"2006-10-16T16:10:23","guid":{"rendered":"http:\/\/www.devious.dk\/wordpress\/2006\/10\/16\/digital-signatur-trickery\/"},"modified":"2006-10-16T18:14:23","modified_gmt":"2006-10-16T16:14:23","slug":"digital-signatur-trickery","status":"publish","type":"post","link":"https:\/\/tommy.winther.nu\/wordpress\/2006\/10\/16\/digital-signatur-trickery\/","title":{"rendered":"Digital Signatur trickery"},"content":{"rendered":"<p>In Denmark the government is pushing the use of a digital certificate to identify against most government websites, etc. and for signing and encrypting email. I kinda like the idea so I signed up for one back in &#8217;04. It expired last month, though so I have renewed it, although not without my fair amount of trouble. Apparently Linux and\/or Firefox isn&#8217;t as supported as they would like the general public to think. (Or perhaps it&#8217;s, as usual, my own fault for using beta software &#8211; Firefox 2 and Ubunty Edgy).<\/p>\n<p>Anyway, I booted Windows and got the certificate renewed and created a backup. Back in &#8217;04 the backup was actually the PKCS12 certificate file, but that is not the case anymore. Nowadays it&#8217;s a plain old HTML file with some in-line javascript that loads the &#8220;required&#8221; software to install the certificate. PKCS12 is pretty standard and doesn&#8217;t require any additional software, so I don&#8217;t get why I can&#8217;t just have the file directly.<\/p>\n<p>The usual path for the PKCS12 file is to load the certificate in Internet Explorer using the html file, and then export it. But for some reason it&#8217;s not possible to export the private key, only the public key. I tried this both running Internet Explorer in Windows and through wine, but with no luck.<\/p>\n<p>At this point I was kinda pissed and figured the html file must have some information regarding the PKCS12 file and surely it did. Looking at the javascript there&#8217;s a variable with the name &#8220;pkcs12&#8221;. This variable is base64 encoded though, since PKCS12 is a binary format. So I quickly hacked together a little python script that extract and converts the certificate, so it&#8217;s ready for use by Firefox, Evolution, etc.<br \/>\nIf you have the same problems as me you can get the script <a target=\"_blank\" href=\"\/files\/2006\/10\/extractpkcs12.py\">here<\/a> and run it like this:<\/p>\n<p><code>.\/extractpkcs12.py backup_file.html output_certificate.pkcs<br \/>\n<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In Denmark the government is pushing the use of a digital certificate to identify against most government websites, etc. and for signing and encrypting email. I kinda like the idea so I signed up for one back in &#8217;04. It expired last month, though so I have renewed it, although not without my fair amount [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,6],"tags":[],"class_list":["post-53","post","type-post","status-publish","format-standard","hentry","category-linux","category-code","post-preview"],"_links":{"self":[{"href":"https:\/\/tommy.winther.nu\/wordpress\/wp-json\/wp\/v2\/posts\/53","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tommy.winther.nu\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tommy.winther.nu\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tommy.winther.nu\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/tommy.winther.nu\/wordpress\/wp-json\/wp\/v2\/comments?post=53"}],"version-history":[{"count":1,"href":"https:\/\/tommy.winther.nu\/wordpress\/wp-json\/wp\/v2\/posts\/53\/revisions"}],"predecessor-version":[{"id":194,"href":"https:\/\/tommy.winther.nu\/wordpress\/wp-json\/wp\/v2\/posts\/53\/revisions\/194"}],"wp:attachment":[{"href":"https:\/\/tommy.winther.nu\/wordpress\/wp-json\/wp\/v2\/media?parent=53"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tommy.winther.nu\/wordpress\/wp-json\/wp\/v2\/categories?post=53"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tommy.winther.nu\/wordpress\/wp-json\/wp\/v2\/tags?post=53"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}