plaincloak 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. plaincloak-1.0.0/.gitignore +211 -0
  2. plaincloak-1.0.0/CHANGELOG.md +36 -0
  3. plaincloak-1.0.0/CONFORMANCE.md +52 -0
  4. plaincloak-1.0.0/LICENSE +213 -0
  5. plaincloak-1.0.0/PKG-INFO +291 -0
  6. plaincloak-1.0.0/README.md +250 -0
  7. plaincloak-1.0.0/SECURITY.md +26 -0
  8. plaincloak-1.0.0/pyproject.toml +108 -0
  9. plaincloak-1.0.0/scripts/sync_vectors.py +141 -0
  10. plaincloak-1.0.0/src/plaincloak/__init__.py +85 -0
  11. plaincloak-1.0.0/src/plaincloak/__main__.py +6 -0
  12. plaincloak-1.0.0/src/plaincloak/_version.py +1 -0
  13. plaincloak-1.0.0/src/plaincloak/api.py +409 -0
  14. plaincloak-1.0.0/src/plaincloak/cli/__init__.py +0 -0
  15. plaincloak-1.0.0/src/plaincloak/cli/__main__.py +6 -0
  16. plaincloak-1.0.0/src/plaincloak/cli/_io.py +576 -0
  17. plaincloak-1.0.0/src/plaincloak/cli/cmd_decrypt.py +158 -0
  18. plaincloak-1.0.0/src/plaincloak/cli/cmd_encrypt.py +133 -0
  19. plaincloak-1.0.0/src/plaincloak/cli/cmd_inspect.py +65 -0
  20. plaincloak-1.0.0/src/plaincloak/cli/cmd_keygen.py +126 -0
  21. plaincloak-1.0.0/src/plaincloak/cli/cmd_keystore.py +455 -0
  22. plaincloak-1.0.0/src/plaincloak/cli/cmd_qr.py +91 -0
  23. plaincloak-1.0.0/src/plaincloak/cli/main.py +69 -0
  24. plaincloak-1.0.0/src/plaincloak/core/__init__.py +0 -0
  25. plaincloak-1.0.0/src/plaincloak/core/base62.py +78 -0
  26. plaincloak-1.0.0/src/plaincloak/core/body.py +100 -0
  27. plaincloak-1.0.0/src/plaincloak/core/canonical.py +68 -0
  28. plaincloak-1.0.0/src/plaincloak/core/compression.py +134 -0
  29. plaincloak-1.0.0/src/plaincloak/core/constants.py +15 -0
  30. plaincloak-1.0.0/src/plaincloak/core/envelope.py +147 -0
  31. plaincloak-1.0.0/src/plaincloak/core/keys.py +177 -0
  32. plaincloak-1.0.0/src/plaincloak/core/keystore.py +732 -0
  33. plaincloak-1.0.0/src/plaincloak/core/qr.py +146 -0
  34. plaincloak-1.0.0/src/plaincloak/core/schemas/algorithms.json +61 -0
  35. plaincloak-1.0.0/src/plaincloak/core/schemas/compression.json +32 -0
  36. plaincloak-1.0.0/src/plaincloak/core/schemas/keystore.schema.json +127 -0
  37. plaincloak-1.0.0/src/plaincloak/core/schemas/message.schema.json +64 -0
  38. plaincloak-1.0.0/src/plaincloak/core/suites/__init__.py +33 -0
  39. plaincloak-1.0.0/src/plaincloak/core/suites/base.py +146 -0
  40. plaincloak-1.0.0/src/plaincloak/core/suites/rsa_oaep_aes256gcm_sha256.py +98 -0
  41. plaincloak-1.0.0/src/plaincloak/core/suites/rsa_oaep_sha256.py +64 -0
  42. plaincloak-1.0.0/src/plaincloak/exceptions.py +89 -0
  43. plaincloak-1.0.0/src/plaincloak/py.typed +0 -0
  44. plaincloak-1.0.0/src/plaincloak/types.py +147 -0
  45. plaincloak-1.0.0/tests/__init__.py +0 -0
  46. plaincloak-1.0.0/tests/conformance/__init__.py +0 -0
  47. plaincloak-1.0.0/tests/conformance/runner.py +183 -0
  48. plaincloak-1.0.0/tests/conformance/test_vectors.py +58 -0
  49. plaincloak-1.0.0/tests/conftest.py +54 -0
  50. plaincloak-1.0.0/tests/integration/__init__.py +0 -0
  51. plaincloak-1.0.0/tests/integration/test_module_entry.py +201 -0
  52. plaincloak-1.0.0/tests/integration/test_outcomes.py +236 -0
  53. plaincloak-1.0.0/tests/integration/test_roundtrip_direct.py +102 -0
  54. plaincloak-1.0.0/tests/integration/test_roundtrip_hybrid.py +124 -0
  55. plaincloak-1.0.0/tests/unit/__init__.py +0 -0
  56. plaincloak-1.0.0/tests/unit/test_base62.py +62 -0
  57. plaincloak-1.0.0/tests/unit/test_body_validation.py +111 -0
  58. plaincloak-1.0.0/tests/unit/test_canonical.py +79 -0
  59. plaincloak-1.0.0/tests/unit/test_cli.py +116 -0
  60. plaincloak-1.0.0/tests/unit/test_compression_budget.py +79 -0
  61. plaincloak-1.0.0/tests/unit/test_envelope_parse.py +126 -0
  62. plaincloak-1.0.0/tests/unit/test_exceptions.py +125 -0
  63. plaincloak-1.0.0/tests/unit/test_key_hash.py +103 -0
  64. plaincloak-1.0.0/tests/unit/test_keystore.py +291 -0
  65. plaincloak-1.0.0/tests/unit/test_qr.py +105 -0
  66. plaincloak-1.0.0/tests/vectors/v1/README.md +91 -0
  67. plaincloak-1.0.0/tests/vectors/v1/deterministic/01-base62-encode.json +101 -0
  68. plaincloak-1.0.0/tests/vectors/v1/deterministic/02-base62-decode.json +146 -0
  69. plaincloak-1.0.0/tests/vectors/v1/deterministic/03-brotli-roundtrip.json +95 -0
  70. plaincloak-1.0.0/tests/vectors/v1/deterministic/04-canonical-form.json +65 -0
  71. plaincloak-1.0.0/tests/vectors/v1/deterministic/05-key-hash-spki.json +42 -0
  72. plaincloak-1.0.0/tests/vectors/v1/deterministic/06-message-id-formatting.json +112 -0
  73. plaincloak-1.0.0/tests/vectors/v1/fixtures/keys/alice-rsa2048-priv.pem +28 -0
  74. plaincloak-1.0.0/tests/vectors/v1/fixtures/keys/alice-rsa2048-pub.pem +9 -0
  75. plaincloak-1.0.0/tests/vectors/v1/fixtures/keys/bob-rsa4096-priv.pem +52 -0
  76. plaincloak-1.0.0/tests/vectors/v1/fixtures/keys/bob-rsa4096-pub.pem +14 -0
  77. plaincloak-1.0.0/tests/vectors/v1/fixtures/keys/stranger-rsa2048-priv.pem +28 -0
  78. plaincloak-1.0.0/tests/vectors/v1/fixtures/keys/stranger-rsa2048-pub.pem +9 -0
  79. plaincloak-1.0.0/tests/vectors/v1/schema.json +63 -0
  80. plaincloak-1.0.0/tests/vectors/v1/verification/01-rsa2048-roundtrip.json +34 -0
  81. plaincloak-1.0.0/tests/vectors/v1/verification/02-rsa4096-roundtrip.json +34 -0
  82. plaincloak-1.0.0/tests/vectors/v1/verification/03-tampered-payload.json +30 -0
  83. plaincloak-1.0.0/tests/vectors/v1/verification/04-tampered-signature.json +30 -0
  84. plaincloak-1.0.0/tests/vectors/v1/verification/05-wrong-recipient.json +25 -0
  85. plaincloak-1.0.0/tests/vectors/v1/verification/06-unknown-sender.json +25 -0
  86. plaincloak-1.0.0/tests/vectors/v1/verification/07-rsa2048-hybrid-roundtrip.json +35 -0
  87. plaincloak-1.0.0/tests/vectors/v1/verification/08-rsa4096-hybrid-roundtrip.json +35 -0
  88. plaincloak-1.0.0/tests/vectors/v1/verification/09-hybrid-long-plaintext.json +35 -0
  89. plaincloak-1.0.0/tests/vectors/v1/verification/10-hybrid-tampered-wrap.json +30 -0
  90. plaincloak-1.0.0/tests/vectors/v1/verification/11-hybrid-tampered-tag.json +30 -0
  91. plaincloak-1.0.0/tests/vectors/v1/verification/12-hybrid-signature-invalid.json +34 -0
