diff options
Diffstat (limited to 'OpenSSL/Timestamp/Request.html')
-rw-r--r-- | OpenSSL/Timestamp/Request.html | 834 |
1 files changed, 834 insertions, 0 deletions
diff --git a/OpenSSL/Timestamp/Request.html b/OpenSSL/Timestamp/Request.html new file mode 100644 index 00000000..42a8292f --- /dev/null +++ b/OpenSSL/Timestamp/Request.html @@ -0,0 +1,834 @@ +<!DOCTYPE html> + +<html> +<head> +<meta charset="UTF-8"> + +<title>class OpenSSL::Timestamp::Request - RDoc Documentation</title> + +<script type="text/javascript"> + var rdoc_rel_prefix = "../../"; + var index_rel_prefix = "../../"; +</script> + +<script src="../../js/navigation.js" defer></script> +<script src="../../js/search.js" defer></script> +<script src="../../js/search_index.js" defer></script> +<script src="../../js/searcher.js" defer></script> +<script src="../../js/darkfish.js" defer></script> + +<link href="../../css/fonts.css" rel="stylesheet"> +<link href="../../css/rdoc.css" rel="stylesheet"> + + + + +<body id="top" role="document" class="class"> +<nav role="navigation"> + <div id="project-navigation"> + <div id="home-section" role="region" title="Quick navigation" class="nav-section"> + <h2> + <a href="../../index.html" rel="home">Home</a> + </h2> + + <div id="table-of-contents-navigation"> + <a href="../../table_of_contents.html#pages">Pages</a> + <a href="../../table_of_contents.html#classes">Classes</a> + <a href="../../table_of_contents.html#methods">Methods</a> + </div> +</div> + + <div id="search-section" role="search" class="project-section initially-hidden"> + <form action="#" method="get" accept-charset="utf-8"> + <div id="search-field-wrapper"> + <input id="search-field" role="combobox" aria-label="Search" + aria-autocomplete="list" aria-controls="search-results" + type="text" name="search" placeholder="Search" spellcheck="false" + title="Type to search, Up and Down to navigate, Enter to load"> + </div> + + <ul id="search-results" aria-label="Search Results" + aria-busy="false" aria-expanded="false" + aria-atomic="false" class="initially-hidden"></ul> + </form> +</div> + + </div> + + + + <div id="class-metadata"> + + <div id="parent-class-section" class="nav-section"> + <h3>Parent</h3> + + + <p class="link">Object + +</div> + + + + <!-- Method Quickref --> +<div id="method-list-section" class="nav-section"> + <h3>Methods</h3> + + <ul class="link-list" role="directory"> + + <li ><a href="#method-c-new">::new</a> + + <li ><a href="#method-i-algorithm">#algorithm</a> + + <li ><a href="#method-i-algorithm-3D">#algorithm=</a> + + <li ><a href="#method-i-cert_requested-3D">#cert_requested=</a> + + <li ><a href="#method-i-cert_requested-3F">#cert_requested?</a> + + <li ><a href="#method-i-message_imprint">#message_imprint</a> + + <li ><a href="#method-i-message_imprint-3D">#message_imprint=</a> + + <li ><a href="#method-i-nonce">#nonce</a> + + <li ><a href="#method-i-nonce-3D">#nonce=</a> + + <li ><a href="#method-i-policy_id">#policy_id</a> + + <li ><a href="#method-i-policy_id-3D">#policy_id=</a> + + <li ><a href="#method-i-to_der">#to_der</a> + + <li ><a href="#method-i-version">#version</a> + + <li ><a href="#method-i-version-3D">#version=</a> + + </ul> +</div> + + </div> +</nav> + +<main role="main" aria-labelledby="class-OpenSSL::Timestamp::Request"> + <h1 id="class-OpenSSL::Timestamp::Request" class="class"> + class OpenSSL::Timestamp::Request + </h1> + + <section class="description"> + +<p>Allows to create timestamp requests or parse existing ones. A <a href="Request.html"><code>Request</code></a> is also needed for creating timestamps from scratch with <a href="Factory.html"><code>Factory</code></a>. When created from scratch, some default values are set:</p> +<ul><li> +<p>version is set to <code>1</code></p> +</li><li> +<p>cert_requested is set to <code>true</code></p> +</li><li> +<p>algorithm, <a href="Request.html#method-i-message_imprint"><code>message_imprint</code></a>, <a href="Request.html#method-i-policy_id"><code>policy_id</code></a>, and nonce are set to <code>false</code></p> +</li></ul> + + </section> + + + <section id="5Buntitled-5D" class="documentation-section"> + + + + + + + + + + <section id="public-class-5Buntitled-5D-method-details" class="method-section"> + <header> + <h3>Public Class Methods</h3> + </header> + + + <div id="method-c-new" class="method-detail "> + + + <div class="method-heading"> + <span class="method-callseq"> + OpenSSL::Timestamp::Request.new(file) → request + </span> + + <span class="method-click-advice">click to toggle source</span> + + </div> + + <div class="method-heading"> + <span class="method-callseq"> + OpenSSL::Timestamp::Request.new(string) → request + </span> + + </div> + + <div class="method-heading"> + <span class="method-callseq"> + OpenSSL::Timestamp::Request.new → empty request + </span> + + </div> + + + + <div class="method-description"> + + <p>When creating a <a href="Request.html"><code>Request</code></a> with the <code>File</code> or <code>string</code> parameter, the corresponding <code>File</code> or <code>string</code> must be DER-encoded.</p> + + + + + <div class="method-source-code" id="new-source"> + <pre>static VALUE +ossl_ts_req_initialize(int argc, VALUE *argv, VALUE self) +{ + TS_REQ *ts_req = DATA_PTR(self); + BIO *in; + VALUE arg; + + if(rb_scan_args(argc, argv, "01", &arg) == 0) { + return self; + } + + arg = ossl_to_der_if_possible(arg); + in = ossl_obj2bio(&arg); + ts_req = d2i_TS_REQ_bio(in, &ts_req); + BIO_free(in); + if (!ts_req) + ossl_raise(eTimestampError, "Error when decoding the timestamp request"); + DATA_PTR(self) = ts_req; + + return self; +}</pre> + </div> + + </div> + + + + + </div> + + + </section> + + <section id="public-instance-5Buntitled-5D-method-details" class="method-section"> + <header> + <h3>Public Instance Methods</h3> + </header> + + + <div id="method-i-algorithm" class="method-detail "> + + + <div class="method-heading"> + <span class="method-callseq"> + algorithm → string + </span> + + <span class="method-click-advice">click to toggle source</span> + + </div> + + + + <div class="method-description"> + + <p>Returns the 'short name' of the object identifier that represents the algorithm that was used to create the message imprint digest.</p> + + + + + <div class="method-source-code" id="algorithm-source"> + <pre>static VALUE +ossl_ts_req_get_algorithm(VALUE self) +{ + TS_REQ *req; + TS_MSG_IMPRINT *mi; + X509_ALGOR *algor; + + GetTSRequest(self, req); + mi = TS_REQ_get_msg_imprint(req); + algor = TS_MSG_IMPRINT_get_algo(mi); + return get_asn1obj(algor->algorithm); +}</pre> + </div> + + </div> + + + + + </div> + + + <div id="method-i-algorithm-3D" class="method-detail "> + + + <div class="method-heading"> + <span class="method-callseq"> + algorithm = "string" → string + </span> + + <span class="method-click-advice">click to toggle source</span> + + </div> + + + + <div class="method-description"> + + <p>Allows to set the object identifier or the 'short name' of the algorithm that was used to create the message imprint digest.</p> + +<h3 id="method-i-algorithm-3D-label-Example-3A">Example:<span><a href="#method-i-algorithm-3D-label-Example-3A">¶</a> <a href="#top">↑</a></span></h3> + +<pre class="ruby"><span class="ruby-identifier">request</span>.<span class="ruby-identifier">algorithm</span> = <span class="ruby-string">"SHA1"</span> +</pre> + + + + + <div class="method-source-code" id="algorithm-3D-source"> + <pre>static VALUE +ossl_ts_req_set_algorithm(VALUE self, VALUE algo) +{ + TS_REQ *req; + TS_MSG_IMPRINT *mi; + ASN1_OBJECT *obj; + X509_ALGOR *algor; + + GetTSRequest(self, req); + obj = obj_to_asn1obj(algo); + mi = TS_REQ_get_msg_imprint(req); + algor = TS_MSG_IMPRINT_get_algo(mi); + if (!X509_ALGOR_set0(algor, obj, V_ASN1_NULL, NULL)) { + ASN1_OBJECT_free(obj); + ossl_raise(eTimestampError, "X509_ALGOR_set0"); + } + + return algo; +}</pre> + </div> + + </div> + + + + + </div> + + + <div id="method-i-cert_requested-3D" class="method-detail "> + + + <div class="method-heading"> + <span class="method-callseq"> + cert_requested = boolean → true or false + </span> + + <span class="method-click-advice">click to toggle source</span> + + </div> + + + + <div class="method-description"> + + <p>Specify whether the response shall contain the timestamp authority's certificate or not. The default value is <code>true</code>.</p> + + + + + <div class="method-source-code" id="cert_requested-3D-source"> + <pre>static VALUE +ossl_ts_req_set_cert_requested(VALUE self, VALUE requested) +{ + TS_REQ *req; + + GetTSRequest(self, req); + TS_REQ_set_cert_req(req, RTEST(requested)); + + return requested; +}</pre> + </div> + + </div> + + + + + </div> + + + <div id="method-i-cert_requested-3F" class="method-detail "> + + + <div class="method-heading"> + <span class="method-callseq"> + cert_requested? → true or false + </span> + + <span class="method-click-advice">click to toggle source</span> + + </div> + + + + <div class="method-description"> + + <p>Indicates whether the response shall contain the timestamp authority's certificate or not.</p> + + + + + <div class="method-source-code" id="cert_requested-3F-source"> + <pre>static VALUE +ossl_ts_req_get_cert_requested(VALUE self) +{ + TS_REQ *req; + + GetTSRequest(self, req); + return TS_REQ_get_cert_req(req) ? Qtrue: Qfalse; +}</pre> + </div> + + </div> + + + + + </div> + + + <div id="method-i-message_imprint" class="method-detail "> + + + <div class="method-heading"> + <span class="method-callseq"> + message_imprint → string or nil + </span> + + <span class="method-click-advice">click to toggle source</span> + + </div> + + + + <div class="method-description"> + + <p>Returns the message imprint (digest) of the data to be timestamped.</p> + + + + + <div class="method-source-code" id="message_imprint-source"> + <pre>static VALUE +ossl_ts_req_get_msg_imprint(VALUE self) +{ + TS_REQ *req; + TS_MSG_IMPRINT *mi; + ASN1_OCTET_STRING *hashed_msg; + VALUE ret; + + GetTSRequest(self, req); + mi = TS_REQ_get_msg_imprint(req); + hashed_msg = TS_MSG_IMPRINT_get_msg(mi); + + ret = rb_str_new((const char *)hashed_msg->data, hashed_msg->length); + + return ret; +}</pre> + </div> + + </div> + + + + + </div> + + + <div id="method-i-message_imprint-3D" class="method-detail "> + + + <div class="method-heading"> + <span class="method-callseq"> + message_imprint = "string" → string + </span> + + <span class="method-click-advice">click to toggle source</span> + + </div> + + + + <div class="method-description"> + + <p>Set the message imprint digest.</p> + + + + + <div class="method-source-code" id="message_imprint-3D-source"> + <pre>static VALUE +ossl_ts_req_set_msg_imprint(VALUE self, VALUE hash) +{ + TS_REQ *req; + TS_MSG_IMPRINT *mi; + StringValue(hash); + + GetTSRequest(self, req); + mi = TS_REQ_get_msg_imprint(req); + if (!TS_MSG_IMPRINT_set_msg(mi, (unsigned char *)RSTRING_PTR(hash), RSTRING_LENINT(hash))) + ossl_raise(eTimestampError, "TS_MSG_IMPRINT_set_msg"); + + return hash; +}</pre> + </div> + + </div> + + + + + </div> + + + <div id="method-i-nonce" class="method-detail "> + + + <div class="method-heading"> + <span class="method-callseq"> + nonce → BN or nil + </span> + + <span class="method-click-advice">click to toggle source</span> + + </div> + + + + <div class="method-description"> + + <p>Returns the nonce (number used once) that the server shall include in its response.</p> + + + + + <div class="method-source-code" id="nonce-source"> + <pre>static VALUE +ossl_ts_req_get_nonce(VALUE self) +{ + TS_REQ *req; + const ASN1_INTEGER * nonce; + + GetTSRequest(self, req); + if (!(nonce = TS_REQ_get_nonce(req))) + return Qnil; + return asn1integer_to_num(nonce); +}</pre> + </div> + + </div> + + + + + </div> + + + <div id="method-i-nonce-3D" class="method-detail "> + + + <div class="method-heading"> + <span class="method-callseq"> + nonce = number → BN + </span> + + <span class="method-click-advice">click to toggle source</span> + + </div> + + + + <div class="method-description"> + + <p>Sets the nonce (number used once) that the server shall include in its response. If the nonce is set, the server must return the same nonce value in a valid <a href="Response.html"><code>Response</code></a>.</p> + + + + + <div class="method-source-code" id="nonce-3D-source"> + <pre>static VALUE +ossl_ts_req_set_nonce(VALUE self, VALUE num) +{ + TS_REQ *req; + ASN1_INTEGER *nonce; + int ok; + + GetTSRequest(self, req); + nonce = num_to_asn1integer(num, NULL); + ok = TS_REQ_set_nonce(req, nonce); + ASN1_INTEGER_free(nonce); + if (!ok) + ossl_raise(eTimestampError, NULL); + return num; +}</pre> + </div> + + </div> + + + + + </div> + + + <div id="method-i-policy_id" class="method-detail "> + + + <div class="method-heading"> + <span class="method-callseq"> + policy_id → string or nil + </span> + + <span class="method-click-advice">click to toggle source</span> + + </div> + + + + <div class="method-description"> + + <p>Returns the 'short name' of the object identifier that represents the timestamp policy under which the server shall create the timestamp.</p> + + + + + <div class="method-source-code" id="policy_id-source"> + <pre>static VALUE +ossl_ts_req_get_policy_id(VALUE self) +{ + TS_REQ *req; + + GetTSRequest(self, req); + if (!TS_REQ_get_policy_id(req)) + return Qnil; + return get_asn1obj(TS_REQ_get_policy_id(req)); +}</pre> + </div> + + </div> + + + + + </div> + + + <div id="method-i-policy_id-3D" class="method-detail "> + + + <div class="method-heading"> + <span class="method-callseq"> + policy_id = "string" → string + </span> + + <span class="method-click-advice">click to toggle source</span> + + </div> + + + + <div class="method-description"> + + <p>Allows to set the object identifier that represents the timestamp policy under which the server shall create the timestamp. This may be left <code>nil</code>, implying that the timestamp server will issue the timestamp using some default policy.</p> + +<h3 id="method-i-policy_id-3D-label-Example-3A">Example:<span><a href="#method-i-policy_id-3D-label-Example-3A">¶</a> <a href="#top">↑</a></span></h3> + +<pre class="ruby"><span class="ruby-identifier">request</span>.<span class="ruby-identifier">policy_id</span> = <span class="ruby-string">"1.2.3.4.5"</span> +</pre> + + + + + <div class="method-source-code" id="policy_id-3D-source"> + <pre>static VALUE +ossl_ts_req_set_policy_id(VALUE self, VALUE oid) +{ + TS_REQ *req; + ASN1_OBJECT *obj; + int ok; + + GetTSRequest(self, req); + obj = obj_to_asn1obj(oid); + ok = TS_REQ_set_policy_id(req, obj); + ASN1_OBJECT_free(obj); + if (!ok) + ossl_raise(eTimestampError, "TS_REQ_set_policy_id"); + + return oid; +}</pre> + </div> + + </div> + + + + + </div> + + + <div id="method-i-to_der" class="method-detail "> + + + <div class="method-heading"> + <span class="method-callseq"> + to_der → DER-encoded string + </span> + + <span class="method-click-advice">click to toggle source</span> + + </div> + + + + <div class="method-description"> + + <p>DER-encodes this <a href="Request.html"><code>Request</code></a>.</p> + + + + + <div class="method-source-code" id="to_der-source"> + <pre>static VALUE +ossl_ts_req_to_der(VALUE self) +{ + TS_REQ *req; + TS_MSG_IMPRINT *mi; + X509_ALGOR *algo; + ASN1_OCTET_STRING *hashed_msg; + + GetTSRequest(self, req); + mi = TS_REQ_get_msg_imprint(req); + + algo = TS_MSG_IMPRINT_get_algo(mi); + if (OBJ_obj2nid(algo->algorithm) == NID_undef) + ossl_raise(eTimestampError, "Message imprint missing algorithm"); + + hashed_msg = TS_MSG_IMPRINT_get_msg(mi); + if (!hashed_msg->length) + ossl_raise(eTimestampError, "Message imprint missing hashed message"); + + return asn1_to_der((void *)req, (int (*)(void *, unsigned char **))i2d_TS_REQ); +}</pre> + </div> + + </div> + + + + + </div> + + + <div id="method-i-version" class="method-detail "> + + + <div class="method-heading"> + <span class="method-callseq"> + version → Integer + </span> + + <span class="method-click-advice">click to toggle source</span> + + </div> + + + + <div class="method-description"> + + <p>Returns the version of this request. <code>1</code> is the default value.</p> + + + + + <div class="method-source-code" id="version-source"> + <pre>static VALUE +ossl_ts_req_get_version(VALUE self) +{ + TS_REQ *req; + + GetTSRequest(self, req); + return LONG2NUM(TS_REQ_get_version(req)); +}</pre> + </div> + + </div> + + + + + </div> + + + <div id="method-i-version-3D" class="method-detail "> + + + <div class="method-heading"> + <span class="method-callseq"> + version = number → Integer + </span> + + <span class="method-click-advice">click to toggle source</span> + + </div> + + + + <div class="method-description"> + + <p>Sets the version number for this <a href="Request.html"><code>Request</code></a>. This should be <code>1</code> for compliant servers.</p> + + + + + <div class="method-source-code" id="version-3D-source"> + <pre>static VALUE +ossl_ts_req_set_version(VALUE self, VALUE version) +{ + TS_REQ *req; + long ver; + + if ((ver = NUM2LONG(version)) < 0) + ossl_raise(eTimestampError, "version must be >= 0!"); + GetTSRequest(self, req); + if (!TS_REQ_set_version(req, ver)) + ossl_raise(eTimestampError, "TS_REQ_set_version"); + + return version; +}</pre> + </div> + + </div> + + + + + </div> + + + </section> + + </section> + +</main> + + +<footer id="validator-badges" role="contentinfo"> + <p><a href="https://validator.w3.org/check/referer">Validate</a> + <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.2.1. + <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>. +</footer> + |