Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding more details to the seed PKCS#11 HSM documentation #74

Merged
merged 2 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 47 additions & 2 deletions content/eaas/pkcs11/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,46 @@ There are four components to the architecture diagram above.

## Building Client Application

### Step 1: Update your client application to download Qrypt's quantum entropy
The following steps are a guide to develop your own client application that can inject Qrypt's quantum entropy into a PKCS#11 compliant HSM.

### Step 1: Setup PKCS#11 HSM

Follow the setup guide provided by your HSM vendor.

First, create a PKCS#11 token with a PIN for a slot. The slot number and PIN will be needed for the next step.

### Step 2: Update your client application to open and login to a PKCS#11 session

Sample code in C++ is shown below.

```c++
CK_SESSION_HANDLE open_session(CK_SLOT_ID slot_id) {
CK_SESSION_HANDLE session;
CK_RV rv = C_OpenSession(slot_id, CKF_SERIAL_SESSION, NULL, NULL, &session);
if (rv != CKR_OK) {
std::string error_msg = "C_OpenSession error: " + std::to_string(rv) + "\n";
throw std::runtime_error(error_msg);
}
return session;
}

void login_session(CK_SESSION_HANDLE session, CK_UTF8CHAR_PTR pin) {
CK_RV rv = C_Login(session, CKU_USER, pin, strlen((char*)pin));
if (rv != CKR_OK) {
std::string error_msg = "C_Login error: " + std::to_string(rv) + "\n";
throw std::runtime_error(error_msg);
}
}
```

### Step 3: Update your client application to download Qrypt's quantum entropy
A REST API can be called for entropy download. More information about the REST API can be found in the [Submit a request for entropy]({{< ref "/eaas#submit-a-request-for-entropy" >}}) section under 'Quantum Entropy'. You will need a library that can perform HTTPS requests.

