<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.openssl.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Skyluker4</id>
	<title>OpenSSLWiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.openssl.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Skyluker4"/>
	<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php/Special:Contributions/Skyluker4"/>
	<updated>2026-05-20T09:53:47Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.35.13</generator>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=DER&amp;diff=3198</id>
		<title>DER</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=DER&amp;diff=3198"/>
		<updated>2022-01-14T23:23:34Z</updated>

		<summary type="html">&lt;p&gt;Skyluker4: Typo and grammatical fixes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;DER is a binary format for data structures described by ASN.1.&lt;br /&gt;
&lt;br /&gt;
For example, x509 is described in ASN1 and encoded in DER. It exists other encoding formats for ASN.1 but DER is the one chosen for security since there is only one possible encoding given a ASN.1. encoding (which is not the case for BER used in ldap, for example).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Command ==&lt;br /&gt;
&lt;br /&gt;
openssl ''asn1parse'' is the command to display the internal structure of a DER document.&lt;br /&gt;
&lt;br /&gt;
[[Category:Shell level]]&lt;br /&gt;
&lt;br /&gt;
== Sample ==&lt;br /&gt;
&lt;br /&gt;
When using i2d_X509_fp(FILE * outcert, X509 * x509_cert) file result is the raw DER-encoded value of the X509 Certificate.&lt;br /&gt;
&lt;br /&gt;
C code to dump a X509 into DER format:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void dump_x509_cert(X509* x509_cert)&lt;br /&gt;
{&lt;br /&gt;
  const char * dumpcertfile = &amp;quot;dumpcertfile&amp;quot;;&lt;br /&gt;
  if (x509_cert != NULL)&lt;br /&gt;
    {&lt;br /&gt;
      FILE * outcert = fopen(dumpcertfile,&amp;quot;w&amp;quot;);&lt;br /&gt;
      if ( outcert )&lt;br /&gt;
	{&lt;br /&gt;
	  i2d_X509_fp(outcert, x509_cert);&lt;br /&gt;
	  fclose(outcert);&lt;br /&gt;
	}&lt;br /&gt;
      else&lt;br /&gt;
	{&lt;br /&gt;
	  fprintf(stderr,&amp;quot;[ERROR] Can't create %s file\n&amp;quot;, dumpcerfile);&lt;br /&gt;
	}&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To view the content:&lt;br /&gt;
&lt;br /&gt;
openssl asn1parse -in dumpcertfile -inform DER&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    0:d=0  hl=4 l= 981 cons: SEQUENCE          &lt;br /&gt;
    4:d=1  hl=4 l= 701 cons: SEQUENCE          &lt;br /&gt;
    8:d=2  hl=2 l=   3 cons: cont [ 0 ]        &lt;br /&gt;
   10:d=3  hl=2 l=   1 prim: INTEGER           :02&lt;br /&gt;
   13:d=2  hl=2 l=   4 prim: INTEGER           :5631333F&lt;br /&gt;
   19:d=2  hl=2 l=  13 cons: SEQUENCE          &lt;br /&gt;
   21:d=3  hl=2 l=   9 prim: OBJECT            :sha1WithRSAEncryption&lt;br /&gt;
   32:d=3  hl=2 l=   0 prim: NULL              &lt;br /&gt;
   34:d=2  hl=2 l= 127 cons: SEQUENCE          &lt;br /&gt;
   36:d=3  hl=2 l=  11 cons: SET               &lt;br /&gt;
   38:d=4  hl=2 l=   9 cons: SEQUENCE          &lt;br /&gt;
   40:d=5  hl=2 l=   3 prim: OBJECT            :countryName&lt;br /&gt;
   45:d=5  hl=2 l=   2 prim: PRINTABLESTRING   :FR&lt;br /&gt;
   49:d=3  hl=2 l=  28 cons: SET               &lt;br /&gt;
   51:d=4  hl=2 l=  26 cons: SEQUENCE          &lt;br /&gt;
   53:d=5  hl=2 l=   3 prim: OBJECT            :commonName&lt;br /&gt;
   58:d=5  hl=2 l=  19 prim: PRINTABLESTRING   :pavilionartlogiciel&lt;br /&gt;
   79:d=3  hl=2 l=  28 cons: SET               &lt;br /&gt;
   81:d=4  hl=2 l=  26 cons: SEQUENCE          &lt;br /&gt;
   83:d=5  hl=2 l=   3 prim: OBJECT            :organizationName&lt;br /&gt;
   88:d=5  hl=2 l=  19 prim: PRINTABLESTRING   :pavilionartlogiciel&lt;br /&gt;
  109:d=3  hl=2 l=  16 cons: SET               &lt;br /&gt;
  111:d=4  hl=2 l=  14 cons: SEQUENCE          &lt;br /&gt;
  113:d=5  hl=2 l=   3 prim: OBJECT            :organizationalUnitName&lt;br /&gt;
  118:d=5  hl=2 l=   7 prim: PRINTABLESTRING   :Unknown&lt;br /&gt;
  127:d=3  hl=2 l=  16 cons: SET               &lt;br /&gt;
  129:d=4  hl=2 l=  14 cons: SEQUENCE          &lt;br /&gt;
  131:d=5  hl=2 l=   3 prim: OBJECT            :stateOrProvinceName&lt;br /&gt;
  136:d=5  hl=2 l=   7 prim: PRINTABLESTRING   :Unknown&lt;br /&gt;
  145:d=3  hl=2 l=  16 cons: SET               &lt;br /&gt;
  147:d=4  hl=2 l=  14 cons: SEQUENCE          &lt;br /&gt;
  149:d=5  hl=2 l=   3 prim: OBJECT            :localityName&lt;br /&gt;
  154:d=5  hl=2 l=   7 prim: PRINTABLESTRING   :Unknown&lt;br /&gt;
  163:d=2  hl=2 l=  34 cons: SEQUENCE          &lt;br /&gt;
  165:d=3  hl=2 l=  15 prim: GENERALIZEDTIME   :20151028204239Z&lt;br /&gt;
  182:d=3  hl=2 l=  15 prim: GENERALIZEDTIME   :20251025204239Z&lt;br /&gt;
  199:d=2  hl=2 l= 127 cons: SEQUENCE          &lt;br /&gt;
  201:d=3  hl=2 l=  11 cons: SET               &lt;br /&gt;
  203:d=4  hl=2 l=   9 cons: SEQUENCE          &lt;br /&gt;
  205:d=5  hl=2 l=   3 prim: OBJECT            :countryName&lt;br /&gt;
  210:d=5  hl=2 l=   2 prim: PRINTABLESTRING   :FR&lt;br /&gt;
  214:d=3  hl=2 l=  28 cons: SET               &lt;br /&gt;
  216:d=4  hl=2 l=  26 cons: SEQUENCE          &lt;br /&gt;
  218:d=5  hl=2 l=   3 prim: OBJECT            :commonName&lt;br /&gt;
  223:d=5  hl=2 l=  19 prim: PRINTABLESTRING   :pavilionartlogiciel&lt;br /&gt;
  244:d=3  hl=2 l=  28 cons: SET               &lt;br /&gt;
  246:d=4  hl=2 l=  26 cons: SEQUENCE          &lt;br /&gt;
  248:d=5  hl=2 l=   3 prim: OBJECT            :organizationName&lt;br /&gt;
  253:d=5  hl=2 l=  19 prim: PRINTABLESTRING   :pavilionartlogiciel&lt;br /&gt;
  274:d=3  hl=2 l=  16 cons: SET               &lt;br /&gt;
  276:d=4  hl=2 l=  14 cons: SEQUENCE          &lt;br /&gt;
  278:d=5  hl=2 l=   3 prim: OBJECT            :organizationalUnitName&lt;br /&gt;
  283:d=5  hl=2 l=   7 prim: PRINTABLESTRING   :Unknown&lt;br /&gt;
  292:d=3  hl=2 l=  16 cons: SET               &lt;br /&gt;
  294:d=4  hl=2 l=  14 cons: SEQUENCE          &lt;br /&gt;
  296:d=5  hl=2 l=   3 prim: OBJECT            :stateOrProvinceName&lt;br /&gt;
  301:d=5  hl=2 l=   7 prim: PRINTABLESTRING   :Unknown&lt;br /&gt;
  310:d=3  hl=2 l=  16 cons: SET               &lt;br /&gt;
  312:d=4  hl=2 l=  14 cons: SEQUENCE          &lt;br /&gt;
  314:d=5  hl=2 l=   3 prim: OBJECT            :localityName&lt;br /&gt;
  319:d=5  hl=2 l=   7 prim: PRINTABLESTRING   :Unknown&lt;br /&gt;
  328:d=2  hl=4 l= 290 cons: SEQUENCE          &lt;br /&gt;
  332:d=3  hl=2 l=  13 cons: SEQUENCE          &lt;br /&gt;
  334:d=4  hl=2 l=   9 prim: OBJECT            :rsaEncryption&lt;br /&gt;
  345:d=4  hl=2 l=   0 prim: NULL              &lt;br /&gt;
  347:d=3  hl=4 l= 271 prim: BIT STRING        &lt;br /&gt;
  622:d=2  hl=2 l=  85 cons: cont [ 3 ]        &lt;br /&gt;
  624:d=3  hl=2 l=  83 cons: SEQUENCE          &lt;br /&gt;
  626:d=4  hl=2 l=  12 cons: SEQUENCE          &lt;br /&gt;
  628:d=5  hl=2 l=   3 prim: OBJECT            :X509v3 Basic Constraints&lt;br /&gt;
  633:d=5  hl=2 l=   1 prim: BOOLEAN           :255&lt;br /&gt;
  636:d=5  hl=2 l=   2 prim: OCTET STRING      [HEX DUMP]:3000&lt;br /&gt;
  640:d=4  hl=2 l=  19 cons: SEQUENCE          &lt;br /&gt;
  642:d=5  hl=2 l=   3 prim: OBJECT            :X509v3 Extended Key Usage&lt;br /&gt;
  647:d=5  hl=2 l=  12 prim: OCTET STRING      [HEX DUMP]:300A06082B06010505070301&lt;br /&gt;
  661:d=4  hl=2 l=  15 cons: SEQUENCE          &lt;br /&gt;
  663:d=5  hl=2 l=   3 prim: OBJECT            :X509v3 Key Usage&lt;br /&gt;
  668:d=5  hl=2 l=   1 prim: BOOLEAN           :255&lt;br /&gt;
  671:d=5  hl=2 l=   5 prim: OCTET STRING      [HEX DUMP]:0303072000&lt;br /&gt;
  678:d=4  hl=2 l=  29 cons: SEQUENCE          &lt;br /&gt;
  680:d=5  hl=2 l=   3 prim: OBJECT            :X509v3 Subject Key Identifier&lt;br /&gt;
  685:d=5  hl=2 l=  22 prim: OCTET STRING      [HEX DUMP]:0414304610060805E69AE14F84CC366012C0EB9E3D99&lt;br /&gt;
  709:d=1  hl=2 l=  13 cons: SEQUENCE          &lt;br /&gt;
  711:d=2  hl=2 l=   9 prim: OBJECT            :sha1WithRSAEncryption&lt;br /&gt;
  722:d=2  hl=2 l=   0 prim: NULL              &lt;br /&gt;
  724:d=1  hl=4 l= 257 prim: BIT STRING   &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since it is an X509 certificate the best way to view content is:&lt;br /&gt;
&lt;br /&gt;
openssl x509 -in dumpcertfile -inform DER -text&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Encoding]]&lt;/div&gt;</summary>
		<author><name>Skyluker4</name></author>
	</entry>
</feed>