@@ -0,0 +1,211 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ *.lcov
51
+ .hypothesis/
52
+ .pytest_cache/
53
+ cover/
54
+
55
+ # Translations
56
+ *.mo
57
+ *.pot
58
+
59
+ # Django stuff:
60
+ *.log
61
+ local_settings.py
62
+ db.sqlite3
63
+ db.sqlite3-journal
64
+
65
+ # Flask stuff:
66
+ instance/
67
+ .webassets-cache
68
+
69
+ # Scrapy stuff:
70
+ .scrapy
71
+
72
+ # Sphinx documentation
73
+ docs/_build/
74
+
75
+ # PyBuilder
76
+ .pybuilder/
77
+ target/
78
+
79
+ # Jupyter Notebook
80
+ .ipynb_checkpoints
81
+
82
+ # IPython
83
+ profile_default/
84
+ ipython_config.py
85
+
86
+ # pyenv
87
+ # For a library or package, you might want to ignore these files since the code is
88
+ # intended to run in multiple environments; otherwise, check them in:
89
+ # .python-version
90
+
91
+ # pipenv
92
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
93
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
94
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
95
+ # install all needed dependencies.
96
+ # Pipfile.lock
97
+
98
+ # UV
99
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
100
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
101
+ # commonly ignored for libraries.
102
+ # uv.lock
103
+
104
+ # poetry
105
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
106
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
107
+ # commonly ignored for libraries.
108
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
109
+ # poetry.lock
110
+ # poetry.toml
111
+
112
+ # pdm
113
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
114
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
115
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
116
+ # pdm.lock
117
+ # pdm.toml
118
+ .pdm-python
119
+ .pdm-build/
120
+
121
+ # pixi
122
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
123
+ # pixi.lock
124
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
125
+ # in the .venv directory. It is recommended not to include this directory in version control.
126
+ .pixi/*
127
+ !.pixi/config.toml
128
+
129
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
130
+ __pypackages__/
131
+
132
+ # Celery stuff
133
+ celerybeat-schedule*
134
+ celerybeat.pid
135
+
136
+ # Redis
137
+ *.rdb
138
+ *.aof
139
+ *.pid
140
+
141
+ # RabbitMQ
142
+ mnesia/
143
+ rabbitmq/
144
+ rabbitmq-data/
145
+
146
+ # ActiveMQ
147
+ activemq-data/
148
+
149
+ # SageMath parsed files
150
+ *.sage.py
151
+
152
+ # Environments
153
+ .env
154
+ .envrc
155
+ .venv
156
+ env/
157
+ venv/
158
+ ENV/
159
+ env.bak/
160
+ venv.bak/
161
+
162
+ # Spyder project settings
163
+ .spyderproject
164
+ .spyproject
165
+
166
+ # Rope project settings
167
+ .ropeproject
168
+
169
+ # mkdocs documentation
170
+ /site
171
+
172
+ # mypy
173
+ .mypy_cache/
174
+ .dmypy.json
175
+ dmypy.json
176
+
177
+ # Pyre type checker
178
+ .pyre/
179
+
180
+ # pytype static type analyzer
181
+ .pytype/
182
+
183
+ # Cython debug symbols
184
+ cython_debug/
185
+
186
+ # PyCharm
187
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
188
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
189
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
190
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
191
+ .idea/
192
+
193
+ # Visual Studio Code
194
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
195
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
196
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
197
+ # you could uncomment the following to ignore the entire vscode folder
198
+ .vscode/
199
+ # Temporary file for partial code execution
200
+ tempCodeRunnerFile.py
201
+
202
+ # Ruff stuff:
203
+ .ruff_cache/
204
+
205
+ # PyPI configuration file
206
+ .pypirc
207
+
208
+ # Vendored from ../plaincloak-spec/ via scripts/sync_vectors.py.
209
+ # Run the sync script after clone; CI runs it before tests and on publish.
210
+ /src/plaincloak/core/schemas/
211
+ /tests/vectors/
@@ -0,0 +1,36 @@
1
+ # Changelog
2
+
3
+ All notable changes to `plaincloak-py` are documented here. The format
4
+ follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); this
5
+ project uses [Semantic Versioning](https://semver.org/).
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [1.0.0] - 2026-05-25
10
+
11
+ Initial public release of the PlainCloak v1 Python reference implementation.
12
+
13
+ ### Added
14
+
15
+ - Public API: `generate_keypair`, `load_public_key_pem`,
16
+ `load_private_key_pem`, `key_hash`, `encrypt`, `decrypt`,
17
+ `parse_envelope`, `encode_qr`, `decode_qr`; plus the `Suite`, `Outcome`,
18
+ `KeyPair`, `EnvelopeInfo`, `DecryptResult` types and the `PlainCloakError`
19
+ exception hierarchy.
20
+ - Both v1 suites: `RSA-OAEP-SHA256` (REQUIRED baseline) and
21
+ `RSA-OAEP-AES256GCM-SHA256` (RECOMMENDED hybrid).
22
+ - Wire codecs: bijective Base62, strict envelope parser, streaming Brotli
23
+ with a 1 MiB decompression budget, JSON body schema validation.
24
+ - Canonical-form construction with wire-version domain separation for
25
+ signatures and the hybrid AAD.
26
+ - Key identification via SPKI-DER SHA-256.
27
+ - Encrypted at-rest keystore with Argon2id (via the `[keystore]` extra) and
28
+ a stdlib PBKDF2-SHA256 fallback; AES-256-GCM or ChaCha20-Poly1305 AEAD.
29
+ - QR code encode/decode support via the `[qr]` extra.
30
+ - `plaincloak` CLI (and `python -m plaincloak`): `keygen`, `encrypt`,
31
+ `decrypt`, `inspect`, `keystore`, and `qr` subcommands with a
32
+ deterministic exit-code map.
33
+ - Vendored spec schemas and test vectors with a CI drift check; passes
34
+ all deterministic and verification conformance vectors.
35
+
36
+ [1.0.0]: https://github.com/PlainCloak/plaincloak-py/releases/tag/v1.0.0
@@ -0,0 +1,52 @@
1
+ # Conformance
2
+
3
+ ## Supported tier
4
+
5
+ `plaincloak-py` implements the **PlainCloak v1 core profile** in full:
6
+
7
+ - Wire format and strict parser (spec sections 3, 4).
8
+ - Brotli compression with a streaming 1 MiB decompression budget (section 5).
9
+ - Message body and `message.schema.json` validation (section 6).
10
+ - Canonical form for signing and the hybrid AAD (section 7).
11
+ - Both registered v1 suites (section 8):
12
+ - `RSA-OAEP-SHA256` (REQUIRED baseline)
13
+ - `RSA-OAEP-AES256GCM-SHA256` (RECOMMENDED hybrid)
14
+ - Key identification via SPKI-DER SHA-256 (section 9).
15
+ - Producer and consumer procedures, including all five section 10.3 outcomes.
16
+
17
+ RSA modulus sizes 2048, 3072, and 4096 are supported; the public exponent is
18
+ fixed at 65537. Reserved compression code `ZS` and any unknown suite are
19
+ rejected per the open-registry rules.
20
+
21
+ ## Pinned spec commit
22
+
23
+ The vendored schemas (`src/plaincloak/core/schemas/`) and test vectors
24
+ (`tests/vectors/v1/`) are a snapshot of `plaincloak-spec` at:
25
+
26
+ ```
27
+ 4e33e7387836948bc8c449d97d1eefd89bcd8899
28
+ ```
29
+
30
+ `scripts/sync_vectors.py` reproduces the snapshot; `scripts/sync_vectors.py
31
+ --check` (run in CI) fails on any drift from this commit. The commit is
32
+ pinned as `SPEC_REF` in `scripts/sync_vectors.py`; update it there when
33
+ re-syncing.
34
+
35
+ ## Vectors passed
36
+
37
+ Every JSON vector in the snapshot passes (`pytest tests/conformance/`):
38
+
39
+ **Deterministic (6 files):** `01-base62-encode`, `02-base62-decode`,
40
+ `03-brotli-roundtrip`, `04-canonical-form`, `05-key-hash-spki`,
41
+ `06-message-id-formatting`.
42
+
43
+ **Verification (12 files):** `01-rsa2048-roundtrip`, `02-rsa4096-roundtrip`,
44
+ `03-tampered-payload`, `04-tampered-signature`, `05-wrong-recipient`,
45
+ `06-unknown-sender`, `07-rsa2048-hybrid-roundtrip`,
46
+ `08-rsa4096-hybrid-roundtrip`, `09-hybrid-long-plaintext`,
47
+ `10-hybrid-tampered-wrap`, `11-hybrid-tampered-tag`,
48
+ `12-hybrid-signature-invalid`.
49
+
50
+ Brotli compressed bytes are not byte-stable across encoders; the
51
+ `brotli-roundtrip` vectors are checked by the round-trip property only, as
52
+ the spec requires.
@@ -0,0 +1,213 @@
1
+ PlainCloak - Apache License 2.0
2
+ ================================
3
+
4
+ Copyright 2026 The PlainCloak Authors
5
+
6
+ This repository is licensed under the Apache License, Version 2.0 (the
7
+ "License"). You may not use this software except in compliance with the
8
+ License.
9
+
10
+ The full text of the License follows. SPDX-License-Identifier: Apache-2.0
11
+
12
+
13
+ Apache License
14
+ Version 2.0, January 2004
15
+ http://www.apache.org/licenses/
16
+
17
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
18
+
19
+ 1. Definitions.
20
+
21
+ "License" shall mean the terms and conditions for use, reproduction,
22
+ and distribution as defined by Sections 1 through 9 of this document.
23
+
24
+ "Licensor" shall mean the copyright owner or entity authorized by
25
+ the copyright owner that is granting the License.
26
+
27
+ "Legal Entity" shall mean the union of the acting entity and all
28
+ other entities that control, are controlled by, or are under common
29
+ control with that entity. For the purposes of this definition,
30
+ "control" means (i) the power, direct or indirect, to cause the
31
+ direction or management of such entity, whether by contract or
32
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
33
+ outstanding shares, or (iii) beneficial ownership of such entity.
34
+
35
+ "You" (or "Your") shall mean an individual or Legal Entity
36
+ exercising permissions granted by this License.
37
+
38
+ "Source" form shall mean the preferred form for making modifications,
39
+ including but not limited to software source code, documentation
40
+ source, and configuration files.
41
+
42
+ "Object" form shall mean any form resulting from mechanical
43
+ transformation or translation of a Source form, including but
44
+ not limited to compiled object code, generated documentation,
45
+ and conversions to other media types.
46
+
47
+ "Work" shall mean the work of authorship, whether in Source or
48
+ Object form, made available under the License, as indicated by a
49
+ copyright notice that is included in or attached to the work
50
+ (an example is provided in the Appendix below).
51
+
52
+ "Derivative Works" shall mean any work, whether in Source or Object
53
+ form, that is based on (or derived from) the Work and for which the
54
+ editorial revisions, annotations, elaborations, or other modifications
55
+ represent, as a whole, an original work of authorship. For the purposes
56
+ of this License, Derivative Works shall not include works that remain
57
+ separable from, or merely link (or bind by name) to the interfaces of,
58
+ the Work and Derivative Works thereof.
59
+
60
+ "Contribution" shall mean any work of authorship, including
61
+ the original version of the Work and any modifications or additions
62
+ to that Work or Derivative Works thereof, that is intentionally
63
+ submitted to Licensor for inclusion in the Work by the copyright owner
64
+ or by an individual or Legal Entity authorized to submit on behalf of
65
+ the copyright owner. For the purposes of this definition, "submitted"
66
+ means any form of electronic, verbal, or written communication sent
67
+ to the Licensor or its representatives, including but not limited to
68
+ communication on electronic mailing lists, source code control systems,
69
+ and issue tracking systems that are managed by, or on behalf of, the
70
+ Licensor for the purpose of discussing and improving the Work, but
71
+ excluding communication that is conspicuously marked or otherwise
72
+ designated in writing by the copyright owner as "Not a Contribution."
73
+
74
+ "Contributor" shall mean Licensor and any individual or Legal Entity
75
+ on behalf of whom a Contribution has been received by Licensor and
76
+ subsequently incorporated within the Work.
77
+
78
+ 2. Grant of Copyright License. Subject to the terms and conditions of
79
+ this License, each Contributor hereby grants to You a perpetual,
80
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
81
+ copyright license to reproduce, prepare Derivative Works of,
82
+ publicly display, publicly perform, sublicense, and distribute the
83
+ Work and such Derivative Works in Source or Object form.
84
+
85
+ 3. Grant of Patent License. Subject to the terms and conditions of
86
+ this License, each Contributor hereby grants to You a perpetual,
87
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
88
+ (except as stated in this section) patent license to make, have made,
89
+ use, offer to sell, sell, import, and otherwise transfer the Work,
90
+ where such license applies only to those patent claims licensable
91
+ by such Contributor that are necessarily infringed by their
92
+ Contribution(s) alone or by combination of their Contribution(s)
93
+ with the Work to which such Contribution(s) was submitted. If You
94
+ institute patent litigation against any entity (including a
95
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
96
+ or a Contribution incorporated within the Work constitutes direct
97
+ or contributory patent infringement, then any patent licenses
98
+ granted to You under this License for that Work shall terminate
99
+ as of the date such litigation is filed.
100
+
101
+ 4. Redistribution. You may reproduce and distribute copies of the
102
+ Work or Derivative Works thereof in any medium, with or without
103
+ modifications, and in Source or Object form, provided that You
104
+ meet the following conditions:
105
+
106
+ (a) You must give any other recipients of the Work or
107
+ Derivative Works a copy of this License; and
108
+
109
+ (b) You must cause any modified files to carry prominent notices
110
+ stating that You changed the files; and
111
+
112
+ (c) You must retain, in the Source form of any Derivative Works
113
+ that You distribute, all copyright, patent, trademark, and
114
+ attribution notices from the Source form of the Work,
115
+ excluding those notices that do not pertain to any part of
116
+ the Derivative Works; and
117
+
118
+ (d) If the Work includes a "NOTICE" text file as part of its
119
+ distribution, then any Derivative Works that You distribute must
120
+ include a readable copy of the attribution notices contained
121
+ within such NOTICE file, excluding those notices that do not
122
+ pertain to any part of the Derivative Works, in at least one
123
+ of the following places: within a NOTICE text file distributed
124
+ as part of the Derivative Works; within the Source form or
125
+ documentation, if provided along with the Derivative Works; or,
126
+ within a display generated by the Derivative Works, if and
127
+ wherever such third-party notices normally appear. The contents
128
+ of the NOTICE file are for informational purposes only and
129
+ do not modify the License. You may add Your own attribution
130
+ notices within Derivative Works that You distribute, alongside
131
+ or as an addendum to the NOTICE text from the Work, provided
132
+ that such additional attribution notices cannot be construed
133
+ as modifying the License.
134
+
135
+ You may add Your own copyright statement to Your modifications and
136
+ may provide additional or different license terms and conditions
137
+ for use, reproduction, or distribution of Your modifications, or
138
+ for any such Derivative Works as a whole, provided Your use,
139
+ reproduction, and distribution of the Work otherwise complies with
140
+ the conditions stated in this License.
141
+
142
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
143
+ any Contribution intentionally submitted for inclusion in the Work
144
+ by You to the Licensor shall be under the terms and conditions of
145
+ this License, without any additional terms or conditions.
146
+ Notwithstanding the above, nothing herein shall supersede or modify
147
+ the terms of any separate license agreement you may have executed
148
+ with Licensor regarding such Contributions.
149
+
150
+ 6. Trademarks. This License does not grant permission to use the trade
151
+ names, trademarks, service marks, or product names of the Licensor,
152
+ except as required for reasonable and customary use in describing the
153
+ origin of the Work and reproducing the content of the NOTICE file.
154
+
155
+ 7. Disclaimer of Warranty. Unless required by applicable law or
156
+ agreed to in writing, Licensor provides the Work (and each
157
+ Contributor provides its Contributions) on an "AS IS" BASIS,
158
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
159
+ implied, including, without limitation, any warranties or conditions
160
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
161
+ PARTICULAR PURPOSE. You are solely responsible for determining the
162
+ appropriateness of using or redistributing the Work and assume any
163
+ risks associated with Your exercise of permissions under this License.
164
+
165
+ 8. Limitation of Liability. In no event and under no legal theory,
166
+ whether in tort (including negligence), contract, or otherwise,
167
+ unless required by applicable law (such as deliberate and grossly
168
+ negligent acts) or agreed to in writing, shall any Contributor be
169
+ liable to You for damages, including any direct, indirect, special,
170
+ incidental, or consequential damages of any character arising as a
171
+ result of this License or out of the use or inability to use the
172
+ Work (including but not limited to damages for loss of goodwill,
173
+ work stoppage, computer failure or malfunction, or any and all
174
+ other commercial damages or losses), even if such Contributor
175
+ has been advised of the possibility of such damages.
176
+
177
+ 9. Accepting Warranty or Additional Liability. While redistributing
178
+ the Work or Derivative Works thereof, You may choose to offer,
179
+ and charge a fee for, acceptance of support, warranty, indemnity,
180
+ or other liability obligations and/or rights consistent with this
181
+ License. However, in accepting such obligations, You may act only
182
+ on Your own behalf and on Your sole responsibility, not on behalf
183
+ of any other Contributor, and only if You agree to indemnify,
184
+ defend, and hold each Contributor harmless for any liability
185
+ incurred by, or claims asserted against, such Contributor by reason
186
+ of your accepting any such warranty or additional liability.
187
+
188
+ END OF TERMS AND CONDITIONS
189
+
190
+ APPENDIX: How to apply the Apache License to your work.
191
+
192
+ To apply the Apache License to your work, attach the following
193
+ boilerplate notice, with the fields enclosed by brackets "[]"
194
+ replaced with your own identifying information. (Don't include
195
+ the brackets!) The text should be enclosed in the appropriate
196
+ comment syntax for the file format. We also recommend that a
197
+ file or class name and description of purpose be included on the
198
+ same "printed page" as the copyright notice for easier
199
+ identification within third-party archives.
200
+
201
+ Copyright [yyyy] [name of copyright owner]
202
+
203
+ Licensed under the Apache License, Version 2.0 (the "License");
204
+ you may not use this file except in compliance with the License.
205
+ You may obtain a copy of the License at
206
+
207
+ http://www.apache.org/licenses/LICENSE-2.0
208
+
209
+ Unless required by applicable law or agreed to in writing, software
210
+ distributed under the License is distributed on an "AS IS" BASIS,
211
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
212
+ See the License for the specific language governing permissions and
213
+ limitations under the License.