directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r978680 - in /websites/staging/directory/trunk/content: ./ kerby/kerby-asn1.html
Date Wed, 27 Jan 2016 02:00:49 GMT
Author: buildbot
Date: Wed Jan 27 02:00:48 2016
New Revision: 978680

Log:
Staging update by buildbot for directory

Modified:
    websites/staging/directory/trunk/content/   (props changed)
    websites/staging/directory/trunk/content/kerby/kerby-asn1.html

Propchange: websites/staging/directory/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Wed Jan 27 02:00:48 2016
@@ -1 +1 @@
-1726932
+1726933

Modified: websites/staging/directory/trunk/content/kerby/kerby-asn1.html
==============================================================================
--- websites/staging/directory/trunk/content/kerby/kerby-asn1.html (original)
+++ websites/staging/directory/trunk/content/kerby/kerby-asn1.html Wed Jan 27 02:00:48 2016
@@ -164,32 +164,37 @@ h2:hover > .headerlink, h3:hover > .head
 <h3 id="asn1-hierarcy">ASN1 hierarcy<a class="headerlink" href="#asn1-hierarcy"
title="Permanent link">&para;</a></h3>
 <p><img alt="" src="hierarchy.png" /></p>
 <h3 id="a-asn1-parser-with-easy-and-simple-api">A ASN1 parser with easy and simple
API<a class="headerlink" href="#a-asn1-parser-with-easy-and-simple-api" title="Permanent
link">&para;</a></h3>
-<p>```
-// encoding
-Asn1Integer aValue = new Asn1Integer(8899);
-byte[] encoded = aValue.encode();</p>
-<p>// decoding
-byte[] contentToDecode = ...
-Asn1Integer decodedValue = new Asn1Integer();
-decodedValue.decode(contentToDecode);
-Integer value = decodedValue.getValue();
-```</p>
+<div class="codehilite"><pre><span class="c1">// encoding</span>
+<span class="n">Asn1Integer</span> <span class="n">aValue</span>
<span class="o">=</span> <span class="k">new</span> <span class="n">Asn1Integer</span><span
class="p">(</span><span class="mh">8899</span><span class="p">);</span>
+<span class="k">byte</span><span class="p">[]</span> <span class="n">encoded</span>
<span class="o">=</span> <span class="n">aValue</span><span class="p">.</span><span
class="n">encode</span><span class="p">();</span>
+
+<span class="c1">// decoding</span>
+<span class="k">byte</span><span class="p">[]</span> <span class="n">contentToDecode</span>
<span class="o">=</span> <span class="p">...</span>
+<span class="n">Asn1Integer</span> <span class="n">decodedValue</span>
<span class="o">=</span> <span class="k">new</span> <span class="n">Asn1Integer</span><span
class="p">();</span>
+<span class="n">decodedValue</span><span class="p">.</span><span
class="n">decode</span><span class="p">(</span><span class="n">contentToDecode</span><span
class="p">);</span>
+<span class="n">Integer</span> <span class="n">value</span> <span
class="o">=</span> <span class="n">decodedValue</span><span class="p">.</span><span
class="n">getValue</span><span class="p">();</span>
+</pre></div>
+
+
 <h3 id="data-driven-asn1-encodingdecoding-framework-and-parser">Data-driven ASN1 encoding/decoding
