├── man ├── .gitignore ├── opaqueztore.head ├── opaquestore.head ├── opaque-store.cfg.head ├── opaque-stored.cfg.head ├── makefile ├── opaqueztore.md ├── opaque-stored.cfg.md ├── opaque-store.cfg.md └── opaquestore.md ├── client ├── opaquestore │ ├── __init__.py │ ├── cfg.py │ └── client.py ├── MANIFEST.in ├── setup.py ├── opaque-store.cfg ├── README.md └── LICENSE ├── .gitignore ├── server ├── server.der ├── workaround.h ├── src │ ├── utils.zig │ └── secret_allocator.zig ├── cert.pem ├── workaround.c ├── build.zig.zon ├── opaque-stored.cfg ├── README.md └── build.zig ├── test ├── servers │ ├── 0 │ │ ├── ltsig.key │ │ ├── rtoken.key │ │ ├── server.der │ │ ├── cert.pem │ │ └── opaque-stored.cfg │ ├── 1 │ │ ├── ltsig.key │ │ ├── rtoken.key │ │ ├── server.der │ │ ├── cert.pem │ │ └── opaque-stored.cfg │ ├── 2 │ │ ├── ltsig.key │ │ ├── rtoken.key │ │ ├── server.der │ │ ├── cert.pem │ │ └── opaque-stored.cfg │ ├── eins.pub │ ├── zero.pub │ └── zwei.pub ├── opaque-store.cfg └── test.py ├── .github └── workflows │ └── release.yml ├── README.md ├── whitepaper.md └── LICENSE /man/.gitignore: -------------------------------------------------------------------------------- 1 | *.1 2 | -------------------------------------------------------------------------------- /client/opaquestore/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /client/MANIFEST.in: -------------------------------------------------------------------------------- 1 | include README.md 2 | include *.py 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .arch/ 2 | .zig-cache/ 3 | __pycache__/ 4 | zig-out/ 5 | -------------------------------------------------------------------------------- /man/opaqueztore.head: -------------------------------------------------------------------------------- 1 | .TH "opaqueztore" "1" "" "" "OPAQUE-Store server" 2 | -------------------------------------------------------------------------------- /man/opaquestore.head: -------------------------------------------------------------------------------- 1 | .TH "opaquestore" "1" "" "" "OPAQUE-Store command-line client" 2 | -------------------------------------------------------------------------------- /server/server.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stef/opaque-store/master/server/server.der -------------------------------------------------------------------------------- /man/opaque-store.cfg.head: -------------------------------------------------------------------------------- 1 | .TH "opaque-store.cfg" "5" "" "" "OPAQUE-Store client configuration" 2 | -------------------------------------------------------------------------------- /test/servers/eins.pub: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stef/opaque-store/master/test/servers/eins.pub -------------------------------------------------------------------------------- /test/servers/zero.pub: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stef/opaque-store/master/test/servers/zero.pub -------------------------------------------------------------------------------- /test/servers/zwei.pub: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stef/opaque-store/master/test/servers/zwei.pub -------------------------------------------------------------------------------- /man/opaque-stored.cfg.head: -------------------------------------------------------------------------------- 1 | .TH "opaque-stored.cfg" "5" "" "" "OPAQUE-Store server configuration" 2 | -------------------------------------------------------------------------------- /test/servers/0/ltsig.key: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stef/opaque-store/master/test/servers/0/ltsig.key -------------------------------------------------------------------------------- /test/servers/1/ltsig.key: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stef/opaque-store/master/test/servers/1/ltsig.key -------------------------------------------------------------------------------- /test/servers/2/ltsig.key: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stef/opaque-store/master/test/servers/2/ltsig.key -------------------------------------------------------------------------------- /test/servers/0/rtoken.key: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stef/opaque-store/master/test/servers/0/rtoken.key -------------------------------------------------------------------------------- /test/servers/0/server.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stef/opaque-store/master/test/servers/0/server.der -------------------------------------------------------------------------------- /test/servers/1/rtoken.key: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stef/opaque-store/master/test/servers/1/rtoken.key -------------------------------------------------------------------------------- /test/servers/1/server.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stef/opaque-store/master/test/servers/1/server.der -------------------------------------------------------------------------------- /test/servers/2/rtoken.key: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stef/opaque-store/master/test/servers/2/rtoken.key -------------------------------------------------------------------------------- /test/servers/2/server.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stef/opaque-store/master/test/servers/2/server.der -------------------------------------------------------------------------------- /server/workaround.h: -------------------------------------------------------------------------------- 1 | #ifndef workaround_h 2 | #define workaround_h 3 | #include 4 | #include 5 | #include 6 | 7 | TP_DKG_PeerState* new_peerstate(void); 8 | void extract_share(const TP_DKG_PeerState *ctx, uint8_t share[TOPRF_Share_BYTES]); 9 | void del_peerstate(TP_DKG_PeerState **peer); 10 | #endif // workaround_h 11 | -------------------------------------------------------------------------------- /man/makefile: -------------------------------------------------------------------------------- 1 | all: opaquestore.1 opaqueztore.1 opaque-store.cfg.1 opaque-stored.cfg.1 2 | 3 | install: $(PREFIX)/share/man/man1/opaquestore.1 $(PREFIX)/share/man/man1/opaqueztore.1 \ 4 | $(PREFIX)/share/man/man5/opaque-store.cfg.1 $(PREFIX)/share/man/man5/opaque-stored.cfg.1 \ 5 | 6 | clean: 7 | rm -f *.1 8 | 9 | %.1: %.md 10 | cp $(@:.1=.head) $@ 11 | cmark -t man $< >>$@ 12 | -------------------------------------------------------------------------------- /server/src/utils.zig: -------------------------------------------------------------------------------- 1 | const std = @import("std"); 2 | const warn = std.debug.print; 3 | 4 | pub fn hexdump(buf: []const u8) void { 5 | for (buf) |C| { 6 | warn("{x:0>2}", .{C}); 7 | } 8 | warn("\n", .{}); 9 | } 10 | 11 | 12 | pub fn dir_exists(path: []const u8) bool { 13 | var cwd = std.fs.cwd(); 14 | const args: std.fs.Dir.OpenDirOptions = undefined; 15 | var dir = cwd.openDir(path, args) catch return false; 16 | dir.close(); 17 | return true; 18 | } 19 | -------------------------------------------------------------------------------- /server/cert.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIBhTCCASugAwIBAgIURt1h20rXWGwyV5nuLDp2NBaXsgkwCgYIKoZIzj0EAwIw 3 | GDEWMBQGA1UEAwwNc3BoaW54IG9yYWNsZTAeFw0yMDA5MjkyMTI5MDBaFw0yMTA5 4 | MjQyMTI5MDBaMBgxFjAUBgNVBAMMDXNwaGlueCBvcmFjbGUwWTATBgcqhkjOPQIB 5 | BggqhkjOPQMBBwNCAATPl01K0Nuxm4wZaYzS4AvaXy4pIG96Zk5XC1o0TmkdnNPb 6 | kgSUm6dx1OVvx3u8kVGRHYfgC7C4I414W2v41Hb4o1MwUTAdBgNVHQ4EFgQUtpha 7 | TRgMR7SeM7gYPKoq8L874tcwHwYDVR0jBBgwFoAUtphaTRgMR7SeM7gYPKoq8L87 8 | 4tcwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAgNIADBFAiEAnN1Y9WDfVW6f 9 | slgOnPs8eQdyoqA7S/rFf9wE/ZxR4tECICfCYMKpIRMYPEk2C+kqoJueB/JVdGKh 10 | pYxdMvjx8bsj 11 | -----END CERTIFICATE----- 12 | -------------------------------------------------------------------------------- /test/servers/0/cert.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIBhTCCASugAwIBAgIURt1h20rXWGwyV5nuLDp2NBaXsgkwCgYIKoZIzj0EAwIw 3 | GDEWMBQGA1UEAwwNc3BoaW54IG9yYWNsZTAeFw0yMDA5MjkyMTI5MDBaFw0yMTA5 4 | MjQyMTI5MDBaMBgxFjAUBgNVBAMMDXNwaGlueCBvcmFjbGUwWTATBgcqhkjOPQIB 5 | BggqhkjOPQMBBwNCAATPl01K0Nuxm4wZaYzS4AvaXy4pIG96Zk5XC1o0TmkdnNPb 6 | kgSUm6dx1OVvx3u8kVGRHYfgC7C4I414W2v41Hb4o1MwUTAdBgNVHQ4EFgQUtpha 7 | TRgMR7SeM7gYPKoq8L874tcwHwYDVR0jBBgwFoAUtphaTRgMR7SeM7gYPKoq8L87 8 | 4tcwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAgNIADBFAiEAnN1Y9WDfVW6f 9 | slgOnPs8eQdyoqA7S/rFf9wE/ZxR4tECICfCYMKpIRMYPEk2C+kqoJueB/JVdGKh 10 | pYxdMvjx8bsj 11 | -----END CERTIFICATE----- 12 | -------------------------------------------------------------------------------- /test/servers/1/cert.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIBhTCCASugAwIBAgIURt1h20rXWGwyV5nuLDp2NBaXsgkwCgYIKoZIzj0EAwIw 3 | GDEWMBQGA1UEAwwNc3BoaW54IG9yYWNsZTAeFw0yMDA5MjkyMTI5MDBaFw0yMTA5 4 | MjQyMTI5MDBaMBgxFjAUBgNVBAMMDXNwaGlueCBvcmFjbGUwWTATBgcqhkjOPQIB 5 | BggqhkjOPQMBBwNCAATPl01K0Nuxm4wZaYzS4AvaXy4pIG96Zk5XC1o0TmkdnNPb 6 | kgSUm6dx1OVvx3u8kVGRHYfgC7C4I414W2v41Hb4o1MwUTAdBgNVHQ4EFgQUtpha 7 | TRgMR7SeM7gYPKoq8L874tcwHwYDVR0jBBgwFoAUtphaTRgMR7SeM7gYPKoq8L87 8 | 4tcwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAgNIADBFAiEAnN1Y9WDfVW6f 9 | slgOnPs8eQdyoqA7S/rFf9wE/ZxR4tECICfCYMKpIRMYPEk2C+kqoJueB/JVdGKh 10 | pYxdMvjx8bsj 11 | -----END CERTIFICATE----- 12 | -------------------------------------------------------------------------------- /test/servers/2/cert.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIBhTCCASugAwIBAgIURt1h20rXWGwyV5nuLDp2NBaXsgkwCgYIKoZIzj0EAwIw 3 | GDEWMBQGA1UEAwwNc3BoaW54IG9yYWNsZTAeFw0yMDA5MjkyMTI5MDBaFw0yMTA5 4 | MjQyMTI5MDBaMBgxFjAUBgNVBAMMDXNwaGlueCBvcmFjbGUwWTATBgcqhkjOPQIB 5 | BggqhkjOPQMBBwNCAATPl01K0Nuxm4wZaYzS4AvaXy4pIG96Zk5XC1o0TmkdnNPb 6 | kgSUm6dx1OVvx3u8kVGRHYfgC7C4I414W2v41Hb4o1MwUTAdBgNVHQ4EFgQUtpha 7 | TRgMR7SeM7gYPKoq8L874tcwHwYDVR0jBBgwFoAUtphaTRgMR7SeM7gYPKoq8L87 8 | 4tcwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAgNIADBFAiEAnN1Y9WDfVW6f 9 | slgOnPs8eQdyoqA7S/rFf9wE/ZxR4tECICfCYMKpIRMYPEk2C+kqoJueB/JVdGKh 10 | pYxdMvjx8bsj 11 | -----END CERTIFICATE----- 12 | -------------------------------------------------------------------------------- /server/workaround.c: -------------------------------------------------------------------------------- 1 | #include "oprf/tp-dkg.h" 2 | #include "oprf/toprf.h" 3 | #include 4 | #include 5 | 6 | // zig cannot align data at 64Byte (or anything beyond 16 bytes really) 7 | // see https://github.com/ziglang/zig/issues/8452 8 | 9 | // thus we have to workaround this by allocating/freeing and accessing 10 | // the data in c which the zig cc backend (clang) handles correctly. 11 | TP_DKG_PeerState* new_peerstate(void) { 12 | return aligned_alloc(64,sizeof(TP_DKG_PeerState)); 13 | } 14 | 15 | void extract_share(const TP_DKG_PeerState *ctx, uint8_t share[TOPRF_Share_BYTES]) { 16 | memcpy(share, &ctx->share, TOPRF_Share_BYTES); 17 | } 18 | 19 | void del_peerstate(TP_DKG_PeerState **peer) { 20 | if(*peer!=NULL) free(*peer); 21 | *peer = NULL; 22 | } 23 | -------------------------------------------------------------------------------- /test/opaque-store.cfg: -------------------------------------------------------------------------------- 1 | [client] 2 | verbose=true 3 | context="opaque-store-v0.0.1" 4 | id_salt="asdfasdf" 5 | threshold=2 6 | 7 | [servers] 8 | [servers.zero] 9 | # address of server 10 | host="127.0.0.1" 11 | # port where server is running 12 | port=23000 13 | # public key of the server 14 | ssl_cert = "servers/0/cert.pem" 15 | ltsigkey="servers/zero.pub" 16 | [servers.eins] 17 | # address of server 18 | host="127.0.0.1" 19 | # port where server is running 20 | port=23001 21 | # public key of the server 22 | ssl_cert = "servers/1/cert.pem" 23 | ltsigkey="servers/eins.pub" 24 | [servers.zwei] 25 | # address of server 26 | host="127.0.0.1" 27 | # port where server is running 28 | port=23002 29 | # public key of the server 30 | ssl_cert = "servers/2/cert.pem" 31 | ltsigkey="servers/zwei.pub" 32 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | jobs: 2 | pypi-publish: 3 | name: Upload release to PyPI 4 | if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') 5 | runs-on: ubuntu-latest 6 | environment: 7 | name: pypi 8 | url: https://pypi.org/p/opaquestore 9 | permissions: 10 | id-token: write 11 | steps: 12 | - uses: actions/checkout@v4 13 | - name: Set up Python 14 | uses: actions/setup-python@v3 15 | with: 16 | python-version: '3.x' 17 | - name: Install dependencies 18 | run: | 19 | python -m pip install --upgrade pip 20 | cd client 21 | pip install build 22 | - name: Build package 23 | run: | 24 | cd client 25 | python -m build 26 | - name: Publish package distributions to PyPI 27 | uses: pypa/gh-action-pypi-publish@release/v1 28 | -------------------------------------------------------------------------------- /client/opaquestore/cfg.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # SPDX-FileCopyrightText: 2023, Marsiske Stefan 3 | # SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | import os, tomllib 6 | 7 | def split_by_n(obj, n): 8 | # src https://stackoverflow.com/questions/9475241/split-string-every-nth-character 9 | return [obj[i:i+n] for i in range(0, len(obj), n)] 10 | 11 | def getcfg(name, cwd="."): 12 | paths=[ 13 | # read global cfg 14 | f'/etc/{name}/config', 15 | # update with per-user configs 16 | os.path.expanduser(f"~/.{name}rc"), 17 | os.path.expanduser(f"~/.config/{name}/config"), 18 | # over-ride with local directory config 19 | os.path.expanduser('/'.join([cwd,f"{name}.cfg"])) 20 | ] 21 | config = dict() 22 | for path in paths: 23 | try: 24 | with open(path, "rb") as f: 25 | data = tomllib.load(f) 26 | except FileNotFoundError: 27 | continue 28 | config.update(data) 29 | return config 30 | -------------------------------------------------------------------------------- /test/servers/0/opaque-stored.cfg: -------------------------------------------------------------------------------- 1 | # config is read in this order from the following locations, later ones 2 | # overriding settings from the earlier ones: 3 | # - /etc/sphinx/config 4 | # - ~/.config/sphinx/config 5 | # - ~/.sphinxrc 6 | # - ./sphinx.cfg 7 | 8 | [server] 9 | # the ipv4 address the server is listening on 10 | #address="127.0.0.1" 11 | 12 | # ssl key 13 | ssl_key="server.der" 14 | 15 | # ssl cert 16 | ssl_cert="cert.pem" 17 | 18 | # the port on which the server is listening, use 443 if available, so that 19 | # the oracle can be accessed from behind tight firewalls, default: 8080 20 | port=23000 21 | 22 | # tcp connection timeouts, increase in case you have bad networks, with the 23 | # caveat that this might lead to easier resource exhaustion - blocking all 24 | # workers. 25 | #timeout=3 26 | 27 | # the root directory where all data is stored, default: /var/lib/sphinx 28 | datadir="data" 29 | 30 | # how many worker processes can run in parallel 31 | # max_kids=5 32 | 33 | # whether to produce some output 34 | verbose=true 35 | 36 | # key 37 | record_salt="some random string to salt the record ids" 38 | 39 | max_blob_size=8192 40 | 41 | ltsigkey="ltsig.key" 42 | -------------------------------------------------------------------------------- /test/servers/1/opaque-stored.cfg: -------------------------------------------------------------------------------- 1 | # config is read in this order from the following locations, later ones 2 | # overriding settings from the earlier ones: 3 | # - /etc/sphinx/config 4 | # - ~/.config/sphinx/config 5 | # - ~/.sphinxrc 6 | # - ./sphinx.cfg 7 | 8 | [server] 9 | # the ipv4 address the server is listening on 10 | #address="127.0.0.1" 11 | 12 | # ssl key 13 | ssl_key="server.der" 14 | 15 | # ssl cert 16 | ssl_cert="cert.pem" 17 | 18 | # the port on which the server is listening, use 443 if available, so that 19 | # the oracle can be accessed from behind tight firewalls, default: 8080 20 | port=23001 21 | 22 | # tcp connection timeouts, increase in case you have bad networks, with the 23 | # caveat that this might lead to easier resource exhaustion - blocking all 24 | # workers. 25 | #timeout=3 26 | 27 | # the root directory where all data is stored, default: /var/lib/sphinx 28 | datadir="data" 29 | 30 | # how many worker processes can run in parallel 31 | # max_kids=5 32 | 33 | # whether to produce some output 34 | verbose=true 35 | 36 | # key 37 | record_salt="some random string to salt the record ids" 38 | 39 | max_blob_size=8192 40 | 41 | ltsigkey="ltsig.key" 42 | -------------------------------------------------------------------------------- /test/servers/2/opaque-stored.cfg: -------------------------------------------------------------------------------- 1 | # config is read in this order from the following locations, later ones 2 | # overriding settings from the earlier ones: 3 | # - /etc/sphinx/config 4 | # - ~/.config/sphinx/config 5 | # - ~/.sphinxrc 6 | # - ./sphinx.cfg 7 | 8 | [server] 9 | # the ipv4 address the server is listening on 10 | #address="127.0.0.1" 11 | 12 | # ssl key 13 | ssl_key="server.der" 14 | 15 | # ssl cert 16 | ssl_cert="cert.pem" 17 | 18 | # the port on which the server is listening, use 443 if available, so that 19 | # the oracle can be accessed from behind tight firewalls, default: 8080 20 | port=23002 21 | 22 | # tcp connection timeouts, increase in case you have bad networks, with the 23 | # caveat that this might lead to easier resource exhaustion - blocking all 24 | # workers. 25 | #timeout=3 26 | 27 | # the root directory where all data is stored, default: /var/lib/sphinx 28 | datadir="data" 29 | 30 | # how many worker processes can run in parallel 31 | # max_kids=5 32 | 33 | # whether to produce some output 34 | verbose=true 35 | 36 | # key 37 | record_salt="some random string to salt the record ids" 38 | 39 | max_blob_size=8192 40 | 41 | ltsigkey="ltsig.key" 42 | -------------------------------------------------------------------------------- /client/setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | # SPDX-FileCopyrightText: 2024, Marsiske Stefan 4 | # SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | import os 7 | #from distutils.core import setup, Extension 8 | from setuptools import setup 9 | 10 | 11 | # Utility function to read the README file. 12 | # Used for the long_description. It's nice, because now 1) we have a top level 13 | # README file and 2) it's easier to type in the README file than to put a raw 14 | # string in below ... 15 | def read(fname): 16 | return open(os.path.join(os.path.dirname(__file__), fname)).read() 17 | 18 | setup(name = 'opaquestore', 19 | version = '0.3.0', 20 | description = 'Simple Online secret-storage based on the OPAQUE protocol', 21 | license = "GPLv3", 22 | author = 'Stefan Marsiske', 23 | author_email = 'opaque@ctrlc.hu', 24 | url = 'https://github.com/stef/opaque-store/', 25 | long_description=read('README.md'), 26 | long_description_content_type="text/markdown", 27 | packages = ['opaquestore'], 28 | install_requires = ("pysodium", "SecureString", "opaque","zxcvbn-python", 'pyoprf'), 29 | classifiers = ["Development Status :: 4 - Beta", 30 | "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", 31 | "Topic :: Security :: Cryptography", 32 | "Topic :: Security", 33 | ], 34 | entry_points = { 35 | 'console_scripts': [ 36 | 'opaquestore = opaquestore.client:main' 37 | ], 38 | }, 39 | ) 40 | -------------------------------------------------------------------------------- /client/opaque-store.cfg: -------------------------------------------------------------------------------- 1 | [client] 2 | # you must change this value, it ensures that your record ids are 3 | # unique you must also make sure to not lose this value, if you do, 4 | # you lose access to your records. 5 | id_salt="Please_MUST-be_changed! and backed up to something difficult to guess" 6 | # the number of servers successfully participating in an 7 | # operation. must be less than 129, but lower 1 digit number are 8 | # probable the most robust. 9 | threshold=2 10 | # the time in seconds a distributed keygen (DKG) protocol message is 11 | # considered fresh. anything older than this is considered invalid and 12 | # aborts a DKG. Higher values help with laggy links, lower values can 13 | # be fine if you have high-speed connections to all servers. 14 | ts_epsilon=1200 15 | 16 | # the list of servers, must be 1 item, if threshold is 1, or one more 17 | # than threshold. 18 | [servers] 19 | [servers.zero] 20 | # address of server 21 | host="127.0.0.1" 22 | # port where server is running 23 | port=23000 24 | # self-signed public key of the server 25 | # - not needed for proper Lets Encrypt certs 26 | ssl_cert = "../server/cert.pem" 27 | ltsigkey="../server/test-2of3-setup/zero.pub" 28 | [servers.eins] 29 | # address of server 30 | host="127.0.0.1" 31 | # port where server is running 32 | port=23001 33 | # public key of the server 34 | ssl_cert = "../server/cert.pem" 35 | ltsigkey="../server/test-2of3-setup/eins.pub" 36 | [servers.zwei] 37 | # address of server 38 | host="127.0.0.1" 39 | # port where server is running 40 | port=23002 41 | # public key of the server 42 | ssl_cert = "../server/cert.pem" 43 | ltsigkey="../server/test-2of3-setup/zwei.pub" 44 | -------------------------------------------------------------------------------- /man/opaqueztore.md: -------------------------------------------------------------------------------- 1 | # NAME 2 | 3 | opaqueztore - OPAQUE-Store server 4 | 5 | # SYNOPSIS 6 | 7 | `opaqueztore` 8 | 9 | # DESCRIPTION 10 | 11 | OPAQUE-Store is a simple protocol that allows anyone to store encrypted blobs 12 | of information online, with only a password needed to retrieve the information. 13 | As the name implies it uses the OPAQUE protocol to do so. OPAQUE-Store uses the 14 | `export_key` feature of OPAQUE to encrypt the data that is stored on the 15 | OPAQUE-Storage server. 16 | 17 | The server runs in the foreground and emits log messages to standard output. If 18 | you want to run it as a daemon, you should deploy it using service supervision 19 | tools such as s6, runit or daemontools. 20 | 21 | See `opaque-stored.cfg(5)` man-page for configuration details. 22 | 23 | After the configuration of the server, the administrator should 24 | publish its long-term signing public-key so that clients can use it in 25 | a threshold setup. 26 | 27 | # SECURITY CONSIDERATIONS 28 | 29 | You **SHOULD** back up your SSL key, `record_salt` configuration value, 30 | ltsigkey and of course all blobs regularly. 31 | 32 | # REPORTING BUGS 33 | 34 | https://github.com/stef/opaque-store/issues/ 35 | 36 | # AUTHOR 37 | 38 | Written by Stefan Marsiske. 39 | 40 | # COPYRIGHT 41 | 42 | Copyright © 2024 Stefan Marsiske. License GPLv3+: GNU GPL version 3 or later . 43 | This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. 44 | 45 | # SEE ALSO 46 | 47 | `https://www.ctrlc.hu/~stef/blog/posts/How_to_recover_static_secrets_using_OPAQUE.html` 48 | 49 | `opaquestore(1)`, `opaque-stored.cfg(5)` 50 | -------------------------------------------------------------------------------- /server/build.zig.zon: -------------------------------------------------------------------------------- 1 | .{ 2 | // This is the default name used by packages depending on this one. For 3 | // example, when a user runs `zig fetch --save `, this field is used 4 | // as the key in the `dependencies` table. Although the user can choose a 5 | // different name, most users will stick with this provided value. 6 | // 7 | // It is redundant to include "zig" in this name because it is already 8 | // within the Zig package namespace. 9 | .name = .opaqueztore, 10 | 11 | // This is a [Semantic Version](https://semver.org/). 12 | // In a future version of Zig it will be used for package deduplication. 13 | .version = "0.3.0", 14 | 15 | // This field is optional. 16 | // This is currently advisory only; Zig does not yet do anything 17 | // with this value. 18 | //.minimum_zig_version = "0.11.0", 19 | .fingerprint = 0xa70cfe1d7d6a9db4, 20 | 21 | // This field is optional. 22 | // Each dependency must either provide a `url` and `hash`, or a `path`. 23 | // `zig build --fetch` can be used to fetch all dependencies of a package, recursively. 24 | // Once all dependencies are fetched, `zig build` no longer requires 25 | // internet connectivity. 26 | .dependencies = .{ 27 | .zig_toml = .{ 28 | .url = "git+https://github.com/stef/zig-toml/?ref=HEAD#60653131b28386466dde827f6342222bbc0f16a7", 29 | .hash = "zig_toml-0.1.0-AAAAALyuAADc57mdQXxmf1Lc1r1rDe5brlr_igwYiWxK", 30 | }, 31 | .zig_bearssl = .{ 32 | .url = "git+https://github.com/stef/zig-bearssl/?ref=HEAD#e22c0ab2b0f11f4f363afb2c82ffab23a55ddfe2", 33 | .hash = "zig_bearssl-0.1.0-AAAAAKp9OQAkUZJVs3ROjTNOW0TNOI5ZeyP__4OSkqMS", 34 | }, 35 | }, 36 | .paths = .{ 37 | "build.zig", 38 | "build.zig.zon", 39 | "src", 40 | // For example... 41 | //"LICENSE", 42 | //"README.md", 43 | }, 44 | } 45 | -------------------------------------------------------------------------------- /server/opaque-stored.cfg: -------------------------------------------------------------------------------- 1 | # config is read in this order from the following locations, later ones 2 | # overriding settings from the earlier ones: 3 | # - /etc/opaque-stored/config 4 | # - ~/.config/opaque-stored/config 5 | # - ~/.opaque-storedrc 6 | # - ./opaque-stored.cfg 7 | 8 | [server] 9 | # the ipv4 address the server is listening on 10 | #address="127.0.0.1" 11 | 12 | # ssl key 13 | ssl_key="server.der" 14 | 15 | # ssl cert 16 | ssl_cert="cert.pem" 17 | 18 | # the port on which the server is listening, use 443 if available, so that 19 | # the server can be accessed from behind tight firewalls, default: 8080 20 | port=2523 21 | 22 | # tcp connection timeouts, increase in case you have bad networks, with the 23 | # caveat that this might lead to easier resource exhaustion - blocking all 24 | # workers. 25 | #timeout=3 26 | 27 | # the root directory where all data is stored, default: /var/lib/opaque-stored 28 | datadir="data" 29 | 30 | # how many worker processes can run in parallel 31 | # max_kids=5 32 | 33 | # whether to produce some output 34 | verbose=true 35 | 36 | # key 37 | record_salt="some random string to salt the record ids" 38 | 39 | # Especially if you run a public server you want to limit the maximum size of 40 | # stored blobs 41 | max_blob_size=8192 42 | 43 | # lock a record after this many failed password attempts. 44 | max_fails=3 45 | 46 | # a file containing the long-term signing key of the server - this is only 47 | # needed for participation in threshold setups. Can be generated by running the 48 | # client with parameter: "opaquestore genltsigkey >ltsigkey.key" 49 | ltsigkey="ltsigkey.key" 50 | 51 | # set how long a message is considered fresh during a DKG protocol, any 52 | # messages that have timestamps that are older than this many seconds will 53 | # abort the DKG protocol. Increase this value if you have/expect laggy links. 54 | ts_epsilon=600 55 | 56 | # the number of recovery tokens a server holds for each blob 57 | max_recovery_tokens=5 58 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OPAQUE-Store 2 | 3 | OPAQUE-Store is a simple protocol that allows anyone to store 4 | encrypted blobs of information online, with only a password needed to 5 | retrieve the information. As the name implies it uses the OPAQUE 6 | protocol to do so. OPAQUE-Store uses the `export_key` feature of 7 | OPAQUE to encrypt the data that is stored on the OPAQUE-Storage 8 | server. 9 | 10 | You might want to read this blog-post on this topic and on more info: 11 | `https://www.ctrlc.hu/~stef/blog/posts/How_to_recover_static_secrets_using_OPAQUE.html` 12 | 13 | OPAQUE-Store goes beyond the original OPAQUE protocol as specified by 14 | the IRTF/CFRG and also supports a threshold variant of OPAQUE. In a 15 | threshold setup you have a number N of servers that all hold a share 16 | of your secret and at least a threshold number T of these need to 17 | cooperate to recover the secret. This provides extra robustness and 18 | dillution of responsibility (losing a server is not the end of the 19 | world!) while at the same time increases security, as an attacker now 20 | has to compromise at least T servers to get access to some 21 | information. 22 | 23 | This project is funded through [NGI0 Entrust](https://nlnet.nl/entrust), a fund 24 | established by [NLnet](https://nlnet.nl) with financial support from the 25 | European Commission's [Next Generation Internet](https://ngi.eu) program. Learn 26 | more at the [NLnet project page](https://nlnet.nl/project/ThresholdOPRF). 27 | 28 | This project was funded through the e-Commons Fund, a fund established by NLnet 29 | with financial support from the Netherlands Ministry of the Interior and 30 | Kingdom Relations. 31 | 32 | [NLnet foundation logo](https://nlnet.nl) 33 | [NGI Zero Logo](https://nlnet.nl/entrust) 34 | [Logo The Netherlands Ministry of the Interior and Kingdom Relations](https://www.rijksoverheid.nl/ministeries/ministerie-van-binnenlandse-zaken-en-koninkrijksrelaties) 35 | -------------------------------------------------------------------------------- /server/README.md: -------------------------------------------------------------------------------- 1 | # OPAQUE-Store server 2 | 3 | OPAQUE-Store is a simple protocol that allows anyone to store 4 | encrypted blobs of information online, with only a password needed to 5 | retrieve the information. As the name implies it uses the OPAQUE 6 | protocol to do so. OPAQUE-Store uses the `export_key` feature of 7 | OPAQUE to encrypt the data that is stored on the OPAQUE-Storage 8 | server. 9 | 10 | # Dependencies 11 | 12 | you need to install 13 | 14 | - libsodium 15 | - liboprf https://github.com/stef/liboprf/ 16 | - libopaque https://github.com/stef/libopaque/ 17 | 18 | on debian (unstable) you can install the -dev packages. 19 | 20 | # Building 21 | 22 | You need zig 0.13 at least to build, simply do 23 | 24 | `zig build` 25 | 26 | # Configuring 27 | 28 | Configuration will be looked for in the following order 29 | 30 | - /etc/opaque-stored/config 31 | - ~/.config/opaque-stored/config 32 | - ~/.opaque-storedrc 33 | - ./opaque-stored.cfg 34 | 35 | For an example file see the file `opaque-stored.cfg` in this directory. 36 | 37 | The most important is to have a proper SSL certificate, in the times of Let's 38 | Encrypt this should not be a big challenge. You do need a domain name you 39 | control for this though, but that is a requirement for public servers 40 | anyway. If you have a domain name, you can run on that host something like 41 | this: 42 | 43 | ```sh 44 | sudo certbot certonly --standalone --preferred-challenges http -d example.com 45 | ``` 46 | 47 | If you run a server that is publicly available on the internet, we recommend to 48 | run it on port 443, which - if you ever go to a restricted network environmet - 49 | has the biggest chances that a firewall will allow to access this. 50 | 51 | ## Configuration Example 52 | 53 | The following is a basic configuration example for a server. 54 | 55 | ``` 56 | [server] 57 | # the ipv4 address the server is listening on 58 | #address="127.0.0.1" 59 | 60 | # ssl key 61 | ssl_key="server.der" 62 | 63 | # ssl cert 64 | ssl_cert="cert.pem" 65 | 66 | # the port on which the server is listening, use 443 if available, so that 67 | # the server can be accessed from behind tight firewalls, default: 8080 68 | port=2523 69 | 70 | # tcp connection timeouts, increase in case you have bad networks, with the 71 | # caveat that this might lead to easier resource exhaustion - blocking all 72 | # workers. 73 | #timeout=3 74 | 75 | # the root directory where all data is stored, default: /var/lib/opaque-stored 76 | datadir="data" 77 | 78 | # how many worker processes can run in parallel 79 | # max_kids=5 80 | 81 | # whether to produce some output 82 | verbose=true 83 | 84 | # key 85 | record_salt="some random string to salt the record ids" 86 | 87 | # Especially if you run a public server you want to limit the maximum size of 88 | # stored blobs 89 | max_blob_size=8192 90 | 91 | # lock a record after this many failed password attempts. 92 | max_fails=3 93 | 94 | # a file containing the long-term signing key of the server - this is only 95 | # needed for participation in threshold setups. Can be generated by running the 96 | # client with parameter: "opaquestore genltsigkey >ltsigkey.key" 97 | ltsigkey="ltsigkey.key" 98 | 99 | # set how long a message is considered fresh during a DKG protocol, any 100 | # messages that have timestamps that are older than this many seconds will 101 | # abort the DKG protocol. Increase this value if you have/expect laggy links. 102 | ts_epsilon=600 103 | 104 | # the number of recovery tokens a server holds for each blob 105 | max_recovery_tokens=5 106 | ``` 107 | -------------------------------------------------------------------------------- /server/src/secret_allocator.zig: -------------------------------------------------------------------------------- 1 | const std = @import("std"); 2 | const Allocator = std.mem.Allocator; 3 | const sodium = @cImport({ 4 | @cInclude("sodium.h"); 5 | }); 6 | 7 | 8 | pub fn SecretAllocator() type { 9 | return struct { 10 | parent_allocator: Allocator, 11 | 12 | const Self = @This(); 13 | 14 | pub fn init(parent_allocator: Allocator) Self { 15 | return Self{ 16 | .parent_allocator = parent_allocator, 17 | }; 18 | } 19 | 20 | pub fn allocator(self: *Self) Allocator { 21 | return .{ 22 | .ptr = self, 23 | .vtable = &.{ 24 | .alloc = alloc, 25 | .resize = resize, 26 | .remap = remap, 27 | .free = free, 28 | }, 29 | }; 30 | } 31 | 32 | fn remap(ctx: *anyopaque, 33 | buf: []u8, 34 | log2_buf_align: std.mem.Alignment, 35 | new_len: usize, 36 | ra: usize) ?[*]u8 { 37 | const self: *Self = @ptrCast(@alignCast(ctx)); 38 | _=sodium.sodium_munlock(@ptrCast(buf),buf.len); 39 | const result = self.parent_allocator.rawRemap(buf, log2_buf_align, new_len, ra); 40 | if(result) |new_buf| { 41 | if(new_len>0 and 0!=sodium.sodium_mlock(@ptrCast(new_buf), new_len)) { 42 | self.parent_allocator.rawFree(new_buf[0..new_len], log2_buf_align, ra); 43 | return null; 44 | } 45 | } 46 | return result; 47 | } 48 | 49 | fn alloc( 50 | ctx: *anyopaque, 51 | len: usize, 52 | log2_ptr_align: std.mem.Alignment, 53 | ra: usize, 54 | ) ?[*]u8 { 55 | const self: *Self = @ptrCast(@alignCast(ctx)); 56 | const result = self.parent_allocator.rawAlloc(len, log2_ptr_align, ra); 57 | if (result) |buf| { 58 | if(len > 0 and 0!=sodium.sodium_mlock(@ptrCast(buf),len)) { 59 | self.parent_allocator.rawFree(buf[0..len], log2_ptr_align, ra); 60 | return null; 61 | } 62 | } 63 | return result; 64 | } 65 | 66 | fn resize( 67 | ctx: *anyopaque, 68 | buf: []u8, 69 | log2_buf_align: std.mem.Alignment, 70 | new_len: usize, 71 | ra: usize, 72 | ) bool { 73 | const self: *Self = @ptrCast(@alignCast(ctx)); 74 | if(new_len==0) _=sodium.sodium_munlock(@ptrCast(buf),buf.len); 75 | if (self.parent_allocator.rawResize(buf, log2_buf_align, new_len, ra)) { 76 | if(new_len>buf.len) _=sodium.sodium_mlock(buf.ptr, new_len); 77 | return true; 78 | } 79 | std.debug.assert(new_len > buf.len); 80 | return false; 81 | } 82 | 83 | fn free( 84 | ctx: *anyopaque, 85 | buf: []u8, 86 | log2_buf_align: std.mem.Alignment, 87 | ra: usize, 88 | ) void { 89 | const self: *Self = @ptrCast(@alignCast(ctx)); 90 | _ = sodium.sodium_munlock(buf.ptr,buf.len); 91 | self.parent_allocator.rawFree(buf, log2_buf_align, ra); 92 | } 93 | }; 94 | } 95 | 96 | pub fn secretAllocator( 97 | parent_allocator: Allocator, 98 | ) SecretAllocator() { 99 | return SecretAllocator().init(parent_allocator); 100 | } 101 | 102 | test "SecretAllocator" { 103 | var allocator_buf: [10]u8 = undefined; 104 | var fixedBufferAllocator = std.mem.validationWrap(std.heap.FixedBufferAllocator.init(&allocator_buf)); 105 | var allocator_state = secretAllocator(fixedBufferAllocator.allocator()); 106 | const allocator = allocator_state.allocator(); 107 | 108 | var a = try allocator.alloc(u8, 10); 109 | try std.testing.expect(allocator.resize(a, 5)); 110 | a = a[0..5]; 111 | try std.testing.expect(!allocator.resize(a, 20)); 112 | allocator.free(a); 113 | } 114 | -------------------------------------------------------------------------------- /man/opaque-stored.cfg.md: -------------------------------------------------------------------------------- 1 | # NAME 2 | 3 | opaque-stored.cfg - configuration for for OPAQUE-Store server `opaqueztore` 4 | 5 | # DESCRIPTION 6 | 7 | `opaque-stored.cfg` holds the configuration for the OPAQUE-Store 8 | **server**. 9 | 10 | The server looks for the configuration in the following files and order: 11 | 12 | - /etc/opaque-stored/config 13 | - ~/.config/opaque-stored/config 14 | - ~/.opaque-storedrc 15 | - ./opaque-stored.cfg 16 | 17 | The configuration file format is TOML, see https://toml.io/ . 18 | 19 | ## `[server]` SECTION 20 | 21 | This section contains all the settings for the server. 22 | 23 | ### ADDRESS 24 | 25 | This can be either an IPv4 or IPv6 address to listen on. Default: 127.0.0.1 26 | 27 | ### PORT 28 | 29 | The port the server listens on. 30 | 31 | If you run a server that is publicly available on the internet, it is 32 | recommended to run it on port 443, which - if you ever go to a restricted 33 | network environment - has the biggest chances that a firewall will allow to 34 | access this. Default: 443 35 | 36 | ### `SSL_KEY` & `SSL_SERVER` 37 | 38 | These two settings point at files containing the PEM encoded SSL certificate 39 | and key of the server. 40 | 41 | In the times of Let's Encrypt this should not be a big challenge. You do need a 42 | domain name you control for this though, but that is a requirement for public 43 | servers anyway. If you have a domain name, you can run on that host something 44 | like this: 45 | 46 | ```sh 47 | sudo certbot certonly --standalone --preferred-challenges http -d example.com 48 | ``` 49 | 50 | If you cannot get a proper CA signed certificate the client also 51 | supports using self-signed certificates, but that should only be used 52 | in development, isolated or VPN environments. 53 | 54 | ### TIMEOUT 55 | 56 | This configures the timeouts for the server. In order to minimize resource 57 | exhaustion attack this should be kept as small as possible, but also big enough 58 | for clients to answer in time. Since all the messages are very small, something 59 | in the low one-digit seconds ballpark should be ample. Default 3s. 60 | 61 | ### DATADIR 62 | 63 | This variable contains the path to the directory where all the blobs are 64 | stored. Default: `/var/lib/opaque-stored` 65 | 66 | ### `MAX_KIDS` 67 | 68 | This setting configures the maximum of how many handlers (sessions) to run in 69 | parallel. Default: 5 70 | 71 | ### VERBOSE 72 | 73 | This setting increases the messages the server prints out during operation. 74 | 75 | ### `RECORD_SALT` 76 | 77 | This is a value that internally hashes the record Ids provided by clients. It 78 | should be changed upon installation to a fresh unique value. 79 | 80 | ### `MAX_BLOB_SIZE` 81 | 82 | This sets the maximum size for any blobs stored on your server. This should be 83 | used to limit resource exhaustion, and can limit the storage of illegal 84 | material like pirated content or abuse material. Default: 1KB. 85 | 86 | ### `MAX_FAILS` 87 | 88 | The number of invalid passwords allowed before locking the blob. Default: 3 89 | 90 | ### `TS_EPSILON` 91 | 92 | This setting defines how long a message is considered fresh during a DKG 93 | protocol, any messages that have timestamps that are older than this many 94 | seconds will abort the DKG protocol. Increase this value if you have/expect 95 | laggy links. Default: 600s 96 | 97 | ### LTSIGKEY 98 | 99 | This setting points at a file containing the long-term signing key of the 100 | server - this is only needed for participation in threshold setups. Can be 101 | generated by running the `opaquestore(1)` client with parameter: 102 | 103 | ```sh 104 | $ opaquestore genltsigkey >ltsigkey.key 105 | ``` 106 | 107 | You need to publish this so that users can use your server in a 108 | threshold setup. 109 | 110 | ### `MAX_RECOVERY_TOKENS` 111 | 112 | This variable defines the maximum number of recovery tokens a server holds for 113 | each blob. Default: 5. 114 | 115 | # FILES 116 | 117 | - /etc/opaque-stored/config 118 | - ~/.config/opaque-stored/config 119 | - ~/.opaque-storedrc 120 | - ./opaque-stored.cfg 121 | 122 | # SECURITY CONSIDERATIONS 123 | 124 | You **should** back up securely your ltsigkey, your SSL cert and key, and the 125 | value of your `RECORD_SALT` setting. 126 | 127 | # REPORTING BUGS 128 | 129 | https://github.com/stef/opaque-store/issues/ 130 | 131 | # AUTHOR 132 | 133 | Written by Stefan Marsiske. 134 | 135 | # COPYRIGHT 136 | 137 | Copyright © 2024 Stefan Marsiske. License GPLv3+: GNU GPL version 3 or later . 138 | This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. 139 | 140 | # SEE ALSO 141 | 142 | `opaqueztore(1)`, `opaquestore(1)`, `opaque-store.cfg(5)` 143 | -------------------------------------------------------------------------------- /man/opaque-store.cfg.md: -------------------------------------------------------------------------------- 1 | # NAME 2 | 3 | opaque-store.cfg - configuration for for OPAQUE-Store client `opaquestore` 4 | 5 | # DESCRIPTION 6 | 7 | This man page describes the format and various ways of configuring the 8 | OPAQUE-Store client `opaquestore`. 9 | 10 | The client looks for the configuration in the following files and order: 11 | 12 | - /etc/opaque-store/config 13 | - ~/.config/opaque-store/config 14 | - ~/.opaque-storerc 15 | - ./opaque-store.cfg 16 | 17 | The configuration file format is TOML, see https://toml.io/ . 18 | 19 | ## `[Client]` SECTION 20 | 21 | This section configures the general options of the client. 22 | 23 | ### `ID_SALT` 24 | 25 | This value is used as an input to generating keyids for your records. 26 | You must set/change this value, it ensures that your record ids are 27 | unique. You must also make sure to not lose this value, if you do, you 28 | lose access to your records. Has no default, must be set. 29 | 30 | ### THRESHOLD 31 | 32 | This value sets the threshold for your server configuration. This 33 | value is tightly dependent on the number of servers you have 34 | configured in the `[servers]` section. If you have only one server 35 | configured, this value must be also 1. This essentially disables 36 | threshold operation. 37 | 38 | In all other cases the number of servers must be at least one bigger 39 | than the value of this variable. That means for the smallest threshold 40 | setup, this value is 2 and you need three servers configured in the 41 | `[servers]` section. The upper limit of this value 127, but it is 42 | highly optimistic to run such large setups reliably. 43 | 44 | ### `TS_EPSILON` 45 | 46 | The time in seconds a distributed keygen (DKG) protocol message is 47 | considered fresh. anything older than this is considered invalid and 48 | aborts a DKG. Higher values help with laggy links, lower values can 49 | be fine if you have high-speed connections to all servers. Default: 1200s 50 | 51 | ### `[servers]` SECTION 52 | 53 | This section contains the list of servers for the client. The number 54 | of items in this list must be 1, if `threshold` is 1, otherwise this 55 | section needs one more entry than the value of `threshold`. 56 | 57 | Servers are in their own sections, with the following pattern: 58 | `[servers.]` Where name should be unique among all servers, 59 | simple labels like opaqueztore1, opaqueztore2, etc. are totally 60 | fine. These labels are important though, as they are used to generate 61 | unique keyids for each server in the threshold setup, this makes the 62 | records stored at the servers to be unlinkable between servers based 63 | on their ids. So it is warmly recommended to back-up the names of the 64 | servers, so you don't lose access to your records. 65 | 66 | #### ADDRESS 67 | 68 | This can be either an IPv4 or IPv6 address to listen on. 69 | 70 | #### PORT 71 | 72 | The port the server listens on. 73 | 74 | #### `SSL_CERT` 75 | 76 | This variable is a path pointing at a file containing a TLS certificate. 77 | This is only needed for TLS certificates that are self-signed or otherwise not 78 | in signed by CAs in your CA store. 79 | 80 | #### LTSIGKEY 81 | 82 | This variable is a path pointing at a file containing a public 83 | long-term signing key of the server. You need to get this from the 84 | operators of the OPAQUE-Store server. This value is only needed if you 85 | run in a threshold setup. 86 | 87 | ## Threshold setup 88 | 89 | The client config file, contains a `[servers]` section which lists all 90 | servers you want to use in a threshold setup. Each server has an 91 | `address`, `port` and `ltsigkey` variable that needs to be set 92 | accordingly. In case the server runs with a self-signed certificate 93 | there is a `ssl_cert` variable that can pin it to the correct cert. 94 | It is also important to note, that the name of the server - which is 95 | given after a dot in the `[servers.name]` sub-section title is also 96 | used to generate record ids specific to that server. Thus once chosen, 97 | it should not change, unless you want to lose access to the records on 98 | that server. The name doesn't have to be unique by users, but should 99 | be unique among all configured servers in this setup, this guarantees 100 | that for a record each server has a different record it and thus makes 101 | the records unlinkable across servers. 102 | 103 | In the config files `[client]` section the `threshold` variable 104 | specifies the threshold for the setup. 105 | 106 | The minimum sane configuration for a threshold setup is `threshold=2` with at 107 | least 3 servers listed. The maximum of servers is 128, but that is way too 108 | many, a reasonable max is around 16 or so. 109 | 110 | # FILES 111 | 112 | - /etc/opaque-store/config 113 | - ~/.config/opaque-store/config 114 | - ~/.opaque-storerc 115 | - ./opaque-store.cfg 116 | 117 | # SECURITY CONSIDERATIONS 118 | 119 | You **SHOULD** back up your configuration file, most importantly the 120 | value of `id_salt` and the names of the servers. 121 | 122 | # REPORTING BUGS 123 | 124 | https://github.com/stef/opaque-store/issues/ 125 | 126 | # AUTHOR 127 | 128 | Written by Stefan Marsiske. 129 | 130 | # COPYRIGHT 131 | 132 | Copyright © 2024 Stefan Marsiske. License GPLv3+: GNU GPL version 3 or later . 133 | This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. 134 | 135 | # SEE ALSO 136 | 137 | `https://www.ctrlc.hu/~stef/blog/posts/How_to_recover_static_secrets_using_OPAQUE.html` 138 | 139 | `opaquestore(1)` 140 | -------------------------------------------------------------------------------- /server/build.zig: -------------------------------------------------------------------------------- 1 | const std = @import("std"); 2 | 3 | // Although this function looks imperative, note that its job is to 4 | // declaratively construct a build graph that will be executed by an external 5 | // runner. 6 | pub fn build(b: *std.Build) void { 7 | // Standard target options allows the person running `zig build` to choose 8 | // what target to build for. Here we do not override the defaults, which 9 | // means any target is allowed, and the default is native. Other options 10 | // for restricting supported target set are available. 11 | const target = b.standardTargetOptions(.{}); 12 | 13 | // Standard optimization options allow the person running `zig build` to select 14 | // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. Here we do not 15 | // set a preferred release mode, allowing the user to decide how to optimize. 16 | const optimize = b.standardOptimizeOption(.{}); 17 | 18 | const pie = b.option(bool, "pie", "Build a Position Independent Executable") orelse true; 19 | const relro = b.option(bool, "relro", "Force all relocations to be read-only after processing") orelse true; 20 | 21 | // load the "zig-toml" dependency from build.zig.zon 22 | const toml_package = b.dependency("zig_toml", .{ 23 | .target = target, 24 | .optimize = optimize, 25 | }); 26 | const toml_module = toml_package.module("toml"); 27 | 28 | const bearssl_package = b.dependency("zig_bearssl", .{ 29 | .target = target, 30 | .optimize = optimize, 31 | }); 32 | const bearssl_module = bearssl_package.module("bearssl"); 33 | 34 | const exe = b.addExecutable(.{ 35 | .name = "opaqueztore", 36 | .root_source_file = b.path("src/main.zig"), 37 | .target = target, 38 | .optimize = optimize, 39 | .linkage = .static, 40 | }); 41 | 42 | exe.pie = pie; 43 | exe.link_z_relro = relro; 44 | exe.bundle_compiler_rt = true; 45 | exe.root_module.addImport("toml", toml_module); 46 | exe.root_module.addImport("bearssl", bearssl_module); 47 | exe.linkLibrary(bearssl_package.artifact("zig-bearssl")); 48 | //exe.linkSystemLibrary("opaque"); 49 | //exe.linkSystemLibrary("oprf"); 50 | //exe.linkSystemLibrary("sodium"); 51 | exe.addObjectFile(.{ .cwd_relative = ("/usr/lib/libopaque.a") }); 52 | exe.addObjectFile(.{ .cwd_relative = ("/usr/lib/libsodium.a") }); 53 | exe.addObjectFile(.{ .cwd_relative = ("/usr/lib/liboprf.a") }); 54 | exe.addObjectFile(.{ .cwd_relative = ("/usr/lib/liboprf-noiseXK.a") }); 55 | exe.addSystemIncludePath(.{ .cwd_relative = "/usr/include/oprf/noiseXK/" }); 56 | exe.addSystemIncludePath(.{ .cwd_relative = "/usr/include/oprf/noiseXK/karmel" }); 57 | exe.addSystemIncludePath(.{ .cwd_relative = "/usr/include/oprf/noiseXK/karmel/minimal" }); 58 | exe.addIncludePath(b.path(".")); 59 | exe.addCSourceFile(.{ .file = b.path("workaround.c"), .flags = &[_][]const u8{"-Wall"} }); 60 | exe.addCSourceFile(.{ .file = b.path("cc-runtime/cc-runtime.c"), .flags = &[_][]const u8{"-Wall"} }); 61 | //exe.linkLibC(); 62 | 63 | // This declares intent for the executable to be installed into the 64 | // standard location when the user invokes the "install" step (the default 65 | // step when running `zig build`). 66 | b.installArtifact(exe); 67 | 68 | // This *creates* a Run step in the build graph, to be executed when another 69 | // step is evaluated that depends on it. The next line below will establish 70 | // such a dependency. 71 | const run_cmd = b.addRunArtifact(exe); 72 | 73 | // By making the run step depend on the install step, it will be run from the 74 | // installation directory rather than directly from within the cache directory. 75 | // This is not necessary, however, if the application depends on other installed 76 | // files, this ensures they will be present and in the expected location. 77 | run_cmd.step.dependOn(b.getInstallStep()); 78 | 79 | // This allows the user to pass arguments to the application in the build 80 | // command itself, like this: `zig build run -- arg1 arg2 etc` 81 | if (b.args) |args| { 82 | run_cmd.addArgs(args); 83 | } 84 | 85 | // This creates a build step. It will be visible in the `zig build --help` menu, 86 | // and can be selected like this: `zig build run` 87 | // This will evaluate the `run` step rather than the default, which is "install". 88 | const run_step = b.step("run", "Run the app"); 89 | run_step.dependOn(&run_cmd.step); 90 | 91 | // Creates a step for unit testing. This only builds the test executable 92 | // but does not run it. 93 | //const lib_unit_tests = b.addTest(.{ 94 | // .root_source_file = b.path("src/root.zig"), 95 | // .target = target, 96 | // .optimize = optimize, 97 | //}); 98 | 99 | //const run_lib_unit_tests = b.addRunArtifact(lib_unit_tests); 100 | 101 | const exe_unit_tests = b.addTest(.{ 102 | .root_source_file = b.path("src/main.zig"), 103 | .target = target, 104 | .optimize = optimize, 105 | }); 106 | 107 | const run_exe_unit_tests = b.addRunArtifact(exe_unit_tests); 108 | 109 | // Similar to creating the run step earlier, this exposes a `test` step to 110 | // the `zig build --help` menu, providing a way for the user to request 111 | // running the unit tests. 112 | const test_step = b.step("test", "Run unit tests"); 113 | //test_step.dependOn(&run_lib_unit_tests.step); 114 | test_step.dependOn(&run_exe_unit_tests.step); 115 | } 116 | -------------------------------------------------------------------------------- /test/test.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | from os import listdir, path 3 | from shutil import rmtree 4 | #from io import BytesIO 5 | import sys, subprocess, time 6 | from opaquestore import client 7 | from opaquestore.cfg import getcfg 8 | import tracemalloc 9 | from pyoprf import multiplexer 10 | 11 | # to get coverage, run 12 | # PYTHONPATH=.. coverage run test.py 13 | # coverage report -m 14 | # to just run the tests do 15 | # python3 -m unittest discover --start-directory . 16 | 17 | # disable the output the client 18 | 19 | N = 3 20 | pwd = 'asdf' 21 | otherpwd = 'qwer' 22 | keyid = b"keyid" 23 | data = b"data1" 24 | 25 | #class Input: 26 | # def __init__(self, txt = None): 27 | # if txt: 28 | # self.buffer = BytesIO('\n'.join((pwd, txt)).encode()) 29 | # else: 30 | # self.buffer = BytesIO(pwd.encode()) 31 | # def isatty(self): 32 | # return False 33 | # def close(self): 34 | # return 35 | 36 | test_path = path.dirname(path.abspath(__file__)) 37 | client.config = client.processcfg(getcfg('opaque-store', test_path )) 38 | for s in client.config['servers'].keys(): 39 | client.config['servers'][s]['ssl_cert']='/'.join([test_path, client.config['servers'][s]['ssl_cert']]) 40 | client.config['servers'][s]['ltsigkey']='/'.join([test_path, client.config['servers'][s]['ltsigkey']]) 41 | 42 | def connect(peers=None): 43 | if peers == None: 44 | peers = dict(tuple(client.config['servers'].items())[:N]) 45 | m = multiplexer.Multiplexer(peers) 46 | m.connect() 47 | return m 48 | 49 | class TestEndToEnd(unittest.TestCase): 50 | @classmethod 51 | def setUpClass(cls): 52 | cls._oracles = [] 53 | for idx in range(N): 54 | log = open(f"{test_path}/servers/{idx}/log", "w") 55 | cls._oracles.append( 56 | (subprocess.Popen("../../../server/zig-out/bin/opaqueztore", cwd = f"{test_path}/servers/{idx}/", stdout=log, stderr=log, pass_fds=[log.fileno()]), log)) 57 | log.close() 58 | time.sleep(0.8) 59 | 60 | @classmethod 61 | def tearDownClass(cls): 62 | for p, log in cls._oracles: 63 | p.kill() 64 | r = p.wait() 65 | log.close() 66 | time.sleep(0.4) 67 | 68 | def tearDown(self): 69 | for idx in range(N): 70 | ddir = f"{test_path}/servers/{idx}/data/" 71 | if not path.exists(ddir): continue 72 | for f in listdir(ddir): 73 | rmtree(ddir+f) 74 | 75 | def test_create(self): 76 | with connect() as s: 77 | self.assertTrue(client.create(s, pwd, keyid, data)) 78 | 79 | def test_create_2x(self): 80 | with connect() as s: 81 | self.assertTrue(client.create(s, pwd, keyid, data)) 82 | with connect() as s: 83 | self.assertRaises(ValueError, client.create, s, pwd, keyid, data) 84 | 85 | def test_get(self): 86 | with connect() as s: 87 | self.assertTrue(client.create(s, pwd, keyid, data)) 88 | with connect() as s: 89 | res = client.get(s, pwd, keyid) 90 | self.assertIsInstance(res, str) 91 | self.assertEqual(res.encode('utf8'),data) 92 | 93 | def test_invalid_pwd(self): 94 | with connect() as s: 95 | self.assertTrue(client.create(s, pwd, keyid, data)) 96 | 97 | with connect() as s: 98 | self.assertRaises(ValueError, client.get, s, otherpwd, keyid) 99 | 100 | def test_invalid_keyid(self): 101 | with connect() as s: 102 | self.assertRaises(ValueError, client.get, s, pwd, keyid) 103 | 104 | def test_update(self): 105 | with connect() as s: 106 | self.assertTrue(client.create(s, pwd, keyid, data)) 107 | with connect() as s: 108 | res = client.get(s, pwd, keyid) 109 | self.assertIsInstance(res, str) 110 | self.assertEqual(res.encode('utf8'),data) 111 | 112 | updated = b"updated blob" 113 | with connect() as s: 114 | self.assertTrue(client.update(s, pwd, keyid, updated)) 115 | 116 | with connect() as s: 117 | res1 = client.get(s, pwd, keyid) 118 | self.assertIsInstance(res1, str) 119 | self.assertEqual(res1.encode('utf8'),updated) 120 | 121 | def test_update_invalid_pwd(self): 122 | with connect() as s: 123 | self.assertTrue(client.create(s, pwd, keyid, data)) 124 | with connect() as s: 125 | res = client.get(s, pwd, keyid) 126 | self.assertIsInstance(res, str) 127 | self.assertEqual(res.encode('utf8'),data) 128 | 129 | updated = b"updated blob" 130 | with connect() as s: 131 | self.assertRaises(ValueError, client.update, s, otherpwd, keyid, updated) 132 | 133 | def test_delete(self): 134 | with connect() as s: 135 | self.assertTrue(client.create(s, pwd, keyid, data)) 136 | 137 | with connect() as s: 138 | self.assertTrue(client.delete(s, pwd, keyid)) 139 | 140 | with connect() as s: 141 | self.assertRaises(ValueError, client.get, s, pwd, keyid) 142 | 143 | def test_delete_invalid_pwd(self): 144 | with connect() as s: 145 | self.assertTrue(client.create(s, pwd, keyid, data)) 146 | 147 | with connect() as s: 148 | self.assertRaises(ValueError, client.delete, s, otherpwd, keyid) 149 | 150 | def test_reset_fails(self): 151 | with connect() as s: 152 | self.assertTrue(client.create(s, pwd, keyid, data)) 153 | 154 | with connect() as s: 155 | self.assertRaises(ValueError, client.get, s, otherpwd, keyid) 156 | 157 | with connect() as s: 158 | res = client.get(s, pwd, keyid) 159 | self.assertIsInstance(res, str) 160 | self.assertEqual(res.encode('utf8'),data) 161 | 162 | def test_lock(self): 163 | with connect() as s: 164 | self.assertTrue(client.create(s, pwd, keyid, data)) 165 | 166 | # lock it 167 | for _ in range(3): 168 | with connect() as s: 169 | self.assertRaises(ValueError, client.get, s, otherpwd, keyid) 170 | 171 | # check that it is locked 172 | with connect() as s: 173 | self.assertRaises(ValueError, client.get, s, pwd, keyid) 174 | 175 | def test_get_rtoken(self): 176 | with connect() as s: 177 | self.assertTrue(client.create(s, pwd, keyid, data)) 178 | 179 | # get recovery token 180 | with connect() as s: 181 | rtoken = client.get_recovery_tokens(s, pwd, keyid) 182 | self.assertIsInstance(rtoken, str) 183 | 184 | def test_get_rtoken_invalid_pwd(self): 185 | with connect() as s: 186 | self.assertTrue(client.create(s, pwd, keyid, data)) 187 | 188 | # get recovery token 189 | with connect() as s: 190 | self.assertRaises(ValueError, client.get_recovery_tokens, s, otherpwd, keyid) 191 | 192 | def test_unlock(self): 193 | with connect() as s: 194 | self.assertTrue(client.create(s, pwd, keyid, data)) 195 | 196 | # get recovery token 197 | with connect() as s: 198 | rtoken = client.get_recovery_tokens(s, pwd, keyid) 199 | self.assertIsInstance(rtoken, str) 200 | 201 | # lock it 202 | for _ in range(3): 203 | with connect() as s: 204 | self.assertRaises(ValueError, client.get, s, otherpwd, keyid) 205 | 206 | # check that it is locked 207 | with connect() as s: 208 | self.assertRaises(ValueError, client.get, s, pwd, keyid) 209 | 210 | # unlock it 211 | with connect() as s: 212 | self.assertTrue(client.unlock(s, rtoken, keyid)) 213 | 214 | # check success of unlocking 215 | with connect() as s: 216 | res = client.get(s, pwd, keyid) 217 | self.assertIsInstance(res, str) 218 | self.assertEqual(res.encode('utf8'),data) 219 | 220 | def test_unlock_invalid_rtoken(self): 221 | with connect() as s: 222 | self.assertTrue(client.create(s, pwd, keyid, data)) 223 | 224 | # get recovery token 225 | with connect() as s: 226 | rtoken = client.get_recovery_tokens(s, pwd, keyid) 227 | self.assertIsInstance(rtoken, str) 228 | 229 | # lock it 230 | for _ in range(3): 231 | with connect() as s: 232 | self.assertRaises(ValueError, client.get, s, otherpwd, keyid) 233 | 234 | # check that it is locked 235 | with connect() as s: 236 | self.assertRaises(ValueError, client.get, s, pwd, keyid) 237 | 238 | # unlock it 239 | with connect() as s: 240 | self.assertRaises(ValueError, client.unlock, s, rtoken[::-1], keyid) 241 | 242 | # check success of unlocking 243 | with connect() as s: 244 | self.assertRaises(ValueError, client.get, s, pwd, keyid) 245 | 246 | if __name__ == '__main__': 247 | unittest.main() 248 | -------------------------------------------------------------------------------- /man/opaquestore.md: -------------------------------------------------------------------------------- 1 | # NAME 2 | 3 | opaquestore - command-line client for OPAQUE-Store 4 | 5 | # SYNOPSIS 6 | 7 | `opaquestore` genltsigkey [private-key path] [public-key path] 8 | 9 | echo -en 'password\ntoken2store' | `opaquestore` create 10 | 11 | echo -n 'password' | `opaquestore` get 12 | 13 | echo -en 'password\ntoken2update' | `opaquestore` update 14 | 15 | echo -en 'password\ntoken2update' | `opaquestore` force-update 16 | 17 | echo -n 'password' | `opaquestore` delete 18 | 19 | echo -n 'password' | `opaquestore` force-delete 20 | 21 | echo -n 'password' | `opaquestore` recovery-tokens 22 | 23 | echo -n | `opaquestore` unlock 24 | 25 | # DESCRIPTION 26 | 27 | OPAQUE-Store is a simple protocol that allows anyone to store 28 | encrypted blobs of information online, with only a password needed to 29 | retrieve the information. As the name implies it uses the OPAQUE 30 | protocol to do so. OPAQUE-Store uses the `export_key` feature of 31 | OPAQUE to encrypt the data that is stored on the OPAQUE-Storage 32 | server, it then stores the encrypted data on the OPAQUE-Store server. 33 | 34 | You might want to read this blog-post on this topic and on more info: 35 | `https://www.ctrlc.hu/~stef/blog/posts/How_to_recover_static_secrets_using_OPAQUE.html` 36 | 37 | OPAQUE-Store goes beyond the original OPAQUE protocol as specified by 38 | the IRTF/CFRG (todo insert link to RFC when finally published) and 39 | also supports a more secure and robust threshold variant of OPAQUE. In 40 | a threshold setup you have a number N of servers that all hold a share 41 | of your secret and at least a threshold number T of these need to 42 | cooperate to recover the secret. This provides extra robustness and 43 | dillution of responsibility (losing a server or two is not the end of 44 | the world!) while at the same time increases security, as an attacker 45 | now has to compromise at least T servers to get access to some 46 | information. 47 | 48 | ## Configuration 49 | 50 | For information on configuring `opaquestore`, see the man-page 51 | `opaque-store.cfg(5)`. 52 | 53 | ## Command-line usage and examples 54 | 55 | It is warmly recommended to use pwdsphinx (https://github.com/stef/pwdsphinx) 56 | as a front-end to opaquestore, since it handles passwords in a most secure 57 | manner. If you want to use a different password manager, you can use the CLI 58 | interface documented below. 59 | 60 | ### Passwords and Records 61 | 62 | `opaquestore` takes the password always on the standard input. If you 63 | are creating or updating a record, the record itself is also expected 64 | on the standard input. The password and the record - if required - are 65 | separated by a newline character. 66 | 67 | ### KeyIds 68 | 69 | KeyIds are the identifiers that you use to address your records, they 70 | can be any kind of string. Internally this keyId is hashed using the 71 | `id_salt` from the configurations `[client]` section into a unique 72 | identifier. It is very warmly recommended to set this to some random 73 | value, and to back this value up. As this salt is necessary to access 74 | your records. If you use a commonly used salt (i.e. the default salt) 75 | chances are high that there are collisions for record ids, and that 76 | people can guess your record ids, and in the worst case lock these 77 | down with repeated (wrong) password guesses. 78 | 79 | ## Command-line Operations 80 | 81 | ### Store a new record 82 | 83 | Storing a record needs 3 parameters: 84 | - the password, on standard input, terminated by a newline, followed by 85 | - the record itself until the end of standard input 86 | - and a keyId with which you can reference and act on this record 87 | 88 | ```sh 89 | $ echo -en 'password\ntoken2store' | opaquestore create 90 | ``` 91 | 92 | Here is a contrived example: 93 | 94 | ``` 95 | echo -en "mypassword\!sMyV0ice\nmy secretty token data that i need to protect and store using opaque" | opaquestore create myfirstblob 96 | ``` 97 | 98 | In this example: 99 | - the password is "mypassword!sMyV0ice" 100 | - the record is: "my secretty token data that i need to protect and store using opaque" 101 | - and the keyId is "myfirstblob" 102 | 103 | ### Get a record 104 | 105 | Retrieving a record has to parameters: 106 | 107 | - the password on standard input 108 | - the keyId as the 2nd parameter to `opaquestore` 109 | 110 | ```sh 111 | $ echo -n 'password' | opaquestore get 112 | ``` 113 | 114 | An example fetching the record created in the previous example: 115 | 116 | ``` 117 | echo -en "mypassword\!sMyV0ice" | opaquestore get myfirstblob 118 | ``` 119 | 120 | ### Update a record 121 | 122 | It is possible to update a record in place, it is essentially the same 123 | as the creation of a record. It is important to note, that this 124 | operation only succeeds, if all servers need to process this request, 125 | not only those needed for matching the threshold. You want to update 126 | the record on all servers not just some, otherwise later it might 127 | cause (temporary) corruption when old and updated servers answers are 128 | combined. 129 | 130 | 131 | ```sh 132 | $ echo -en 'password\ntoken2update' | opaquestore update 133 | ``` 134 | 135 | If you do not care if some servers will not be updated and you really 136 | know what you are doing, you can use the alternative command 137 | `force-update`, in this case the operation will succeed if at least 138 | the threshold is matched. Note however if any of the servers that did 139 | not participate in the forced update will participate in later 140 | operations will corrupt later operations, so you might want to remove 141 | those servers from your config, or block access to them. 142 | 143 | ```sh 144 | $ echo -en 'password\ntoken2update' | opaquestore force-update 145 | ``` 146 | 147 | ### Delete a record 148 | 149 | Deleting a record is very straight forward, you need your password and 150 | keyId, and ensure that all servers that store this record will all be 151 | available. The operation will fail if some servers are not available. 152 | 153 | ```sh 154 | $ echo -n 'password' | opaquestore delete 155 | ``` 156 | 157 | Similarly to the update operation there is also a forced delete 158 | operation, which will succeed if at least the threshold is 159 | matched. Servers not available during this forced delete will still 160 | hold the record, if your setup has a `n-out-of-2*n` setup could mean 161 | that you still have enough shares even after a forced-delete. 162 | 163 | ```sh 164 | $ echo -n 'password' | opaquestore force-delete 165 | ``` 166 | 167 | ### Get some recovery-tokens 168 | 169 | An attacker might be trying different passwords for your record, after 170 | a certain amount of consecutive password failures (by default 3) the 171 | server locks down the record. A locked record can only be unlocked 172 | with a recovery-token. It is not possible to ask for recovery-tokens 173 | when a record is already locked. 174 | 175 | ```sh 176 | $ echo -n 'password' | opaquestore recovery-tokens 177 | ``` 178 | 179 | ### Unlock a locked record using a recovery token 180 | 181 | If a record is locked, and you have a valid recovery-token you can 182 | reset the failure counter: 183 | 184 | ```sh 185 | $ echo -n | opaquestore unlock 186 | ``` 187 | 188 | ### Generate long-term signature keys 189 | 190 | This is a local operation only needed for setting up a new server. 191 | 192 | If you set up a new server, you need to generate some long-term signing keys if 193 | you want to use this server in a threshold setup. If you don't provide the path 194 | to the keys, the secret-key will be taken from the `ltsigkey` config value in 195 | your `opaque-storaged` configuration, and the public-key will be the same as 196 | the secret-key, but with a `.pub` extension. 197 | 198 | ``` 199 | $ opaquestore genltsigkey [secret-key path] [public-key path] 200 | ``` 201 | 202 | # SECURITY CONSIDERATIONS 203 | 204 | If you use OPAQUE-Store in a single-server setup, you need to use very strong 205 | high-entropy passwords, as the operator of the server (or anyone who has access 206 | to the server, maybe through a leak or hack) is able to run offline bruteforce 207 | attack against your password, and data. This threat is mitigated by using 208 | OPAQUE-Store in a threshold setup where all of the 3rd party servers combined 209 | fail to reach the threshold. 210 | 211 | You **SHOULD** back up your configuration, especially the `id_salt` and the 212 | names of the servers you are using, losing them means losing access to your data. 213 | 214 | # REPORTING BUGS 215 | 216 | https://github.com/stef/opaque-store/issues/ 217 | 218 | # AUTHOR 219 | 220 | Written by Stefan Marsiske. 221 | 222 | # COPYRIGHT 223 | 224 | Copyright © 2024 Stefan Marsiske. License GPLv3+: GNU GPL version 3 or later . 225 | This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. 226 | 227 | # SEE ALSO 228 | 229 | `https://www.ctrlc.hu/~stef/blog/posts/How_to_recover_static_secrets_using_OPAQUE.html` 230 | 231 | `opaque-store.cfg(5)` 232 | -------------------------------------------------------------------------------- /whitepaper.md: -------------------------------------------------------------------------------- 1 | # OPAQUE-Store Protocol Whitepaper 2 | 3 | OPAQUE-Store is a simple protocol that allows users to store data 4 | online protected by a password. By using the OPAQUE protocol the 5 | server never learns the password neither during "registration" nor 6 | during retrieval. OPAQUE is a protocol that is being specified by the 7 | IRTF Crypto Forum Research Group, and the publication of an RFC is 8 | imminent. The latest draft can be found at: 9 | 10 | https://datatracker.ietf.org/doc/draft-irtf-cfrg-opaque/ 11 | 12 | OPAQUE-Store takes the specified OPAQUE protocol further and also 13 | implements a threshold variant proposed by the original academic 14 | authors. 15 | 16 | ## OPAQUE in a nutshell 17 | 18 | OPAQUE consists of two flows, one to create a record on the server, 19 | and a second to interact with the server and existing record to 20 | execute an authenticated key exchange. 21 | 22 | Registration flow according to the IRTF/CFRG spec: 23 | 24 | ``` 25 | credentials parameters 26 | | | 27 | v v 28 | Client Server 29 | ------------------------------------------------ 30 | 1. registration request 31 | -------------------------> 32 | 2. registration response 33 | <------------------------- 34 | 3. record 35 | -------------------------> 36 | ------------------------------------------------ 37 | | | 38 | v v 39 | export_key record 40 | 41 | Fig. 1 - Registration flow 42 | copied from CFRG draft spec. 43 | ``` 44 | 45 | Note that in this picture it shows `export_key` as an output of this 46 | process, but really this value is available to the client already 47 | before sending the record to the server in step 3. An important 48 | detail, which OPAQUE-Store is using. 49 | 50 | The authenticated key exchange flow according to the IRTF/CFRG draft 51 | specification: 52 | 53 | ``` 54 | credentials (parameters, record) 55 | | | 56 | v v 57 | Client Server 58 | ------------------------------------------------ 59 | AKE message 1 60 | -------------------------> 61 | AKE message 2 62 | <------------------------- 63 | AKE message 3 64 | -------------------------> 65 | ------------------------------------------------ 66 | | | 67 | v v 68 | (export_key, session_key) session_key 69 | 70 | Fig 2. - AKE flow 71 | copied from CFRG draft spec. 72 | ``` 73 | 74 | ## OPAQUE-Store in a nutshell 75 | 76 | OPAQUE-Store uses the `export_key` to encrypt the data to be stored at 77 | the server, or servers in case of a threshold-OPAQUE setup. This 78 | `export_key` values is not known by the servers. The servers only 79 | supply the stored data or execute other management operations after 80 | the client has authenticated itself to the server correctly. 81 | 82 | ## Threshold operation 83 | 84 | Threshold OPAQUE is essentially just a threshold-OPRF[JKKX17] and 85 | separate AKEs - one for each server/shareholder - run in parallel. 86 | 87 | To create a new record, the servers run a distributed key generation 88 | (DKG) protocol conducted by a trusted party (TP) represented by the 89 | client as specified by: 90 | https://github.com/stef/liboprf/blob/master/docs/tp-dkg.txt 91 | 92 | In the threshold-setup every shareholder holds an identical copy of 93 | the protected plaintext, but with their own symmetric encryption-key 94 | based on the `export_key` but each with a unique nonce. On the level 95 | of encrypted blobs, the records are unlinkable across shareholders. 96 | Regrettably the OPAQUE record itself contains a `maskingkey` that is 97 | the same on all servers. 98 | 99 | Some of the operations require that all servers participate, not only 100 | enough for the threshold. `update`, and `delete` make only sense if 101 | all servers are participating, otherwise the ones left out will have 102 | conflicting data. In case that this is not possible, the protocol 103 | allows for forced `delete` and `updates`, but this should only be used 104 | carefully, and even in the forced variant is mandatory to have at 105 | least enough servers participate to reach the threshold. 106 | 107 | ## OPAQUE-Store operations 108 | 109 | OPAQUE-Store records are created using the `create` operation, this 110 | operation uses the "registration flow" of OPAQUE. If the configuration 111 | is a threshold configuration the "registration flow" is using the 112 | TP-DKG protocol to generate a shared OPRF secret. 113 | 114 | All other operations aside from the `create` operation use the "AKE 115 | flow" of OPAQUE to authenticate the user before executing the 116 | operation itself. 117 | 118 | Records are retrieved using the `get` operation. Records can be 119 | replaced using the `update` and erased using the `delete` 120 | operation. Locked records can be unlocked using the `unlock` 121 | operation, which needs a fresh recovery-token, which must be requested 122 | before a record is locked using the `request-tokens` operation. 123 | 124 | ## Record Keyids 125 | 126 | Record ids are used to address the records of by user. The arbitrary 127 | string provided by the user as a keyid is multiple times hashed, in 128 | order to guarantee that there is no accidental collision with records 129 | of other users, malicious users being able to guess records of others, 130 | and to make the records unlinkable between servers belonging to the 131 | same threshold setup of a client. A keyid goes through the following 132 | "evolution": 133 | 134 | 1. user provided string is hashed using blake2b with the `id_salt` 135 | from the configuration, into a user keyid 136 | 2. the user keyid is hashed into a server keyid by concatenating 137 | the name of the server and the user keyid and hashing it with 138 | blake2b. This is used as the id that is sent to the server. 139 | 3. finally to avoid the clients having any control over ids stored 140 | at the server, the server hashes the key id received from the 141 | user using blake2b and the servers `record_salt` value, 142 | generating the final id under which the record is stored. 143 | 144 | ## Encryption 145 | 146 | The blobs stored on the server are encrypted using `crypto_secretbox` 147 | as provided by libsodium (and as initially engineered in NaCl), and 148 | the key being the `export_key` from OPAQUE. 149 | 150 | 151 | ## Record Locking 152 | 153 | The way OPAQUE-Store is designed enables a server to know if a client 154 | is aware of the correct password or not. The server increases a failed 155 | login counter at the beginning of each "AKE flow", and decreases it 156 | after correct authentication by the client. If a pre-configured number 157 | of failed attempts is logged, the associated record is locked. 158 | 159 | ## Recovery tokens 160 | 161 | Recovery tokens can be used to unlock a locked record. Each server has 162 | a configured number of maximum allowed recovery tokens per 163 | record. Servers randomly return one of the allocated tokens or 164 | allocate a new one if the maximum is not yet reached. 165 | 166 | ## Security Limitations 167 | 168 | The records that are stored on the servers are linkable through the 169 | masking key in the OPAQUE record to their counterparts on other 170 | servers. Thus servers can coordinate or an attacker breaching enough 171 | servers can correlate records belonging to the same user and threshold 172 | setup. 173 | 174 | If enough server operators cooperate to reach the threshold, are able 175 | to run an offline bruteforce attack against the password protecting 176 | the record. This is slightly mitigated by the final key stretching 177 | function of OPAQUE is argon2i, which makes offline bruteforce attacks 178 | very slow. It is warmly recommended to use strong high-entropy 179 | passwords that come from a password manager like [SPHINX]. 180 | 181 | ## Threat-model 182 | 183 | 1. OPAQUE-Store does not protect against passwords leaking in any 184 | way, bet it shoulder-surfing, accousting side-channels, or 185 | key-logging malware. 186 | 187 | 2. OPAQUE-Store protects against passive attackers eavesdropping on 188 | communication between the client and the server(s). 189 | 190 | 3. OPAQUE-Store does not protect the encrypted data against a 191 | quantum-adversary having access to enough records to reach the 192 | threshold, while also having observed at least one registration or 193 | AKE flows in plaintext. 194 | 195 | 4. OPAQUE-Store protects against online-bruteforce attacks by using 196 | a locking mechanism. 197 | 198 | 5. OPAQUE-Store does not protect against-offline bruteforce attacks 199 | against the password if the attacker has access to enough records 200 | to reach the threshold. 201 | 202 | 6. Although the threshold setup itself protects the shared OPRF key 203 | unconditionally - due to its usage in OPAQUE -, the encrypted 204 | data, the password, and by consequence the key itself are only 205 | protected computationally. 206 | 207 | ## References 208 | 209 | [JKKX17] "TOPPSS: Cost-minimal Password-Protected Secret Sharing based 210 | on Threshold OPRF", 2017 by Stanislaw Jarecki, Aggelos Kiayias, Hugo 211 | Krawczyk, Jiayu Xu 212 | 213 | [SPHINX] https://sphinx.pm 214 | -------------------------------------------------------------------------------- /client/README.md: -------------------------------------------------------------------------------- 1 | # OPAQUE-Store 2 | 3 | OPAQUE-Store is a simple protocol that allows anyone to store 4 | encrypted blobs of information online, with only a password needed to 5 | retrieve the information. As the name implies it uses the OPAQUE 6 | protocol to do so. OPAQUE-Store uses the `export_key` feature of 7 | OPAQUE to encrypt the data that is stored on the OPAQUE-Storage 8 | server. 9 | 10 | You might want to read this blog-post on this topic and on more info: 11 | `https://www.ctrlc.hu/~stef/blog/posts/How_to_recover_static_secrets_using_OPAQUE.html` 12 | 13 | OPAQUE-Store goes beyond the original OPAQUE protocol as specified by 14 | the IRTF/CFRG and also supports a threshold variant of OPAQUE. In a 15 | threshold setup you have a number N of servers that all hold a share 16 | of your secret and at least a threshold number T of these need to 17 | cooperate to recover the secret. This provides extra robustness and 18 | dillution of responsibility (losing a server is not the end of the 19 | world!) while at the same time increases security, as an attacker now 20 | has to compromise at least T servers to get access to some 21 | information. 22 | 23 | ## Installation 24 | 25 | opaquestore depends on https://github.com/stef/libopaque/ which in turn depends 26 | on 27 | - libsodium, 28 | - https://github.com/stef/pysodium available on pypi, 29 | - https://github.com/stef/liboprf, and 30 | - pyoprf (part of https://github.com/stef/liboprf) available on pypi. 31 | 32 | When you have a working libopaque, a simple `pip install opaquestore` 33 | should get you started. 34 | 35 | ## Configuration 36 | 37 | Configuration will be looked for in the following order 38 | 39 | - /etc/opaque-store/config 40 | - ~/.config/opaque-store/config 41 | - ~/.opaque-storerc 42 | - ./opaque-store.cfg 43 | 44 | For an example and documentation on the values in the config files 45 | see: `opaque-store.cfg` for the client configuration, and - in case 46 | you want to run your own server(s) - `opaque-stored.cfg` for the 47 | server configuration. 48 | 49 | Example configuration with inline comments about each value: 50 | 51 | ``` 52 | [client] 53 | # you must change this value, it ensures that your record ids are 54 | # unique you must also make sure to not lose this value, if you do, 55 | # you lose access to your records. 56 | id_salt="Please_MUST-be_changed! and backed up to something difficult to guess" 57 | # the number of servers successfully participating in an 58 | # operation. must be less than 129, but lower 1 digit number are 59 | # probable the most robust. 60 | threshold=2 61 | # the time in seconds a distributed keygen (DKG) protocol message is 62 | # considered fresh. anything older than this is considered invalid and 63 | # aborts a DKG. Higher values help with laggy links, lower values can 64 | # be fine if you have high-speed connections to all servers. 65 | ts_epsilon=1200 66 | 67 | # the list of servers, must be 1 item, if threshold is 1, or one more 68 | # than threshold. 69 | [servers] 70 | [servers.zero] 71 | # address of server 72 | host="127.0.0.1" 73 | # port where server is running 74 | port=23000 75 | # self-signed public key of the server 76 | # - not needed for proper Lets Encrypt certs 77 | ssl_cert = "/etc/opaquestore/zero/cert.pem" 78 | ltsigkey="/etc/opaquestore/zero/zero.pub" 79 | 80 | [servers.eins] 81 | # address of server 82 | host="127.0.0.1" 83 | # port where server is running 84 | port=23001 85 | # public key of the server 86 | ltsigkey="/etc/opaquestore/eins/eins.pub" 87 | 88 | [servers.dva] 89 | # address of server 90 | host="127.0.0.1" 91 | # port where server is running 92 | port=23002 93 | # public key of the server 94 | ltsigkey="/etc/opaquestore/dva/dva.pub" 95 | ``` 96 | 97 | ## Threshold setup 98 | 99 | The client config file, contains a `[servers]` section which lists all 100 | servers you want to use in a threshold setup. Each server has an 101 | `address`, `port` and `ltsigkey` variable that needs to be set 102 | accordingly. In case your server runs with a self-signed certificate 103 | there is a `ssl_cert` variable that can pin it to the correct cert. 104 | It is also important to note, that the name of the server - which is 105 | given after a dot in the `[servers.name]` sub-section title is also 106 | used to generate record ids specific to that server. Thus once chosen, 107 | it should not change, unless you want to lose access to the records on 108 | that server. The name doesn't have to be unique by users, but should 109 | be unique among all configured servers in this setup, this guarantees 110 | that for a record each server has a different record it and thus makes 111 | the records unlinkable across servers. 112 | 113 | In the config files `[client]` section the `threshold` variable 114 | specifies the threshold for the setup. 115 | 116 | The minimum sane configuration for a threshold setup is `threshold=2` with at 117 | least 3 servers listed. The maximum of servers is 128, but that is way too 118 | many, a reasonable max is around 16 or so. 119 | 120 | ## Command-line usage and examples 121 | 122 | It is warmly recommended to use pwdsphinx (https://github.com/stef/pwdsphinx) 123 | as a front-end to opaquestore, since it handles passwords in a most secure 124 | manner. If you want to use a different password manager, you can use the CLI 125 | interface documented below. 126 | 127 | ### Passwords and Records 128 | 129 | opaquestore takes the password always on the standard input. If you 130 | are creating or updating a record, the record itself is also expected 131 | on the standard input. The password and the record - if required - are 132 | separated by a newline character. 133 | 134 | ### KeyIds 135 | 136 | KeyIds are the identifiers that you use to address your records, they 137 | can be any kind of string. Internally this keyId is hashed using the 138 | `id_salt` from the configurations `[client]` section into a unique 139 | identifier. It is very warmly recommended to set this to some random 140 | value, and to back this value up. As this salt is necessary to access 141 | your records. If you use a commonly used salt (i.e. the default salt) 142 | chances are high that there are collisions for record ids, and that 143 | people can guess your record ids. 144 | 145 | ### Store a new record 146 | 147 | Storing a record needs 3 parameters: 148 | - the password, on standard input, terminated by a newline. 149 | - the record itself until the end of the standard input 150 | - and a keyId with which you can reference and act on this record 151 | 152 | ```sh 153 | $ echo -en 'password\ntoken2store' | opaquestore create 154 | ``` 155 | 156 | Here is a contrived example: 157 | 158 | ``` 159 | echo -en "mypassword\!sMyV0ice\nmy secretty token data that i need to protect and store using opaque" | opaquestore create myfirstblob 160 | ``` 161 | 162 | In this example: 163 | - the password is "mypassword!sMyV0ice" 164 | - the record is: "my secretty token data that i need to protect and store using opaque" 165 | - and the keyId is "myfirstblob" 166 | 167 | ### Get a record 168 | 169 | Retrieving a record has to parameters: 170 | 171 | - the password on standard input 172 | - the keyId as the 2nd parameter to `opaquestore` 173 | 174 | ```sh 175 | $ echo -n 'password' | opaquestore get 176 | ``` 177 | 178 | An example fetching the record created in the previous example: 179 | 180 | ``` 181 | echo -en "mypassword\!sMyV0ice" | opaquestore get myfirstblob 182 | ``` 183 | 184 | ### Update a record 185 | 186 | It is possible to update a record in place, it is essentially the same 187 | as the creation of a record. It is important to note, that this 188 | operation only succeeds, if all servers need to process this request, 189 | not only those needed for matching the threshold, you want to update 190 | the record on all servers not just some. 191 | 192 | 193 | ```sh 194 | $ echo -en 'password\ntoken2update' | opaquestore update 195 | ``` 196 | 197 | If you do not care if some servers will not be updated and you really 198 | know what you are doing, you can use the alternative command 199 | `force-update`, in this case the operation will succeed if at least 200 | the threshold is matched. Note however if any of the servers that did 201 | not participate in the forced update will participate in later 202 | operations will corrupt later operations, so you might want to remove 203 | those servers from your config. 204 | 205 | ```sh 206 | $ echo -en 'password\ntoken2update' | opaquestore force-update 207 | ``` 208 | 209 | ### Delete a record 210 | 211 | Deleting a record is very straight forward, you need your password and 212 | keyId, and ensure that all servers that store this record will all be 213 | available. The operation will fail if some servers are not available. 214 | 215 | ```sh 216 | $ echo -n 'password' | opaquestore delete 217 | ``` 218 | 219 | Similarly to the update operation there is also a forced delete 220 | operation, which will succeed if at least the threshold is 221 | matched. Servers not available during this forced delete will still 222 | hold the record, if your setup has a n-out-of-2*n setup could mean 223 | that you still have enough shares even after a forced-delete. 224 | 225 | ```sh 226 | $ echo -n 'password' | opaquestore force-delete 227 | ``` 228 | 229 | ### Get some recovery-tokens 230 | 231 | An attacker might be trying different passwords for your record, after 232 | a certain amount of consecutive password failures (by default 3) the 233 | server locks down the record. A locked record can only be unlocked 234 | with a recovery-token. It is not possible to ask for recovery-tokens 235 | when a record is already locked. 236 | 237 | ```sh 238 | $ echo -n 'password' | opaquestore recovery-tokens 239 | ``` 240 | 241 | ### Unlock a locked record using a recovery token 242 | 243 | If a record is locked, and you have a valid recovery-token you can 244 | reset the failure counter: 245 | 246 | ```sh 247 | $ echo -n | opaquestore unlock 248 | ``` 249 | 250 | 251 | ### Generate long-term signature keys 252 | 253 | If you run server, you need to generate some long-term signing keys if you want 254 | to use this server in a threshold setup. If you don't provide the path to the 255 | keys, the secret-key will be taken from the `ltsigkey` config value in your 256 | `opaque-storaged` configuration, and the public-key will be the same as the 257 | secret-key, but with a `.pub` extension. 258 | 259 | ``` 260 | $ opaquestore genltsigkey [secret-key path] [public-key path] 261 | ``` 262 | -------------------------------------------------------------------------------- /client/opaquestore/client.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # SPDX-FileCopyrightText: 2018-2021, Marsiske Stefan 4 | # SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | import sys, os, getpass, ssl, socket, struct 7 | import pysodium, opaque, pyoprf 8 | try: 9 | from zxcvbn import zxcvbn 10 | except ImportError: 11 | zxcvbn = None 12 | from SecureString import clearmem 13 | from opaquestore.cfg import getcfg 14 | from pyoprf.multiplexer import Multiplexer 15 | from binascii import a2b_base64, b2a_base64 16 | from itertools import zip_longest 17 | 18 | #### consts #### 19 | 20 | CREATE =b'\x00' 21 | UPDATE =b'\x33' 22 | GET_RTOKEN =b'\x50' 23 | GET =b'\x66' 24 | CHANGE_DKG =b'\xa0' 25 | CREATE_DKG =b'\xf0' 26 | UNLOCK =b'\xf5' 27 | DELETE =b'\xff' 28 | 29 | config = None 30 | 31 | #### Helper fns #### 32 | 33 | def encrypt_blob(sk, blob): 34 | # todo implement padding to hide length information 35 | nonce = pysodium.randombytes(pysodium.crypto_secretbox_NONCEBYTES) 36 | ct = pysodium.crypto_secretbox(blob,nonce,sk) 37 | clearmem(sk) 38 | return nonce+ct 39 | 40 | def decrypt_blob(sk, blob): 41 | nonce = blob[:pysodium.crypto_secretbox_NONCEBYTES] 42 | blob = blob[pysodium.crypto_secretbox_NONCEBYTES:] 43 | res = pysodium.crypto_secretbox_open(blob,nonce,sk) 44 | clearmem(sk) 45 | return res 46 | 47 | def split_by_n(iterable, n): 48 | return list(zip_longest(*[iter(iterable)]*n, fillvalue='')) 49 | 50 | def getpwd(): 51 | if sys.stdin.isatty(): 52 | return getpass.getpass("please enter your password: ").encode('utf8') 53 | else: 54 | return sys.stdin.buffer.readline().rstrip(b'\n') 55 | 56 | def processcfg(config): 57 | servers = config.get('servers',{}) 58 | config = config.get('client',{}) 59 | 60 | config['threshold'] = int(config.get('threshold') or "1") 61 | config['ts_epsilon'] = int(config.get('ts_epsilon') or "1200") 62 | 63 | for server in servers.values(): 64 | try: 65 | server['ssl_cert'] = os.path.expanduser(server.get('ssl_cert')) # only for dev, production system should use proper certs! 66 | except TypeError: # ignore exception in case ssl_cert is not set, thus None is attempted to expand. 67 | server['ssl_cert'] = None 68 | 69 | if len(servers)>1: 70 | if config['threshold'] < 2: 71 | print('if you have multiple servers in your config, you must specify a threshold, which must be: len(servers) > threshold > 1 also') 72 | exit(1) 73 | if len(servers) 1: 77 | print(f'threshold({config["threshold"]}) must be less than the number of servers({len(servers)}) in your config') 78 | exit(1) 79 | config['servers']=servers 80 | 81 | return config 82 | 83 | def read_pkt(s,i,plen=None): 84 | res = [] 85 | if plen is None: 86 | plen = s[i].read(2) 87 | if len(plen)!=2: 88 | raise ValueError 89 | plen = struct.unpack(">H", plen)[0] 90 | 91 | read = 0 92 | while readH", len(msg)) 104 | if i is None: 105 | s.broadcast(plen+msg) 106 | else: 107 | s.send(i, plen+msg) 108 | 109 | def opaque_session(s, pwdU, keyid, op, force=False): 110 | # user initiates a credential request 111 | ke1_0, sec_0 = opaque.CreateCredentialRequest_oprf(pwdU) 112 | secs=[] 113 | for i, peer in enumerate(s): 114 | pkid = pysodium.crypto_generichash(str(i).encode('utf8') + keyid) 115 | 116 | ke1, sec = opaque.CreateCredentialRequest_ake(pwdU, sec_0, ke1_0) 117 | s.send(i, op+pkid+ke1) 118 | secs.append(sec) 119 | clearmem(sec_0) 120 | 121 | ke2s = s.gather(opaque.OPAQUE_SERVER_SESSION_LEN) 122 | attempts = dict([(i, struct.unpack(">i", a)[0]) for i, a in enumerate(s.gather(4)) if a is not None]) 123 | 124 | missing = [] 125 | for i, peer in enumerate(s): 126 | ke2 = ke2s[i] 127 | if ke2 is None: 128 | missing.append(i) 129 | print(f"oracle {i}: \"{peer.name} at {peer.address[0]}\" failed to load record or create opaque response", file=sys.stderr) 130 | 131 | if op == DELETE and len(missing)>0: 132 | raise ValueError(f'Delete operations require all servers to participate. Aborting. Use force-delete to delete from all available servers.') 133 | elif op == UPDATE and len(missing)>0: 134 | raise ValueError(f'Update operations require all servers to participate. Aborting. Use force-update to update all available servers.') 135 | elif (op == GET or force == True) and len(s) - len(missing) < config['threshold']: 136 | raise ValueError(f"Less than threshold ({config['threshold']}) number of servers available. Aborting.") 137 | 138 | indexes = bytes([i+1 for i,r in enumerate(ke2s) if r is not None]) 139 | resps = b''.join(r for r in ke2s if r is not None) 140 | beta = opaque.CombineCredentialResponses(config['threshold'], len(indexes), indexes, resps) 141 | 142 | auths = [] 143 | export_keys = [] 144 | sks = [] 145 | for i, peer in enumerate(s): 146 | ke2 = ke2s[i] 147 | ## user recovers its credentials from the servers response 148 | try: 149 | sk, authU, export_key = opaque.RecoverCredentials(ke2, secs[i], b"opaque-store", opaque.Ids(None, None), 150 | beta, unlink_masking_key = str(i).encode('utf8')) 151 | except: 152 | print(f'{s[i].name} ({s[i].address[0]}): {attempts.get(i, "?")} attempts left', file=sys.stderr) 153 | 154 | raise ValueError(f"opaque failed, possibly wrong password?") 155 | clearmem(secs[i]) 156 | if op in {GET_RTOKEN}: 157 | sks.append(sk) 158 | else: 159 | clearmem(sk) 160 | auths.append((i, authU)) 161 | if op in {GET, UPDATE}: 162 | export_keys.append(export_key) 163 | else: 164 | clearmem(export_key) 165 | 166 | for i, authU in auths: 167 | s.send(i, authU) 168 | clearmem(authU) 169 | 170 | # TODO we are in trouble if op in UPDATE/DELETE but connection drops, or we are partly? unauthorized, can that happen? 171 | if op in {GET, UPDATE}: 172 | return export_keys 173 | if op in {GET_RTOKEN}: 174 | return sks 175 | 176 | def dkg(m, threshold): 177 | n = len(m) 178 | 179 | # load peer long-term keys 180 | peer_lt_pks = [] 181 | for name, server in config['servers'].items(): 182 | with open(server.get('ltsigkey'),'rb') as fd: 183 | peer_lt_pk = fd.read() 184 | if(len(peer_lt_pk)!=pysodium.crypto_sign_PUBLICKEYBYTES): 185 | raise ValueError(f"long-term signature key for server {name} is of incorrect size") 186 | peer_lt_pks.append(peer_lt_pk) 187 | 188 | zero_shares = pyoprf.create_shares(bytes([0]*32), n, config['threshold']) 189 | 190 | tp, msg0 = pyoprf.tpdkg_start_tp(n, threshold, config['ts_epsilon'], "threshold opaque dkg create k", peer_lt_pks) 191 | m.broadcast(msg0) 192 | for i in range(n): 193 | m.send(i, zero_shares[i]) 194 | 195 | while pyoprf.tpdkg_tp_not_done(tp): 196 | cur_step = pyoprf.tpdkg_tpstate_step(tp) 197 | ret, sizes = pyoprf.tpdkg_tp_input_sizes(tp) 198 | #print(f"step: {cur_step} {ret} {sizes}", file=sys.stderr) 199 | peer_msgs = [] 200 | if ret: 201 | if sizes[0] > 0: 202 | peer_msgs_sizes = m.gather(2,n) #,debug=True) 203 | for i, (msize, size) in enumerate(zip(peer_msgs_sizes, sizes)): 204 | if struct.unpack(">H", msize)[0]!=size: 205 | raise ValueError(f"peer{i} ({m[i].name}{m[i].address}) sent invalid sized ({msize}) response, should be {size}") 206 | peer_msgs = m.gather(sizes[0],n) #,debug=True) 207 | else: 208 | peer_msgs = [read_pkt(m, i) if s>0 else b'' for i, s in enumerate(sizes)] 209 | for i, (pkt, size) in enumerate(zip(peer_msgs, sizes)): 210 | if(len(pkt)!=size): 211 | raise ValueError(f"peer{i} ({m[i].name}{m[i].address}) sent invalid sized ({len(pkt)}) response, should be {size}") 212 | #print(f"[{i}] received {pkt.hex()}", file=sys.stderr) 213 | msgs = b''.join(peer_msgs) 214 | 215 | try: 216 | out = pyoprf.tpdkg_tp_next(tp, msgs) 217 | except Exception as e: 218 | m.close() 219 | if pyoprf.tpdkg_tpstate_cheater_len(tp) > 0: 220 | cheaters, cheats = pyoprf.tpdkg_get_cheaters(tp) 221 | msg=[f"Warning during the distributed key generation the peers misbehaved: {sorted(cheaters)}"] 222 | for k, v in cheats: 223 | msg.append(f"\tmisbehaving peer: {k} was caught: {v}") 224 | msg = '\n'.join(msg) 225 | raise ValueError(msg) 226 | else: 227 | raise ValueError(f"{e} | tp step {cur_step}") 228 | #print(f"outlen: {len(out)}", file=sys.stderr) 229 | if(len(out)>0): 230 | for i in range(pyoprf.tpdkg_tpstate_n(tp)): 231 | msg = pyoprf.tpdkg_tp_peer_msg(tp, out, i) 232 | #print(f"sending({i} {m[i].name}({m[i].address}), {msg.hex()})", file=sys.stderr) 233 | send_pkt(m, msg, i) 234 | 235 | #### OPs #### 236 | 237 | def create(s, pwdU, keyid, data): 238 | secs=[] 239 | op = CREATE 240 | if config['threshold'] > 1: 241 | op = CREATE_DKG 242 | 243 | sec, req = opaque.CreateRegistrationRequest(pwdU) 244 | for i, peer in enumerate(s): 245 | # TODO TBA hashing the peername means that they cannot be changed 246 | # later maybe hash i instead? 247 | pkid = pysodium.crypto_generichash(str(i).encode('utf8') + keyid) 248 | s.send(i, op+pkid+req) 249 | 250 | if op == CREATE_DKG: 251 | # conduct DKG 252 | dkg(s, config['threshold']) 253 | 254 | resps = s.gather(opaque.OPAQUE_REGISTER_PUBLIC_LEN) 255 | 256 | if op == CREATE_DKG: 257 | # combine shares into beta 258 | tmp = b''.join(resps) 259 | opaque.CombineRegistrationResponses(config['threshold'], len(resps), tmp) 260 | resps = split_by_n(tmp, opaque.OPAQUE_REGISTER_PUBLIC_LEN) 261 | 262 | recs=[] 263 | blobs=[] 264 | for i, peer in enumerate(s): 265 | pub = bytes(resps[i]) 266 | if pub is None: 267 | raise ValueError("oracle failed to create registration response") 268 | #print("received pub:", len(pub), opaque.OPAQUE_REGISTER_PUBLIC_LEN, pub.hex()) 269 | 270 | rec, export_key = opaque.FinalizeRequest(sec, pub, opaque.Ids(None, None), 271 | unlink_masking_key = str(i).encode('utf8')) 272 | 273 | recs.append(rec) 274 | blob = encrypt_blob(export_key[:pysodium.crypto_aead_xchacha20poly1305_ietf_KEYBYTES], data) 275 | blobs.append(blob) 276 | 277 | for i, peer in enumerate(s): 278 | #print("send rec") 279 | s.send(i,recs[i]) 280 | #print("send blob") 281 | send_pkt(s, blobs[i], i) 282 | 283 | for i, peer in enumerate(s): 284 | ret = read_pkt(s,i,2) 285 | if ret is None: 286 | raise ValueError("oracle failed to complete creation of record and/or blob") 287 | if ret != b'ok': 288 | raise ValueError("oracle failed to acknowledge success") 289 | return True 290 | 291 | def get(s, pwdU, keyid): 292 | export_keys = opaque_session(s, pwdU, keyid, GET) 293 | 294 | blobs = [] 295 | for i, peer in enumerate(s): 296 | data = read_pkt(s,i) 297 | if data is None: 298 | raise ValueError("unauthorized") 299 | blobs.append(decrypt_blob(export_keys[i][:pysodium.crypto_aead_xchacha20poly1305_ietf_KEYBYTES], data)) 300 | clearmem(export_keys[i]) 301 | blobs = {blob.decode('utf8') for blob in blobs} 302 | if len(blobs) != 1: 303 | raise ValueError("inconsistent blobs recovered") 304 | return list(blobs)[0] 305 | 306 | def delete(s, pwdU, keyid, force=False): 307 | opaque_session(s, pwdU, keyid, DELETE, force) 308 | # todo ensure that all peers are connected! 309 | for i, peer in enumerate(s): 310 | ret = read_pkt(s,i,2) 311 | if ret is None: 312 | raise ValueError("unauthorized") 313 | if ret != b'ok': 314 | raise ValueError("oracle failed to acknowledge success") 315 | return True 316 | 317 | def update(s, pwdU, keyid, data, force=False): 318 | export_keys = opaque_session(s, pwdU, keyid, UPDATE, force) 319 | # todo ensure that all peers are connected! 320 | blobs = [] 321 | for i, peer in enumerate(s): 322 | blob = encrypt_blob(export_keys[i][:pysodium.crypto_aead_xchacha20poly1305_ietf_KEYBYTES], data) 323 | blobs.append(blob) 324 | 325 | for i, peer in enumerate(s): 326 | send_pkt(s, blobs[i], i) 327 | 328 | for i, peer in enumerate(s): 329 | ret = read_pkt(s,i,2) 330 | if ret is None: 331 | raise ValueError("unauthorized") 332 | if ret != b'ok': 333 | raise ValueError("oracle failed to acknowledge success") 334 | return True 335 | 336 | def get_recovery_tokens(s, pwdU, keyid): 337 | sks = opaque_session(s, pwdU, keyid, GET_RTOKEN) 338 | 339 | tokens = [] 340 | for i, peer in enumerate(s): 341 | data = read_pkt(s,i) 342 | if data is None: 343 | raise ValueError("unauthorized") 344 | tokens.append(decrypt_blob(sks[i][:pysodium.crypto_aead_xchacha20poly1305_ietf_KEYBYTES], data)) 345 | clearmem(sks[i]) 346 | return b2a_base64(b''.join(tokens)).strip().decode('utf8') 347 | 348 | def unlock(s, pwdU, keyid): 349 | tokens = split_by_n(a2b_base64(pwdU), 16) 350 | for i, peer in enumerate(s): 351 | pkid = pysodium.crypto_generichash(str(i).encode('utf8') + keyid) 352 | s.send(i, UNLOCK+pkid+bytes(tokens[i])) 353 | oks = s.gather(2) 354 | for i, ok in enumerate(oks): 355 | if ok != b'ok': 356 | raise ValueError(f"oracle ({s[i].name} @{s[i].address[0]}) failed to acknowledge success") 357 | return True 358 | 359 | def genltsigkey(skpath=None, pkpath=None): 360 | if skpath is None: 361 | server_config = getcfg('opaque-stored')['server'] 362 | 363 | if skpath is None: 364 | skpath = server_config['ltsigkey'] 365 | 366 | if pkpath is None: 367 | pkpath = f"{skpath}.pub" 368 | 369 | if os.path.exists(skpath): 370 | print(f"{skpath} exists, refusing to overwrite, if you want to generate a new one, delete the old one first. aborting") 371 | return 1 372 | if os.path.exists(pkpath): 373 | print(f"{pkpath} exists, refusing to overwrite, if you want to generate a new one, delete the old one first. aborting") 374 | return 1 375 | 376 | pk, sk = pysodium.crypto_sign_keypair() 377 | with open(skpath, 'wb') as fd: 378 | fd.write(sk) 379 | with open(pkpath, 'wb') as fd: 380 | fd.write(pk) 381 | print(f"wrote secret-key to {skpath} and public-key to {pkpath}.") 382 | 383 | def usage(params, help=False): 384 | print("usage: %s " % params[0]) 385 | print(" %s genltsigkey [private-key path] [public-key path]" % params[0]) 386 | print(" echo -en 'password\\ntoken2store' | %s create " % params[0]) 387 | print(" echo -n 'password' | %s get " % params[0]) 388 | print(" echo -en 'password\\ntoken2update' | %s update " % params[0]) 389 | print(" echo -en 'password\\ntoken2update' | %s force-update " % params[0]) 390 | print(" echo -n 'password' | %s delete " % params[0]) 391 | print(" echo -n 'password' | %s force-delete " % params[0]) 392 | print(" echo -n 'password' | %s recovery-tokens " % params[0]) 393 | print(" echo -n | %s unlock " % params[0]) 394 | 395 | if help: sys.exit(0) 396 | sys.exit(100) 397 | 398 | def test_pwd(pwd): 399 | if zxcvbn is None: return 400 | q = zxcvbn(pwd.decode('utf8')) 401 | print("your %s%s (%s/4) master password can be online recovered in %s, and offline in %s, trying ~%s guesses" % 402 | ("★" * q['score'], 403 | "☆" * (4-q['score']), 404 | q['score'], 405 | q['crack_times_display']['online_throttling_100_per_hour'], 406 | q['crack_times_display']['offline_slow_hashing_1e4_per_second'], 407 | q['guesses']), file=sys.stderr) 408 | 409 | #### main #### 410 | 411 | cmds = {'create': create, 412 | 'get': get, 413 | 'update': update, 414 | 'force-update': update, 415 | 'delete': delete, 416 | 'force-delete': delete, 417 | 'recovery-tokens': get_recovery_tokens, 418 | 'unlock': unlock, 419 | 'genltsigkey': genltsigkey, 420 | } 421 | 422 | def main(params=sys.argv): 423 | #import ctypes 424 | #libc = ctypes.cdll.LoadLibrary('libc.so.6') 425 | #fdopen = libc.fdopen 426 | #log_file = ctypes.c_void_p.in_dll(pyoprf.liboprf,'log_file') 427 | #fdopen.restype = ctypes.c_void_p 428 | #log_file.value = fdopen(2, 'w') 429 | 430 | if len(params) < 2: usage(params, True) 431 | cmd = None 432 | args = [] 433 | if params[1] in ('help', '-h', '--help'): 434 | usage(params, True) 435 | 436 | if params[1] not in cmds: 437 | usage(params) 438 | 439 | if params[1] == "genltsigkey": 440 | sys.exit(genltsigkey(*params[2:])) 441 | 442 | global config 443 | config = processcfg(getcfg('opaque-store')) 444 | 445 | if len(params) != 3: usage(params) 446 | pwd = getpwd() 447 | cmd = cmds[params[1]] 448 | 449 | if params[1] == 'create': 450 | test_pwd(pwd) 451 | data = sys.stdin.buffer.read() 452 | args = (data,) 453 | elif params[1] in {'update', 'force-update'}: 454 | test_pwd(pwd) 455 | data = sys.stdin.buffer.read() 456 | if params[1] == 'force-update': 457 | args = (data,True) 458 | else: 459 | args = (data,) 460 | elif params[1] == 'force-delete': 461 | args = (True,) 462 | 463 | error = None 464 | s = None 465 | try: 466 | s = Multiplexer(config['servers']) 467 | s.connect() 468 | ret = cmd(s, pwd, pysodium.crypto_generichash(params[2], k=config['id_salt']), *args) 469 | except Exception as exc: 470 | error = exc 471 | ret = False 472 | raise # only for dbg 473 | clearmem(pwd) 474 | s.close() 475 | 476 | if not ret: 477 | if not error: 478 | print("fail", file=sys.stderr) 479 | sys.exit(3) # error not handled by exception 480 | print(error, file=sys.stderr) 481 | sys.exit(1) # generic errors 482 | 483 | if cmd in {get, get_recovery_tokens}: 484 | print(ret) 485 | sys.stdout.flush() 486 | clearmem(ret) 487 | elif ret != True: 488 | print("reached code that should not be reachable: ", ret) 489 | 490 | if __name__ == '__main__': 491 | try: 492 | main(sys.argv) 493 | except Exception: 494 | print("fail", file=sys.stderr) 495 | raise # only for dbg 496 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /client/LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------