---
# System prepended metadata

title: Crypto Envelope Sketch
tags: [draft / in process]

---

---
robots: noindex, nofollow
---

# Crypto Envelope Sketch
###### tags: `draft / in process`

## Simplest Crypto Envelope - nothing encrypted.

<crypto-envelope>
    <undifferentiated byte string />
</crypto-envelope>

- Note that not everything inside a crypto-envelope is encrypted. 


## One Encrypted Object

```
<crypto-envelope>
    <chacha-poly-rfc8439 raw encrypted data />
</crypto-envelope>
```

- Crypto Envelope without any options defaults to one object.
- The most basic type of encrypted object is CBOR tag for chacha-poly-rfc8439 symmetrically encrypted data, followed by that data.
- No indentifer (other than index=0 as implied by the crypto-envelope or hash of the this specific encrypted data, which is unique because chacha-poly-rfc8439 has a nonce).
- The symmetric secret to decrypt the chacha-poly-rfc8439 is completely out-of-channel. No clues are offered as to how to recover it.

## Two Encrypted Objects

```
<crypto-envelope last-index=1>
   <chacha-poly-rfc8439 raw encrypted data />
   <chacha-poly-rfc8439 raw encrypted data />
</crypto-envelope>
```

- Crypto envelope can say how many top items are included by including a last-index, which defaults to 0 (one item). In this example, there are two.
- Like the single example, out-of-band keys (maybe different keys).

## Simple SSKR Sharded Secret

```
<crypto-envelope>
    <sskr v=0 last-index=3>
        <raw unencrypted sskr share/>
        <chacha-poly-rfc8439 raw encrypted data />
        <chacha-poly-rfc8439 raw encrypted data />
        <gzip32>
    </sskr>
</crypto-envelope>
```

- In this example, a random secret (unique for each symmetric encryption) is sharded using SSKR, and if recovered can used as the symettric key to decrypt the any enclosed symmetrically encrypted objects.
- NOTE: that this recovered secret applies to any enclosed symmetric encrypted data - including other symmetric encryption formats that may be defined in the future. #futureproof
- NOTE: if you can recover the secret, you can add more encrypted data to the sskr object, without having to re-encrypt the existing encrypted data or reuse a chacha-poly-rfc8439 nonce. This is to future-proof to allow for use of signatures and time-stamped object, which would have to be renewed if re-encrypted.  

## Simple Timestamped Object

```
<crypto-envelope>
    <chacha-poly-rfc8439 raw encrypted data />
    <time-stamp type=bitcointime last-index=1>
        <proof>
        <back-index=0>
    </time-stamp>
    <signature type=bitcointime last-index=1>
        <proof>
        <back-index=0>
    </time-stamp>

</crypto-envelope>
```
