# Cyphernet

Cyphernet stack consists of the following layers:

1. Meshnet: the base physical connectivity layer
2. Internet: routing and transport between connected meshnets / physical networks
3. Mixnet: a layer on top of internet which hides actual routing information and makes it indistinguishable from the background activity and noise
4. Encryption: layer which guarantees that all the layers below doesn't have access to the data delivered in the messages
5. Authentication: an optional layer guaranteeing that the parties connected through the layers below can recognize each other and maintain long-term relationships based on reputation, which may persists longer than a single connection
6. Application

<figure><img src="/files/KY95CWWf3TENZOCoTXAq" alt=""><figcaption></figcaption></figure>

Internet consists of IP protocol, related routing protocols and transport-level protocols, like TCP, UDP, QUICK, and others.

Mixnet can be either a simple proxy or virtual private network protocols, like SOCKS5 and IPsec, or protocols which does the actual mixnet, like Tor, I2P and Nym.

Encryption can be a PKI-based, which can't be seen as a part of cyphernet, or WoT-based. The specific existing technologies for the encryption include SSL, TLS, SSH and recent Noise protocol suite, however all of them are both authentication and encryption protocols, not separating layer 4 and 5. As a result the require an identity infrastructure, and in the most of cases it is PKI (as with SSL and TLS), or an absence of infrastructure, like in SSH and Noise protocols.

Recent activity has been focused on separating authentication from the encryption. The pioneer in this sphere is a new Bitcoin P2P protocol defined in BIP\_\_\_. In Cyphernet Initiative we try to define a new applciation-agnostic authentification protocol based on WoT-like identities (codenamed Eidolon), clearly distinguished from the encryption protocol layer - which, in turn, doesn't provide a required authentification - codenamed Black Snow.

## Black Snow (BSNC)

"You know nothing, John Snow"


# CypherID

CypherId is a self-sovereign decentralized ID system.

1. Identities (and signed identities, i.e. identity certificates)
2. Identity profiles
3. Identity attestation
4. Contact books

### Identities

Identities consist of:

1. Public key on a specific curve, serialized in one of the pre-defined formats
2. Optional revocation single-use-seal defined using specific proof-of-publication medium
3. Optional signature over the public key, its curve and revocation single-use-seal (or its absence). If the signature is present the identity is called a "certificate"
4. Optional mnemonic must be absent in some formats (like QR code or strict binary & text).

Identities may be represented in multiple ways:

1. As a simply-copyable ASCII string using base58 encoding starting with `ssi` prefix, enhanced with error detection checksum and optional mnemonic suffix (not covering signature even if present, but always covering seal).&#x20;
2. As a URI in form using `ssi:` schema:\
   `ssi:<baid58>/bc/<txid>/<vout>?[sig=<base36cert>]#<mnemonic>`
3. As a QR code, using URI representation from the above, in alphanumeric mode
4. In one of Strict Encoding representations, as strict binary, strict text or JSON or YAML. Text formats may contain optional mnemonic fields, but they must always be absent in the binary serialization (since it can be re-generated from the SSI data)

{% code lineNumbers="true" %}

```haskell
data SSI ::
    key secp256k1(compact [U8^33] | xonly [U8^32]) | curve25519(compact [u8^32]),
    seal (bc(txid [U8^32], vout U16))?,
    sig (schnorr([U8 ^ 64..65]) | ecdsa([U8 ^ 65]) | eddsa([U8 ^ 64]))?
    profile Profile?
    
type SSIExt over SSI
    {- 
    fn read_mnemonic :: (ssi SSI) -> (mnemo Mnemonic)
        let checksum := crc32 (ssi.key, ssi.seal)
        mnemo := mnemonic (checksum)
    -}
    read mnemonic :: [([AlphaSmall ^ 3..8])^3]
        crc32 key, seal |> mnemonic
    
    check !! SSIError -- fn check :: (SSI) -> (() | SSIError)
        {- this is a lambda function
           fn _match :: (ssi) -> (() | SSIError)
               _match1 ssi
               
           fn _match1 :: (ssi) -> (() | SSIError)
               (and (eq ssi.key.@ty, 0), (eq ssi.sig.@ty, 1))
         -}
        key, sig =>
            -- this a function table where each row is a lambda:
            -- fn _ :: (_ _, _) -> (() | SSIError)
            secp256k1(_), schnorr(_) -> (),
            secp256k1(_), ecdsa(_) -> (),
            curve25519(_), eddsa(_) -> (),
            .. -> !! SSIError.invalidSigScheme
 
```

{% endcode %}


# CypherPort

HTTP(s) replacement for P2P world

Cypherport is a universal end-to-end encrypted P2P communication protocol.

Core features:

* Binary
* Based on strict types
* RPC (stateless) and PubSub (stateful)
* End-to-end encrypted (encryption protocol is negotiatable)
* Authenticated on the responder side
* Do not requires SSL/TLS, CA and PKI
* Supposed to work on top of mixnets

Cypherport has assymetric connections (client-server), but distributed and relayed, thus it is a form of P2P protocols.


# Projects

## Network protocol suites

<table data-view="cards"><thead><tr><th></th><th></th><th>Supersedes</th></tr></thead><tbody><tr><td><h3>Black Snow</h3></td><td>Network end-to-end encryption layer</td><td>TLS, Noise</td></tr><tr><td><h3>Eidolon</h3></td><td>Network authentication protocol based on nyms</td><td>PKI, DID</td></tr><tr><td><h3>Legion</h3></td><td>Mesh network protocol</td><td>Ethernet, WiF</td></tr></tbody></table>

## Application layer

<table data-view="cards"><thead><tr><th></th><th></th><th>Supersedes</th></tr></thead><tbody><tr><td><code>ssi</code></td><td>Self-sovereign identity management tools</td><td>GPG/PGP</td></tr><tr><td><code>nsh</code></td><td>Secure shell using Noise framework &#x26; mixnets</td><td>SSH</td></tr><tr><td><code>heartwood</code></td><td>A global P2P network of P2P git relays</td><td>GitHub</td></tr></tbody></table>

## Libraries

<table data-view="cards"><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><code>cyphernet</code></td><td>Library supporting mixnets, encryption, nym-based authentication for cyphernet apps</td></tr><tr><td><code>netservices</code></td><td>A suite for creating cyphernet services and P2P nodes</td></tr><tr><td><code>socks5</code></td><td>Client and server-side libraries for working with SOCKS5-based mixnets</td></tr><tr><td><code>noise-framework</code></td><td>Implementation of Noise Protocol Framework in rust written in a functional style</td></tr><tr><td><code>blacksnow</code></td><td>A next-generation end-to-end encryption protocol modeled after BIP-324</td></tr><tr><td><code>eidolon</code></td><td>Pseudonymous authentication protocol for Noise_NN and Black Snow</td></tr></tbody></table>

## Cypherweb: building the future of the web

<table data-view="cards"><thead><tr><th></th><th></th><th>Alternative to</th></tr></thead><tbody><tr><td><h3>Xenomask</h3></td><td>Web browser plugin for cyphernet adoption</td><td>Metamask</td></tr><tr><td><h3>Xenomorph</h3></td><td>Web browser for cyphernet surfing</td><td>Tor browser</td></tr><tr><td><h3>Nostromo</h3></td><td>Social network and search engine</td><td>Google, Twitter, Nostr</td></tr></tbody></table>


