<div dir="ltr"><div><div>Thank you for the information. I still don't see where in the code that any of these `ck` checks are enforced though. For example, who enforces `ck7` on a P11ECPrivateKeyObj, so that a sensitive key cannot be revealed?<br><br></div>Thank you,<br></div>-Dave<br></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Oct 12, 2017 at 11:09 AM Rickard Bellgrim <<a href="mailto:rickard@opendnssec.org">rickard@opendnssec.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Dave<div><br></div><div>The checks comes from PKCS#11 [1] and is enforced according to it. You can cross-reference all the attributes with PKCS#11.</div><div><br></div><div>ck1 is set for CKA_CLASS [2], but CKA_TOKEN is an optional attribute that will default to CK_FALSE and is not required when creating an object.</div><div><br></div><div><span style="font-size:12.800000190734863px">CKA_CERTIFICATE_TYPE is only used by certificate object and will not be required for key objects. You can check how the attributes are used in P11Objects.cpp [3] and also in the PKCS#11 standard.</span><br></div><div><br></div><div>[1] <a href="http://docs.oasis-open.org/pkcs11/pkcs11-base/v2.40/os/pkcs11-base-v2.40-os.html" target="_blank">http://docs.oasis-open.org/pkcs11/pkcs11-base/v2.40/os/pkcs11-base-v2.40-os.html</a></div><div>[2] <a href="https://github.com/opendnssec/SoftHSMv2/blob/develop/src/lib/P11Attributes.h#L140" target="_blank">https://github.com/opendnssec/SoftHSMv2/blob/develop/src/lib/P11Attributes.h#L140</a></div><div>[3] <a href="https://github.com/opendnssec/SoftHSMv2/blob/develop/src/lib/P11Objects.cpp" target="_blank">https://github.com/opendnssec/SoftHSMv2/blob/develop/src/lib/P11Objects.cpp</a></div><div><br></div><div>// Rickard</div></div><div class="gmail_extra"><br><div class="gmail_quote"></div></div><div class="gmail_extra"><div class="gmail_quote">On Wed, Oct 11, 2017 at 11:34 PM, Dave Fine <span dir="ltr"><<a href="mailto:finerrecliner@gmail.com" target="_blank">finerrecliner@gmail.com</a>></span> wrote:<br></div></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div>Hello,<br><br></div>I have a question regarding <span class="m_2527448676167439102m_-4499064503073541598inbox-inbox-separator"></span>P11Attributes.h the SoftHSMv2 code base. In this file, there is an enum that defines a number of `ck` checks. As an example, ck1 seems to be reserved for when an attribute is required while creating an object. Therefore, I would expect ck1 to be set on P11Attribute child classes such as <span class="m_2527448676167439102m_-4499064503073541598inbox-inbox-pl-en">P11AttrClass</span>, and <span class="m_2527448676167439102m_-4499064503073541598inbox-inbox-pl-en">P11AttrToken</span> (to enforce requiring CKA_CLASS and CKA_TOKEN). However, I see that ck1 is not used for P11AttrToken. Instead I see <span class="m_2527448676167439102m_-4499064503073541598inbox-inbox-pl-en">P11AttrCertificateType uses a ck1 check, which is not something I would think be required when creating an object. For example, why would CKA_CERTIFICATE_TYPE be required, if you were creating a key object? <br><br></span></div><span class="m_2527448676167439102m_-4499064503073541598inbox-inbox-pl-en">Could someone clear up how the `ck` checks are supposed to be used? Perhaps I am not understanding it correctly. <br><br></span></div><span class="m_2527448676167439102m_-4499064503073541598inbox-inbox-pl-en">Thank you,<br></span></div><span class="m_2527448676167439102m_-4499064503073541598inbox-inbox-pl-en">-Dave<br> </span> 

</div>
<br></blockquote></div></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">_______________________________________________<br>
Opendnssec-user mailing list<br>
<a href="mailto:Opendnssec-user@lists.opendnssec.org" target="_blank">Opendnssec-user@lists.opendnssec.org</a><br>
<a href="https://lists.opendnssec.org/mailman/listinfo/opendnssec-user" rel="noreferrer" target="_blank">https://lists.opendnssec.org/mailman/listinfo/opendnssec-user</a><br>
<br></blockquote></div><br></div>
</blockquote></div>