doc/R509/Cert/Extensions/BasicConstraints.html in r509-0.9.2 vs doc/R509/Cert/Extensions/BasicConstraints.html in r509-0.10.0

- old
+ new

@@ -4,17 +4,17 @@ <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title> Class: R509::Cert::Extensions::BasicConstraints - &mdash; Documentation by YARD 0.8.5 + &mdash; Documentation by YARD 0.8.6.1 </title> - <link rel="stylesheet" href="../../../css/style.css" type="text/css" media="screen" charset="utf-8" /> + <link rel="stylesheet" href="../../../css/style.css" type="text/css" charset="utf-8" /> - <link rel="stylesheet" href="../../../css/common.css" type="text/css" media="screen" charset="utf-8" /> + <link rel="stylesheet" href="../../../css/common.css" type="text/css" charset="utf-8" /> <script type="text/javascript" charset="utf-8"> hasFrames = window.top.frames.main ? true : false; relpath = '../../../'; framesUrl = "../../../frames.html#!" + escape(window.location.href); @@ -94,22 +94,29 @@ <dt class="r2 last">Defined in:</dt> - <dd class="r2 last">lib/r509/cert/extensions.rb</dd> + <dd class="r2 last">lib/r509/cert/extensions/basic_constraints.rb</dd> </dl> <div class="clear"></div> <h2>Overview</h2><div class="docstring"> <div class="discussion"> -<p>Implements the BasicConstraints certificate extension, with methods to -provide access to the components and meaning of the extension's contents.</p> +<p>RFC 5280 Description (see: <a +href="http://www.ietf.org/rfc/rfc5280.txt">www.ietf.org/rfc/rfc5280.txt</a>)</p> +<p>The basic constraints extension identifies whether the subject of the +certificate is a CA and the maximum depth of valid certification paths that +include this certificate.</p> +<p>You can use this extension to parse an existing extension for easy access +to the contents or create a new one.</p> + + </div> </div> <div class="tags"> @@ -144,11 +151,11 @@ <ul class="summary"> <li class="public "> <span class="summary_signature"> - <a href="#path_length-instance_method" title="#path_length (instance method)">- (Object) <strong>path_length</strong> </a> + <a href="#path_length-instance_method" title="#path_length (instance method)">- (Integer<sup>?</sup>) <strong>path_length</strong> </a> </span> @@ -164,11 +171,11 @@ <span class="summary_desc"><div class='inline'> -<p>Returns the value of attribute path_length.</p> +<p>returns the path length (if present).</p> </div></span> </li> @@ -211,11 +218,11 @@ <li class="public "> <span class="summary_signature"> - <a href="#initialize-instance_method" title="#initialize (instance method)">- (BasicConstraints) <strong>initialize</strong>(*args) </a> + <a href="#initialize-instance_method" title="#initialize (instance method)">- (BasicConstraints) <strong>initialize</strong>(arg) </a> </span> @@ -228,11 +235,11 @@ <span class="summary_desc"><div class='inline'> -<p>See OpenSSL::X509::Extension#initialize.</p> +<p>This method takes a hash or an existing Extension object to parse.</p> </div></span> </li> @@ -251,89 +258,186 @@ + <span class="summary_desc"><div class='inline'> +<p>Check whether the extension value would make the parent certificate a CA.</p> +</div></span> + +</li> + + + <li class="public "> + <span class="summary_signature"> + + <a href="#to_h-instance_method" title="#to_h (instance method)">- (Hash) <strong>to_h</strong> </a> + + + + </span> + + + + + + + + + <span class="summary_desc"><div class='inline'></div></span> </li> + <li class="public "> + <span class="summary_signature"> + + <a href="#to_yaml-instance_method" title="#to_yaml (instance method)">- (YAML) <strong>to_yaml</strong> </a> + + + + </span> + + + + + + + + + + <span class="summary_desc"><div class='inline'></div></span> + +</li> + + </ul> <div id="constructor_details" class="method_details_list"> <h2>Constructor Details</h2> <div class="method_details first"> <h3 class="signature first" id="initialize-instance_method"> - - (<tt><span class='object_link'><a href="" title="R509::Cert::Extensions::BasicConstraints (class)">BasicConstraints</a></span></tt>) <strong>initialize</strong>(*args) + - (<tt><span class='object_link'><a href="" title="R509::Cert::Extensions::BasicConstraints (class)">BasicConstraints</a></span></tt>) <strong>initialize</strong>(arg) </h3><div class="docstring"> <div class="discussion"> -<p>See OpenSSL::X509::Extension#initialize</p> +<p>This method takes a hash or an existing Extension object to parse</p> </div> </div> <div class="tags"> + <p class="tag_title">Parameters:</p> +<ul class="param"> + <li> + + <span class='name'>arg</span> + + + <span class='type'>(<tt>Hash</tt>)</span> + + + + &mdash; + <div class='inline'> +<p>a customizable set of options</p> +</div> + + </li> + +</ul> + + + + <p class="tag_title">Options Hash (<tt>arg</tt>):</p> + <ul class="option"> + + <li> + <span class="name">:ca</span> + <span class="type">(<tt>Boolean</tt>)</span> + <span class="default"> + + </span> + + &mdash; <div class='inline'> +<p>The ca key is required and must be set to true (for an issuing CA) or false +(everything else).</p> +</div> + + </li> + + <li> + <span class="name">:path_length</span> + <span class="type">(<tt>Object</tt>)</span> + <span class="default"> + + </span> + + &mdash; <div class='inline'> +<p>optional [Integer] This option is only allowed if ca is set to TRUE. +path_length allows you to define the maximum number of non-self-issued +intermediate certificates that may follow this certificate in a valid +certification path. For example, if you set this value to 0 then the +certificate issued can only issue end entity certificates, not additional +subroots. This must be a non-negative integer (&gt;=0).</p> +</div> + + </li> + + <li> + <span class="name">:critical</span> + <span class="type">(<tt>Boolean</tt>)</span> + <span class="default"> + + &mdash; default: + <tt>true</tt> + + </span> + + </li> + + </ul> + + + </div><table class="source_code"> <tr> <td> <pre class="lines"> +28 +29 +30 +31 +32 33 34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51</pre> +35</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/r509/cert/extensions.rb', line 33</span> + <pre class="code"><span class="info file"># File 'lib/r509/cert/extensions/basic_constraints.rb', line 28</span> -<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span> - <span class='kw'>super</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span> - - <span class='id identifier rubyid_data'>data</span> <span class='op'>=</span> <span class='const'>R509</span><span class='op'>::</span><span class='const'>ASN1</span><span class='period'>.</span><span class='id identifier rubyid_get_extension_payload'>get_extension_payload</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span> - <span class='ivar'>@is_ca</span> <span class='op'>=</span> <span class='kw'>false</span> - <span class='comment'># BasicConstraints ::= SEQUENCE { -</span> <span class='comment'># cA BOOLEAN DEFAULT FALSE, -</span> <span class='comment'># pathLenConstraint INTEGER (0..MAX) OPTIONAL } -</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_entries'>entries</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_entry'>entry</span><span class='op'>|</span> - <span class='kw'>if</span> <span class='id identifier rubyid_entry'>entry</span><span class='period'>.</span><span class='id identifier rubyid_kind_of?'>kind_of?</span><span class='lparen'>(</span><span class='const'>OpenSSL</span><span class='op'>::</span><span class='const'>ASN1</span><span class='op'>::</span><span class='const'>Boolean</span><span class='rparen'>)</span> - <span class='comment'># since the boolean is optional it may not be present -</span> <span class='ivar'>@is_ca</span> <span class='op'>=</span> <span class='id identifier rubyid_entry'>entry</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span> - <span class='kw'>else</span> - <span class='comment'># There are only two kinds of entries permitted so anything -</span> <span class='comment'># else is an integer pathlength -</span> <span class='ivar'>@path_length</span> <span class='op'>=</span> <span class='id identifier rubyid_entry'>entry</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span> - <span class='kw'>end</span> +<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_arg'>arg</span><span class='rparen'>)</span> + <span class='kw'>if</span> <span class='kw'>not</span> <span class='const'>R509</span><span class='op'>::</span><span class='const'>Cert</span><span class='op'>::</span><span class='const'>Extensions</span><span class='period'>.</span><span class='id identifier rubyid_is_extension?'>is_extension?</span><span class='lparen'>(</span><span class='id identifier rubyid_arg'>arg</span><span class='rparen'>)</span> + <span class='id identifier rubyid_arg'>arg</span> <span class='op'>=</span> <span class='id identifier rubyid_build_extension'>build_extension</span><span class='lparen'>(</span><span class='id identifier rubyid_arg'>arg</span><span class='rparen'>)</span> <span class='kw'>end</span> + + <span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_arg'>arg</span><span class='rparen'>)</span> + <span class='id identifier rubyid_parse_extension'>parse_extension</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> @@ -346,39 +450,52 @@ <span id=""></span> <div class="method_details first"> <h3 class="signature first" id="path_length-instance_method"> - - (<tt>Object</tt>) <strong>path_length</strong> <span class="extras">(readonly)</span> + - (<tt>Integer</tt><sup>?</sup>) <strong>path_length</strong> <span class="extras">(readonly)</span> </h3><div class="docstring"> <div class="discussion"> -<p>Returns the value of attribute path_length</p> +<p>returns the path length (if present)</p> </div> </div> <div class="tags"> +<p class="tag_title">Returns:</p> +<ul class="return"> + + <li> + + + <span class='type'>(<tt>Integer</tt>, <tt>nil</tt>)</span> + + + + </li> + +</ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> -30 -31 -32</pre> +22 +23 +24</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/r509/cert/extensions.rb', line 30</span> + <pre class="code"><span class="info file"># File 'lib/r509/cert/extensions/basic_constraints.rb', line 22</span> <span class='kw'>def</span> <span class='id identifier rubyid_path_length'>path_length</span> <span class='ivar'>@path_length</span> <span class='kw'>end</span></pre> </td> @@ -432,20 +549,22 @@ <tr> <td> <pre class="lines"> -60 -61 -62 -63</pre> +47 +48 +49 +50 +51</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/r509/cert/extensions.rb', line 60</span> + <pre class="code"><span class="info file"># File 'lib/r509/cert/extensions/basic_constraints.rb', line 47</span> -<span class='kw'>def</span> <span class='id identifier rubyid_allows_sub_ca?'>allows_sub_ca?</span><span class='lparen'>(</span><span class='rparen'>)</span> - <span class='kw'>return</span> <span class='kw'>false</span> <span class='kw'>if</span> <span class='ivar'>@path_length</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> +<span class='kw'>def</span> <span class='id identifier rubyid_allows_sub_ca?'>allows_sub_ca?</span> + <span class='kw'>return</span> <span class='kw'>false</span> <span class='kw'>unless</span> <span class='id identifier rubyid_is_ca?'>is_ca?</span> + <span class='kw'>return</span> <span class='kw'>true</span> <span class='kw'>if</span> <span class='ivar'>@path_length</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='kw'>return</span> <span class='ivar'>@path_length</span> <span class='op'>&gt;</span> <span class='int'>0</span> <span class='kw'>end</span></pre> </td> </tr> </table> @@ -461,11 +580,13 @@ </h3><div class="docstring"> <div class="discussion"> +<p>Check whether the extension value would make the parent certificate a CA</p> + </div> </div> <div class="tags"> <p class="tag_title">Returns:</p> @@ -486,32 +607,140 @@ <tr> <td> <pre class="lines"> -53 -54 -55</pre> +39 +40 +41</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/r509/cert/extensions.rb', line 53</span> + <pre class="code"><span class="info file"># File 'lib/r509/cert/extensions/basic_constraints.rb', line 39</span> -<span class='kw'>def</span> <span class='id identifier rubyid_is_ca?'>is_ca?</span><span class='lparen'>(</span><span class='rparen'>)</span> +<span class='kw'>def</span> <span class='id identifier rubyid_is_ca?'>is_ca?</span> <span class='kw'>return</span> <span class='ivar'>@is_ca</span> <span class='op'>==</span> <span class='kw'>true</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> + <div class="method_details "> + <h3 class="signature " id="to_h-instance_method"> + + - (<tt>Hash</tt>) <strong>to_h</strong> + + + + + +</h3><div class="docstring"> + <div class="discussion"> + + </div> +</div> +<div class="tags"> + +<p class="tag_title">Returns:</p> +<ul class="return"> + + <li> + + + <span class='type'>(<tt>Hash</tt>)</span> + + + + </li> + +</ul> +</div><table class="source_code"> + <tr> + <td> + <pre class="lines"> + + +54 +55 +56 +57 +58</pre> + </td> + <td> + <pre class="code"><span class="info file"># File 'lib/r509/cert/extensions/basic_constraints.rb', line 54</span> + +<span class='kw'>def</span> <span class='id identifier rubyid_to_h'>to_h</span> + <span class='id identifier rubyid_hash'>hash</span> <span class='op'>=</span> <span class='lbrace'>{</span> <span class='symbol'>:ca</span> <span class='op'>=&gt;</span> <span class='ivar'>@is_ca</span><span class='comma'>,</span> <span class='symbol'>:critical</span> <span class='op'>=&gt;</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_critical?'>critical?</span> <span class='rbrace'>}</span> + <span class='id identifier rubyid_hash'>hash</span><span class='lbracket'>[</span><span class='symbol'>:path_length</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='ivar'>@path_length</span> <span class='kw'>unless</span> <span class='ivar'>@path_length</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='kw'>or</span> <span class='kw'>not</span> <span class='id identifier rubyid_is_ca?'>is_ca?</span> + <span class='id identifier rubyid_hash'>hash</span> +<span class='kw'>end</span></pre> + </td> + </tr> +</table> </div> + + <div class="method_details "> + <h3 class="signature " id="to_yaml-instance_method"> + + - (<tt>YAML</tt>) <strong>to_yaml</strong> + + + + +</h3><div class="docstring"> + <div class="discussion"> + + + </div> +</div> +<div class="tags"> + +<p class="tag_title">Returns:</p> +<ul class="return"> + + <li> + + + <span class='type'>(<tt>YAML</tt>)</span> + + + + </li> + +</ul> + +</div><table class="source_code"> + <tr> + <td> + <pre class="lines"> + + +61 +62 +63</pre> + </td> + <td> + <pre class="code"><span class="info file"># File 'lib/r509/cert/extensions/basic_constraints.rb', line 61</span> + +<span class='kw'>def</span> <span class='id identifier rubyid_to_yaml'>to_yaml</span> + <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_to_h'>to_h</span><span class='period'>.</span><span class='id identifier rubyid_to_yaml'>to_yaml</span> +<span class='kw'>end</span></pre> + </td> + </tr> +</table> +</div> + + </div> + +</div> + <div id="footer"> - Generated on Tue Apr 23 10:46:06 2013 by + Generated on Sun Jan 26 13:37:28 2014 by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> - 0.8.5 (ruby-1.9.3). + 0.8.6.1 (ruby-2.0.0). </div> </body> </html> \ No newline at end of file