Show HN: Cryptic – A sensible secret management toolkit and Go library
Cool! I&#x27;ve love to hear more about the security and crypto design. I started writing up some questions but after asking so many it feels like I should just check out the code and answer some of them for myself. Still, I left the discussion here in case you&#x27;re interested :)<p>I&#x27;ve been working on a similar tool in Rust: <a href="https:&#x2F;&#x2F;github.com&#x2F;ketralnis&#x2F;secrets" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;ketralnis&#x2F;secrets</a>. My focus has been less APIs and more person-to-person (e.g. sharing the team&#x27;s twitter password between humans that need to use it) but I&#x27;d love to hear how you&#x27;ve solved some of the conceptual problems that I&#x27;ve struggled with in trying to make it secure.<p>Some issues that I&#x27;ve struggled with:<p>1. withstanding attacks on the file format, some of which are described in this paper: <a href="https:&#x2F;&#x2F;www.cs.ox.ac.uk&#x2F;files&#x2F;6487&#x2F;pwvault.pdf" rel="nofollow">https:&#x2F;&#x2F;www.cs.ox.ac.uk&#x2F;files&#x2F;6487&#x2F;pwvault.pdf</a>. My answer has been the logging system that I talk about in Auditing below but I&#x27;d love to hear how you withstand some of these attacks in your system where it looks like you don&#x27;t even control the file format (is that mysql?)<p>2. bootstrapping trust. how do I know I haven&#x27;t been MitM&#x27;d, and how can I avoid having to trust the server? My system has a public&#x2F;private key for every user, so when I share a password with you I&#x27;m encrypting it to your public key. The worst possible case then is that I inject my public key claiming to be you because then I get the passwords instead of you. Preventing this while also allowing for public keys to be rotated after a compromise of a client machine is currently stumping me. My current solution is to keep a record of every public key I&#x27;ve seen before, when I see a new one prompt the user to double check it out-of-band (like SSH does), and to just refuse to ever use a new public key for a user that I&#x27;ve seen before. But I bet that users don&#x27;t actually check this, just like with SSH. And ideally I wouldn&#x27;t rely on less secure out-of-band communication channels.<p>3. And speaking of verification, here&#x27;s how I&#x27;m asking users if everything looks right:<p><pre><code>    === secrets.vm ===
    common name: secrets.vm
    fingerprint: b957e10c998faa9909cff3ba4ec35485d04708c3ecc7481fe14d7f07bc0229cd
    public key:  c15e697e4807793ef8a9461a7b2c6cf2266d1ec1480a594e83b54e7b75e07702
    public sign: f1db594eb55fe97657c57f2aa01afd1210a46d42d80d5552ac4d548162d4968e
    mnemonic:    AM ROBE KIT OMEN BATE ICY TROY RON WHAT HIP OMIT SUP LID CLAY AVER LEAR CAVE REEL CAN PAM FAN LUND RIFT ACME
    does that look right? [y&#x2F;n]
</code></pre>
AFAICT these word-based (it&#x27;s rfc1751) or sentence based (as recommended by <a href="https:&#x2F;&#x2F;www.usenix.org&#x2F;conference&#x2F;usenixsecurity16&#x2F;technical-sessions&#x2F;presentation&#x2F;dechand" rel="nofollow">https:&#x2F;&#x2F;www.usenix.org&#x2F;conference&#x2F;usenixsecurity16&#x2F;technical...</a>) are the best we have but do users actually verify these? How do you help your users prove that your server is really your server before they store secrets in it, in a way that they&#x27;ll actually verify?<p>4. Auditing. How can I, as an end user or as an admin of the server, prove that the server hasn&#x27;t been tampered with to inject rogue keys? Right now I have a sketch for a merkle tree type log system where the server (1) logs every action (2) links every &quot;fact&quot; (a key, a secret, a user) to an entry in the log and (3) signs every log entry along with the log entry before it. Then a user can reconstruct the current state of the database to make sure that it matches. The upside is that it&#x27;s pretty hard to forge, but the downside is that it&#x27;s prohibitively expensive to verify: you really have to check the whole thing so you don&#x27;t want that happening every time you retrieve a secret. And there are some tricky bits like making sure that the log doesn&#x27;t have orphan entries that are easy to get wrong. Do you have a good solution to the auditing problem?<p>5. Keeping the crypto itself simple and auditable. I use libnacl for the actual crypto and openssl for TLS. I&#x27;ve found that simply writing down every way the crypto is used (<a href="https:&#x2F;&#x2F;github.com&#x2F;ketralnis&#x2F;secrets&#x2F;blob&#x2F;master&#x2F;DESIGN.md" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;ketralnis&#x2F;secrets&#x2F;blob&#x2F;master&#x2F;DESIGN.md</a>) that I&#x27;ve found a lot of cases where it was too complicated and likely to be messed up. Finding that out made a big difference to me in how I write it: now I describe it first and then write the code and that has made a huge difference in keeping it simple. I don&#x27;t see really any documentation on your crypto, how do you know you&#x27;re doing it right?