{"id":1136,"date":"2023-05-31T11:07:10","date_gmt":"2023-05-31T11:07:10","guid":{"rendered":"https:\/\/nmbm.biz\/sitio\/?p=1136"},"modified":"2023-05-31T11:07:11","modified_gmt":"2023-05-31T11:07:11","slug":"webservices-at-transformar-o-certificado-pfx-em-pem","status":"publish","type":"post","link":"https:\/\/blog.webgescom.pt\/blog\/webservices-at-transformar-o-certificado-pfx-em-pem\/","title":{"rendered":"Webservices AT &#8211; Transformar o certificado PFX em PEM"},"content":{"rendered":"\n<p>Os certificados emitidos pela Autoridade Tribut\u00e1ria para utiliza\u00e7\u00e3o dos Webservices da AT como, por exemplo, a Comunica\u00e7\u00e3o dos Documentos de Transporte, s\u00e3o emitidos no formato PFX (Personal Information Exchange). Este formato armazena a chave privada, a chave p\u00fablica e o certificado propriamente dito, no mesmo ficheiro .pfx, assim com a cadeia de certifica\u00e7\u00e3o CA.<\/p>\n\n\n\n<p>Alguns sistemas podem ter necessidade desta informa\u00e7\u00e3o noutro formato, nomeadamente PEM (Privacy Enhanced Mail), o exemplo que pretendo mostrar e que se aplica a ambiente Linux+Apache.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">openssl pkcs12 -in TesteWebservices.pfx -nodes -out TesteWebservices.pem<\/pre>\n\n\n\n<p>Usei como exemplo o certificado de testes da AT com a op\u00e7\u00e3o <em>-nodes<\/em> <\/p>\n<div class=\"pvc_clear\"><\/div><p id=\"pvc_stats_1136\" class=\"pvc_stats all  \" data-element-id=\"1136\" style=\"\"><i class=\"pvc-stats-icon small\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/blog.webgescom.pt\/blog\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p><div class=\"pvc_clear\"><\/div>","protected":false},"excerpt":{"rendered":"<p>Os certificados emitidos pela Autoridade Tribut\u00e1ria para utiliza\u00e7\u00e3o dos Webservices da AT como, por exemplo, a Comunica\u00e7\u00e3o dos Documentos de Transporte, s\u00e3o emitidos no formato PFX (Personal Information Exchange). Este formato armazena a chave privada, a chave p\u00fablica e o certificado propriamente dito, no mesmo ficheiro .pfx, assim com a cadeia de certifica\u00e7\u00e3o CA. Alguns&hellip;&nbsp;<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_1136\" class=\"pvc_stats all  \" data-element-id=\"1136\" style=\"\"><i class=\"pvc-stats-icon small\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/blog.webgescom.pt\/blog\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":"","footnotes":""},"categories":[9,128],"tags":[21,20,119,246],"class_list":["post-1136","post","type-post","status-publish","format-standard","hentry","category-linux","category-programacao","tag-autoridade-tributaria","tag-comunicacao-dos-documentos-de-transporte","tag-faturacao","tag-series-de-documentos"],"aioseo_notices":[],"a3_pvc":{"activated":true,"total_views":212,"today_views":0},"_links":{"self":[{"href":"https:\/\/blog.webgescom.pt\/blog\/wp-json\/wp\/v2\/posts\/1136","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.webgescom.pt\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.webgescom.pt\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.webgescom.pt\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.webgescom.pt\/blog\/wp-json\/wp\/v2\/comments?post=1136"}],"version-history":[{"count":2,"href":"https:\/\/blog.webgescom.pt\/blog\/wp-json\/wp\/v2\/posts\/1136\/revisions"}],"predecessor-version":[{"id":1138,"href":"https:\/\/blog.webgescom.pt\/blog\/wp-json\/wp\/v2\/posts\/1136\/revisions\/1138"}],"wp:attachment":[{"href":"https:\/\/blog.webgescom.pt\/blog\/wp-json\/wp\/v2\/media?parent=1136"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.webgescom.pt\/blog\/wp-json\/wp\/v2\/categories?post=1136"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.webgescom.pt\/blog\/wp-json\/wp\/v2\/tags?post=1136"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}