Files
google-apis-rs/rustls/trait.KeyLog.html
2021-04-02 00:20:57 +08:00

42 lines
12 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `KeyLog` trait in crate `rustls`."><meta name="keywords" content="rust, rustlang, rust-lang, KeyLog"><title>rustls::KeyLog - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../ayu.css" disabled ><script id="default-settings"></script><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../favicon.svg">
<link rel="alternate icon" type="image/png" href="../favicon-16x16.png">
<link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc trait"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../rustls/index.html'><div class='logo-container rust-logo'><img src='../rust-logo.png' alt='logo'></div></a><p class="location">Trait KeyLog</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#required-methods">Required Methods</a><div class="sidebar-links"><a href="#tymethod.log">log</a></div><a class="sidebar-title" href="#provided-methods">Provided Methods</a><div class="sidebar-links"><a href="#method.will_log">will_log</a></div><a class="sidebar-title" href="#implementors">Implementors</a></div><p class="location"><a href="index.html">rustls</a></p><div id="sidebar-vars" data-name="KeyLog" data-ty="trait" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><button type="button" class="help-button">?</button>
<a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Trait <a href="index.html">rustls</a>::<wbr><a class="trait" href="">KeyLog</a></span><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span><a class="srclink" href="../src/rustls/keylog.rs.html#23-54" title="goto source code">[src]</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class="rust trait">pub trait KeyLog: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> {
fn <a href="#tymethod.log" class="fnname">log</a>(&amp;self, label: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, client_random: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, secret: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>);
fn <a href="#method.will_log" class="fnname">will_log</a>(&amp;self, _label: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a> { ... }
}</pre></div><div class="docblock"><p>This trait represents the ability to do something useful
with key material, such as logging it to a file for debugging.</p>
<p>Naturally, secrets passed over the interface are <em>extremely</em>
sensitive and can break the security of past, present and
future sessions.</p>
<p>You'll likely want some interior mutability in your
implementation to make this useful.</p>
<p>See <code>KeyLogFile</code> that implements the standard <code>SSLKEYLOGFILE</code>
environment variable behaviour.</p>
</div><h2 id="required-methods" class="small-section-header">Required methods<a href="#required-methods" class="anchor"></a></h2><div class="methods"><h3 id="tymethod.log" class="method"><code>fn <a href="#tymethod.log" class="fnname">log</a>(&amp;self, label: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, client_random: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, secret: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>)</code><a class="srclink" href="../src/rustls/keylog.rs.html#44" title="goto source code">[src]</a></h3><div class="docblock"><p>Log the given <code>secret</code>. <code>client_random</code> is provided for
session identification. <code>label</code> describes precisely what
<code>secret</code> means:</p>
<ul>
<li><code>CLIENT_RANDOM</code>: <code>secret</code> is the master secret for a TLSv1.2 session.</li>
<li><code>CLIENT_EARLY_TRAFFIC_SECRET</code>: <code>secret</code> encrypts early data
transmitted by a client</li>
<li><code>SERVER_HANDSHAKE_TRAFFIC_SECRET</code>: <code>secret</code> encrypts
handshake messages from the server during a TLSv1.3 handshake.</li>
<li><code>CLIENT_HANDSHAKE_TRAFFIC_SECRET</code>: <code>secret</code> encrypts
handshake messages from the client during a TLSv1.3 handshake.</li>
<li><code>SERVER_TRAFFIC_SECRET_0</code>: <code>secret</code> encrypts post-handshake data
from the server in a TLSv1.3 session.</li>
<li><code>CLIENT_TRAFFIC_SECRET_0</code>: <code>secret</code> encrypts post-handshake data
from the client in a TLSv1.3 session.</li>
<li><code>EXPORTER_SECRET</code>: <code>secret</code> is the post-handshake exporter secret
in a TLSv1.3 session.</li>
</ul>
<p>These strings are selected to match the NSS key log format:
https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS/Key_Log_Format</p>
</div></div><span class="loading-content">Loading content...</span><h2 id="provided-methods" class="small-section-header">Provided methods<a href="#provided-methods" class="anchor"></a></h2><div class="methods"><h3 id="method.will_log" class="method"><code>fn <a href="#method.will_log" class="fnname">will_log</a>(&amp;self, _label: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><a class="srclink" href="../src/rustls/keylog.rs.html#51-53" title="goto source code">[src]</a></h3><div class="docblock"><p>Indicates whether the secret with label <code>label</code> will be logged.</p>
<p>If <code>will_log</code> returns true then <code>log</code> will be called with the secret.
Otherwise, <code>log</code> will not be called for the secret. This is a
performance optimization.</p>
</div></div><span class="loading-content">Loading content...</span><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor"></a></h2><div class="item-list" id="implementors-list"><h3 id="impl-KeyLog" class="impl"><code class="in-band">impl KeyLog for <a class="struct" href="../rustls/struct.KeyLogFile.html" title="struct rustls::KeyLogFile">KeyLogFile</a></code><a href="#impl-KeyLog" class="anchor"></a><a class="srclink" href="../src/rustls/keylog.rs.html#146-161" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.log" class="method hidden"><code>fn <a href="#method.log" class="fnname">log</a>(&amp;self, label: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, client_random: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, secret: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>)</code><a class="srclink" href="../src/rustls/keylog.rs.html#147-160" title="goto source code">[src]</a></h4></div><h3 id="impl-KeyLog-1" class="impl"><code class="in-band">impl KeyLog for <a class="struct" href="../rustls/struct.NoKeyLog.html" title="struct rustls::NoKeyLog">NoKeyLog</a></code><a href="#impl-KeyLog-1" class="anchor"></a><a class="srclink" href="../src/rustls/keylog.rs.html#59-65" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.log-1" class="method hidden"><code>fn <a href="#method.log-1" class="fnname">log</a>(&amp;self, _: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, _: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, _: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>)</code><a class="srclink" href="../src/rustls/keylog.rs.html#60" title="goto source code">[src]</a></h4><h4 id="method.will_log-1" class="method hidden"><code>fn <a href="#method.will_log-1" class="fnname">will_log</a>(&amp;self, _label: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><a class="srclink" href="../src/rustls/keylog.rs.html#62-64" title="goto source code">[src]</a></h4></div></div><span class="loading-content">Loading content...</span><script type="text/javascript" src="../implementors/rustls/trait.KeyLog.js" async></script></section><section id="search" class="content hidden"></section><section class="footer"></section><div id="rustdoc-vars" data-root-path="../" data-current-crate="rustls"></div>
<script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>