C++ sample code using libcurl is provided in the [Quickstart](https://github.com/QryptInc/qrypt-security-quickstarts-cpp/blob/main/src/eaas.cpp). We recommend using environment variables to pass the Qrypt Token into the application.

Requests to the entropy API can only be performed in units of KiB. As a result, there may be random usage inefficiencies. Developers can choose to implement their own buffer management locally for better random utilization.

### Step 2: Update your client application to call C_SeedRandom
### Step 4: Update your client application to call C_SeedRandom

Sample code in C++ is shown below.

Expand All @@ -52,6 +84,19 @@ void set_seed_random(CK_SESSION_HANDLE session, CK_BYTE_PTR seed_random) {
}
```

### Step 5: Update your client application to close the PKCS#11 session

Sample code in C++ is shown below.

```c++
void close_session(CK_SESSION_HANDLE session) {
C_Logout(session);
C_CloseSession(session);
}
```

### References

More information about the PKCS#11 Cryptoki interface can be found at [Oasis PKCS#11 Specification](https://docs.oasis-open.org/pkcs11/pkcs11-base/v2.40/os/pkcs11-base-v2.40-os.html).

Click [here](https://github.com/QryptInc/qseed) for a complete working example client application.
16 changes: 8 additions & 8 deletions docs/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
<title>404 Page not found</title>


<link href="./css/nucleus.css?1704227666" rel="stylesheet">
<link href="./css/fontawesome-all.min.css?1704227666" rel="stylesheet">
<link href="./css/hybrid.css?1704227666" rel="stylesheet">
<link href="./css/featherlight.min.css?1704227666" rel="stylesheet">
<link href="./css/perfect-scrollbar.min.css?1704227666" rel="stylesheet">
<link href="./css/theme.css?1704227666" rel="stylesheet">
<link href="./css/hugo-theme.css?1704227666" rel="stylesheet">
<link href="./css/nucleus.css?1706292135" rel="stylesheet">
<link href="./css/fontawesome-all.min.css?1706292135" rel="stylesheet">
<link href="./css/hybrid.css?1706292135" rel="stylesheet">
<link href="./css/featherlight.min.css?1706292135" rel="stylesheet">
<link href="./css/perfect-scrollbar.min.css?1706292135" rel="stylesheet">
<link href="./css/theme.css?1706292135" rel="stylesheet">
<link href="./css/hugo-theme.css?1706292135" rel="stylesheet">

<link href="./css/theme-mine.css?1704227666" rel="stylesheet">
<link href="./css/theme-mine.css?1706292135" rel="stylesheet">

<style>
:root #header + #content > #left > #rlblock_left {
Expand Down
50 changes: 25 additions & 25 deletions docs/categories/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@
<title>Categories :: Qrypt</title>


<link href="../css/nucleus.css?1704227666" rel="stylesheet">
<link href="../css/fontawesome-all.min.css?1704227666" rel="stylesheet">
<link href="../css/hybrid.css?1704227666" rel="stylesheet">
<link href="../css/featherlight.min.css?1704227666" rel="stylesheet">
<link href="../css/perfect-scrollbar.min.css?1704227666" rel="stylesheet">
<link href="../css/auto-complete.css?1704227666" rel="stylesheet">
<link href="../css/atom-one-dark-reasonable.css?1704227666" rel="stylesheet">
<link href="../css/theme.css?1704227666" rel="stylesheet">
<link href="../css/tabs.css?1704227666" rel="stylesheet">
<link href="../css/hugo-theme.css?1704227666" rel="stylesheet">
<link href="../css/nucleus.css?1706292135" rel="stylesheet">
<link href="../css/fontawesome-all.min.css?1706292135" rel="stylesheet">
<link href="../css/hybrid.css?1706292135" rel="stylesheet">
<link href="../css/featherlight.min.css?1706292135" rel="stylesheet">
<link href="../css/perfect-scrollbar.min.css?1706292135" rel="stylesheet">
<link href="../css/auto-complete.css?1706292135" rel="stylesheet">
<link href="../css/atom-one-dark-reasonable.css?1706292135" rel="stylesheet">
<link href="../css/theme.css?1706292135" rel="stylesheet">
<link href="../css/tabs.css?1706292135" rel="stylesheet">
<link href="../css/hugo-theme.css?1706292135" rel="stylesheet">

<link href="../css/theme-mine.css?1704227666" rel="stylesheet">
<link href="../css/theme-mine.css?1706292135" rel="stylesheet">



<script src="../js/jquery-3.3.1.min.js?1704227666"></script>
<script src="../js/jquery-3.3.1.min.js?1706292135"></script>


</head>
Expand All @@ -49,14 +49,14 @@

</div>

<script type="text/javascript" src="../js/lunr.min.js?1704227666"></script>
<script type="text/javascript" src="../js/auto-complete.js?1704227666"></script>
<script type="text/javascript" src="../js/lunr.min.js?1706292135"></script>
<script type="text/javascript" src="../js/auto-complete.js?1706292135"></script>
<script type="text/javascript">

var baseurl = "https:\/\/QryptInc.github.io";

</script>
<script type="text/javascript" src="../js/search.js?1704227666"></script>
<script type="text/javascript" src="../js/search.js?1706292135"></script>

</div>

Expand Down Expand Up @@ -784,19 +784,19 @@ <h1>
<div style="left: -1000px; overflow: scroll; position: absolute; top: -1000px; border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;">
<div style="border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;"></div>
</div>
<script src="../js/clipboard.min.js?1704227666"></script>
<script src="../js/perfect-scrollbar.min.js?1704227666"></script>
<script src="../js/perfect-scrollbar.jquery.min.js?1704227666"></script>
<script src="../js/jquery.sticky.js?1704227666"></script>
<script src="../js/featherlight.min.js?1704227666"></script>
<script src="../js/highlight.pack.js?1704227666"></script>
<script src="../js/clipboard.min.js?1706292135"></script>
<script src="../js/perfect-scrollbar.min.js?1706292135"></script>
<script src="../js/perfect-scrollbar.jquery.min.js?1706292135"></script>
<script src="../js/jquery.sticky.js?1706292135"></script>
<script src="../js/featherlight.min.js?1706292135"></script>
<script src="../js/highlight.pack.js?1706292135"></script>
<script>hljs.initHighlightingOnLoad();</script>
<script src="../js/modernizr.custom-3.6.0.js?1704227666"></script>
<script src="../js/learn.js?1704227666"></script>
<script src="../js/hugo-learn.js?1704227666"></script>
<script src="../js/modernizr.custom-3.6.0.js?1706292135"></script>
<script src="../js/learn.js?1706292135"></script>
<script src="../js/hugo-learn.js?1706292135"></script>


<script src="../mermaid/mermaid.js?1704227666"></script>
<script src="../mermaid/mermaid.js?1706292135"></script>

<script>
mermaid.initialize({ startOnLoad: true });
Expand Down
50 changes: 25 additions & 25 deletions docs/concepts/entropy-projection/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@
<title>Key Entropy Size :: Qrypt</title>


<link href="../../css/nucleus.css?1704227666" rel="stylesheet">
<link href="../../css/fontawesome-all.min.css?1704227666" rel="stylesheet">
<link href="../../css/hybrid.css?1704227666" rel="stylesheet">
<link href="../../css/featherlight.min.css?1704227666" rel="stylesheet">
<link href="../../css/perfect-scrollbar.min.css?1704227666" rel="stylesheet">
<link href="../../css/auto-complete.css?1704227666" rel="stylesheet">
<link href="../../css/atom-one-dark-reasonable.css?1704227666" rel="stylesheet">
<link href="../../css/theme.css?1704227666" rel="stylesheet">
<link href="../../css/tabs.css?1704227666" rel="stylesheet">
<link href="../../css/hugo-theme.css?1704227666" rel="stylesheet">
<link href="../../css/nucleus.css?1706292135" rel="stylesheet">
<link href="../../css/fontawesome-all.min.css?1706292135" rel="stylesheet">
<link href="../../css/hybrid.css?1706292135" rel="stylesheet">
<link href="../../css/featherlight.min.css?1706292135" rel="stylesheet">
<link href="../../css/perfect-scrollbar.min.css?1706292135" rel="stylesheet">
<link href="../../css/auto-complete.css?1706292135" rel="stylesheet">
<link href="../../css/atom-one-dark-reasonable.css?1706292135" rel="stylesheet">
<link href="../../css/theme.css?1706292135" rel="stylesheet">
<link href="../../css/tabs.css?1706292135" rel="stylesheet">
<link href="../../css/hugo-theme.css?1706292135" rel="stylesheet">

<link href="../../css/theme-mine.css?1704227666" rel="stylesheet">
<link href="../../css/theme-mine.css?1706292135" rel="stylesheet">



<script src="../../js/jquery-3.3.1.min.js?1704227666"></script>
<script src="../../js/jquery-3.3.1.min.js?1706292135"></script>


</head>
Expand All @@ -49,14 +49,14 @@

</div>

<script type="text/javascript" src="../../js/lunr.min.js?1704227666"></script>
<script type="text/javascript" src="../../js/auto-complete.js?1704227666"></script>
<script type="text/javascript" src="../../js/lunr.min.js?1706292135"></script>
<script type="text/javascript" src="../../js/auto-complete.js?1706292135"></script>
<script type="text/javascript">

var baseurl = "https:\/\/QryptInc.github.io";

</script>
<script type="text/javascript" src="../../js/search.js?1704227666"></script>
<script type="text/javascript" src="../../js/search.js?1706292135"></script>

</div>

Expand Down Expand Up @@ -913,19 +913,19 @@ <h2 id="formula">Formula</h2>
<div style="left: -1000px; overflow: scroll; position: absolute; top: -1000px; border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;">
<div style="border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;"></div>
</div>
<script src="../../js/clipboard.min.js?1704227666"></script>
<script src="../../js/perfect-scrollbar.min.js?1704227666"></script>
<script src="../../js/perfect-scrollbar.jquery.min.js?1704227666"></script>
<script src="../../js/jquery.sticky.js?1704227666"></script>
<script src="../../js/featherlight.min.js?1704227666"></script>
<script src="../../js/highlight.pack.js?1704227666"></script>
<script src="../../js/clipboard.min.js?1706292135"></script>
<script src="../../js/perfect-scrollbar.min.js?1706292135"></script>
<script src="../../js/perfect-scrollbar.jquery.min.js?1706292135"></script>
<script src="../../js/jquery.sticky.js?1706292135"></script>
<script src="../../js/featherlight.min.js?1706292135"></script>
<script src="../../js/highlight.pack.js?1706292135"></script>
<script>hljs.initHighlightingOnLoad();</script>
<script src="../../js/modernizr.custom-3.6.0.js?1704227666"></script>
<script src="../../js/learn.js?1704227666"></script>
<script src="../../js/hugo-learn.js?1704227666"></script>
<script src="../../js/modernizr.custom-3.6.0.js?1706292135"></script>
<script src="../../js/learn.js?1706292135"></script>
<script src="../../js/hugo-learn.js?1706292135"></script>


<script src="../../mermaid/mermaid.js?1704227666"></script>
<script src="../../mermaid/mermaid.js?1706292135"></script>

<script>
mermaid.initialize({ startOnLoad: true });
Expand Down
50 changes: 25 additions & 25 deletions docs/concepts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@
<title>Concepts :: Qrypt</title>


<link href="../css/nucleus.css?1704227666" rel="stylesheet">
<link href="../css/fontawesome-all.min.css?1704227666" rel="stylesheet">
<link href="../css/hybrid.css?1704227666" rel="stylesheet">
<link href="../css/featherlight.min.css?1704227666" rel="stylesheet">
<link href="../css/perfect-scrollbar.min.css?1704227666" rel="stylesheet">
<link href="../css/auto-complete.css?1704227666" rel="stylesheet">
<link href="../css/atom-one-dark-reasonable.css?1704227666" rel="stylesheet">
<link href="../css/theme.css?1704227666" rel="stylesheet">
<link href="../css/tabs.css?1704227666" rel="stylesheet">
<link href="../css/hugo-theme.css?1704227666" rel="stylesheet">
<link href="../css/nucleus.css?1706292135" rel="stylesheet">
<link href="../css/fontawesome-all.min.css?1706292135" rel="stylesheet">
<link href="../css/hybrid.css?1706292135" rel="stylesheet">
<link href="../css/featherlight.min.css?1706292135" rel="stylesheet">
<link href="../css/perfect-scrollbar.min.css?1706292135" rel="stylesheet">
<link href="../css/auto-complete.css?1706292135" rel="stylesheet">
<link href="../css/atom-one-dark-reasonable.css?1706292135" rel="stylesheet">
<link href="../css/theme.css?1706292135" rel="stylesheet">
<link href="../css/tabs.css?1706292135" rel="stylesheet">
<link href="../css/hugo-theme.css?1706292135" rel="stylesheet">

<link href="../css/theme-mine.css?1704227666" rel="stylesheet">
<link href="../css/theme-mine.css?1706292135" rel="stylesheet">



<script src="../js/jquery-3.3.1.min.js?1704227666"></script>
<script src="../js/jquery-3.3.1.min.js?1706292135"></script>


</head>
Expand All @@ -49,14 +49,14 @@

</div>

<script type="text/javascript" src="../js/lunr.min.js?1704227666"></script>
<script type="text/javascript" src="../js/auto-complete.js?1704227666"></script>
<script type="text/javascript" src="../js/lunr.min.js?1706292135"></script>
<script type="text/javascript" src="../js/auto-complete.js?1706292135"></script>
<script type="text/javascript">

var baseurl = "https:\/\/QryptInc.github.io";

</script>
<script type="text/javascript" src="../js/search.js?1704227666"></script>
<script type="text/javascript" src="../js/search.js?1706292135"></script>

</div>

Expand Down Expand Up @@ -791,19 +791,19 @@ <h2 id="one-time-pad-otpotp"><a href="otp/">One-Time Pad (OTP)</a></h2>
<div style="left: -1000px; overflow: scroll; position: absolute; top: -1000px; border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;">
<div style="border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;"></div>
</div>
<script src="../js/clipboard.min.js?1704227666"></script>
<script src="../js/perfect-scrollbar.min.js?1704227666"></script>
<script src="../js/perfect-scrollbar.jquery.min.js?1704227666"></script>
<script src="../js/jquery.sticky.js?1704227666"></script>
<script src="../js/featherlight.min.js?1704227666"></script>
<script src="../js/highlight.pack.js?1704227666"></script>
<script src="../js/clipboard.min.js?1706292135"></script>
<script src="../js/perfect-scrollbar.min.js?1706292135"></script>
<script src="../js/perfect-scrollbar.jquery.min.js?1706292135"></script>
<script src="../js/jquery.sticky.js?1706292135"></script>
<script src="../js/featherlight.min.js?1706292135"></script>
<script src="../js/highlight.pack.js?1706292135"></script>
<script>hljs.initHighlightingOnLoad();</script>
<script src="../js/modernizr.custom-3.6.0.js?1704227666"></script>
<script src="../js/learn.js?1704227666"></script>
<script src="../js/hugo-learn.js?1704227666"></script>
<script src="../js/modernizr.custom-3.6.0.js?1706292135"></script>
<script src="../js/learn.js?1706292135"></script>
<script src="../js/hugo-learn.js?1706292135"></script>


<script src="../mermaid/mermaid.js?1704227666"></script>
<script src="../mermaid/mermaid.js?1706292135"></script>

<script>
mermaid.initialize({ startOnLoad: true });
Expand Down
Loading
Loading