framework and parser<a class="headerlink" href="#data-driven-asn1-encodingdecoding-framework-and-parser"
title="Permanent link">&para;</a></h3>
-<p>With the following definition from Kerberos protocol
-<code>AuthorizationData ::= SEQUENCE OF SEQUENCE {
-     ad-type         [0] Int32,
-     ad-data         [1] OCTET STRING
- }</code></p>
-<p>You can model AuthzDataEntry as follows
-```java
-public class AuthorizationDataEntry extends KrbSequenceType {
-    /*<em>
-     * The possible fields
-     </em>/
-    protected enum AuthorizationDataEntryField implements EnumType {
-        AD_TYPE,
-        AD_DATA;</p>
-<div class="codehilite"><pre>    <span class="o">/**</span>
+<p>With the following definition from Kerberos protocol</p>
+<div class="codehilite"><pre><span class="n">AuthorizationData</span>
<span class="p">::=</span> <span class="n">SEQUENCE</span> <span
class="n">OF</span> <span class="n">SEQUENCE</span> <span class="p">{</span>
+     <span class="n">ad</span><span class="o">-</span><span class="n">type</span>
        <span class="p">[</span>0<span class="p">]</span> <span
class="n">Int32</span><span class="p">,</span>
+     <span class="n">ad</span><span class="o">-</span><span class="n">data</span>
        <span class="p">[</span>1<span class="p">]</span> <span
class="n">OCTET</span> <span class="n">STRING</span>
+ <span class="p">}</span>
+</pre></div>
+
+
+<p>You can model AuthzDataEntry as follows</p>
+<div class="codehilite"><pre><span class="n">public</span> <span
class="n">class</span> <span class="n">AuthorizationDataEntry</span>
<span class="n">extends</span> <span class="n">KrbSequenceType</span>
<span class="p">{</span>
+<span class="o">/**</span>
+ <span class="o">*</span> <span class="n">The</span> <span class="n">possible</span>
<span class="n">fields</span>
+ <span class="o">*/</span>
+<span class="n">protected</span> <span class="n">enum</span> <span
class="n">AuthorizationDataEntryField</span> <span class="n">implements</span>
<span class="n">EnumType</span> <span class="p">{</span>
+    <span class="n">AD_TYPE</span><span class="p">,</span>
+    <span class="n">AD_DATA</span><span class="p">;</span>
+
+    <span class="o">/**</span>
      <span class="o">*</span> <span class="p">{@</span><span class="n">inheritDoc</span><span
class="p">}</span>
      <span class="o">*/</span>
     <span class="p">@</span><span class="n">Override</span>
@@ -249,52 +254,60 @@ public class AuthorizationDataEntry exte
 <span class="n">public</span> <span class="n">void</span> <span
class="n">setAuthzData</span><span class="p">(</span><span class="n">byte</span><span
class="p">[]</span> <span class="n">authzData</span><span class="p">)</span>
<span class="p">{</span>
     <span class="n">setFieldAsOctets</span><span class="p">(</span><span
class="n">AuthorizationDataEntryField</span><span class="p">.</span><span
class="n">AD_DATA</span><span class="p">,</span> <span class="n">authzData</span><span
class="p">);</span>
 <span class="p">}</span>
+<span class="p">}</span>
+</pre></div>
+
+
+<p>And then define AuthorizationData simply</p>
+<div class="codehilite"><pre><span class="n">public</span> <span
class="n">class</span> <span class="n">AuthorizationData</span> <span
class="n">extends</span> <span class="n">KrbSequenceOfType</span><span
class="o">&lt;</span><span class="n">AuthorizationDataEntry</span><span
class="o">&gt;</span> <span class="p">{</span>
+
+<span class="p">}</span>
 </pre></div>
 
 
-<p>}
-```</p>
-<p>And then define AuthorizationData simply
-```java
-public class AuthorizationData extends KrbSequenceOfType<AuthorizationDataEntry> {</p>
-<p>}
-```</p>
 <p>Then you can process with above definitions, encode and decode, without caring about
the details.</p>
-<p>Think about how to implement the following more complex and pratical sample from
<a href="http://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf">ITU-T
Rec. X.680 ISO/IEC 8824-1</a>:
-```
-A.1 ASN.1 description of the record structure
-The structure of the hypothetical personnel record is formally described below using ASN.1
specified in
-ITU-T Rec. X.680 | ISO/IEC 8824-1 for defining types.</p>
-<p>PersonnelRecord ::= [APPLICATION 0] IMPLICIT SET {
-    Name Name,
-    title [0] VisibleString,
-    number EmployeeNumber,
-    dateOfHire [1] Date,
-    nameOfSpouse [2] Name,
-    children [3] IMPLICIT
-    SEQUENCE OF ChildInformation DEFAULT {}
-}</p>
-<p>ChildInformation ::= SET {
-    name Name,
-    dateOfBirth [0] Date
-}</p>
-<p>Name ::= [APPLICATION 1] IMPLICIT SEQUENCE {
-    givenName VisibleString,
-    initial VisibleString,
-    familyName VisibleString
-}</p>
+<p>Think about how to implement the following more complex and pratical sample from
<a href="http://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf">ITU-T
Rec. X.680 ISO/IEC 8824-1</a>:</p>
+<div class="codehilite"><pre><span class="n">A</span><span class="p">.</span>1
<span class="n">ASN</span><span class="p">.</span>1 <span class="n">description</span>
<span class="n">of</span> <span class="n">the</span> <span class="n">record</span>
<span class="n">structure</span>
+<span class="n">The</span> <span class="n">structure</span> <span
class="n">of</span> <span class="n">the</span> <span class="n">hypothetical</span>
<span class="n">personnel</span> <span class="n">record</span> <span
class="n">is</span> <span class="n">formally</span> <span class="n">described</span>
<span class="n">below</span> <span class="n">using</span> <span
class="n">ASN</span><span class="p">.</span>1 <span class="n">specified</span>
<span class="n">in</span>
+<span class="n">ITU</span><span class="o">-</span><span class="n">T</span>
<span class="n">Rec</span><span class="p">.</span> <span class="n">X</span><span
class="p">.</span>680 <span class="o">|</span> <span class="n">ISO</span><span
class="o">/</span><span class="n">IEC</span> 8824<span class="o">-</span>1
<span class="k">for</span> <span class="n">defining</span> <span
class="n">types</span><span class="p">.</span>
+
+<span class="n">PersonnelRecord</span> <span class="p">::=</span>
<span class="p">[</span><span class="n">APPLICATION</span> 0<span
class="p">]</span> <span class="n">IMPLICIT</span> <span class="n">SET</span>
<span class="p">{</span>
+    <span class="n">Name</span> <span class="n">Name</span><span
class="p">,</span>
+    <span class="n">title</span> <span class="p">[</span>0<span
class="p">]</span> <span class="n">VisibleString</span><span class="p">,</span>
+    <span class="n">number</span> <span class="n">EmployeeNumber</span><span
class="p">,</span>
+    <span class="n">dateOfHire</span> <span class="p">[</span>1<span
class="p">]</span> <span class="n">Date</span><span class="p">,</span>
+    <span class="n">nameOfSpouse</span> <span class="p">[</span>2<span
class="p">]</span> <span class="n">Name</span><span class="p">,</span>
+    <span class="n">children</span> <span class="p">[</span>3<span
class="p">]</span> <span class="n">IMPLICIT</span>
+    <span class="n">SEQUENCE</span> <span class="n">OF</span> <span
class="n">ChildInformation</span> <span class="n">DEFAULT</span> <span
class="p">{}</span>
+<span class="p">}</span>
+
+<span class="n">ChildInformation</span> <span class="p">::=</span>
<span class="n">SET</span> <span class="p">{</span>
+    <span class="n">name</span> <span class="n">Name</span><span
class="p">,</span>
+    <span class="n">dateOfBirth</span> <span class="p">[</span>0<span
class="p">]</span> <span class="n">Date</span>
+<span class="p">}</span>
+
+<span class="n">Name</span> <span class="p">::=</span> <span class="p">[</span><span
class="n">APPLICATION</span> 1<span class="p">]</span> <span class="n">IMPLICIT</span>
<span class="n">SEQUENCE</span> <span class="p">{</span>
+    <span class="n">givenName</span> <span class="n">VisibleString</span><span
class="p">,</span>
+    <span class="n">initial</span> <span class="n">VisibleString</span><span
class="p">,</span>
+    <span class="n">familyName</span> <span class="n">VisibleString</span>
+<span class="p">}</span>
+</pre></div>
+
+
 <p>EmployeeNumber ::= [APPLICATION 2] IMPLICIT INTEGER
 Date ::= [APPLICATION 3] IMPLICIT VisibleString -- YYYYMMDD
-<code>Similarly as above, we can have (from the unit test codes):</code>java
-public class PersonnelRecord extends Asn1TaggingSet {
-    protected enum PersonnelRecordField implements EnumType {
-        NAME,
-        TITLE,
-        NUMBER,
-        DATE_OF_HIRE,
-        NAME_OF_SPOUSE,
-        CHILDREN;</p>
-<div class="codehilite"><pre>    <span class="p">@</span><span
class="n">Override</span>
+```
+Similarly as above, we can have (from the unit test codes):</p>
+<div class="codehilite"><pre><span class="n">public</span> <span
class="n">class</span> <span class="n">PersonnelRecord</span> <span
class="n">extends</span> <span class="n">Asn1TaggingSet</span> <span
class="p">{</span>
+<span class="n">protected</span> <span class="n">enum</span> <span
class="n">PersonnelRecordField</span> <span class="n">implements</span>
<span class="n">EnumType</span> <span class="p">{</span>
+    <span class="n">NAME</span><span class="p">,</span>
+    <span class="n">TITLE</span><span class="p">,</span>
+    <span class="n">NUMBER</span><span class="p">,</span>
+    <span class="n">DATE_OF_HIRE</span><span class="p">,</span>
+    <span class="n">NAME_OF_SPOUSE</span><span class="p">,</span>
+    <span class="n">CHILDREN</span><span class="p">;</span>
+
+    <span class="p">@</span><span class="n">Override</span>
     <span class="n">public</span> <span class="n">int</span> <span
class="n">getValue</span><span class="p">()</span> <span class="p">{</span>
         <span class="k">return</span> <span class="n">ordinal</span><span
class="p">();</span>
     <span class="p">}</span>
@@ -499,11 +512,10 @@ public class PersonnelRecord extends Asn
         <span class="n">this</span><span class="p">(</span><span
class="n">null</span><span class="p">);</span>
     <span class="p">}</span>
 <span class="p">}</span>
+<span class="p">}</span>
 </pre></div>
 
 
-<p>}
-```</p>
 <h3 id="asn1-api-and-parsingdumping-facilities">Asn1 API and parsing/dumping facilities<a
class="headerlink" href="#asn1-api-and-parsingdumping-facilities" title="Permanent link">&para;</a></h3>
 <ul>
 <li>ASN1 dumping tool to help analyze ASN1 encoding stream or packet. It can be used
to exercise the framework with all kinds of testing binary inputs.</li>



Mime
View raw message