Skip to content

Commit 0e212cf

Browse files
committed
[FAB-830] CC encryption doc
This commit simply offers some high level explanation on the merits of cc encryption. Incorporate Dave E feedback; Add content on the extension interface and helper program to the chaincode4ade doc. Incorporate Ale feedback [ci-skip] Change-Id: I5792fdfd4c8db0a84efffb4cea8288b11cd410d6 Signed-off-by: Nick Gaski <ngaski@us.ibm.com>
1 parent 16d7f50 commit 0e212cf

File tree

2 files changed

+31
-3
lines changed

2 files changed

+31
-3
lines changed

docs/source/chaincode4ade.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,5 +523,28 @@ By default, we mount only ``sacc``. However, you can easily test different
523523
chaincodes by adding them to the ``chaincode`` subdirectory and relaunching
524524
your network. At this point they will be accessible in your ``chaincode`` container.
525525

526+
Chaincode encryption
527+
--------------------
528+
529+
In certain scenarios, it may be useful to encrypt values associated with a key
530+
in their entirety or simply in part. For example, if a person's social security
531+
number or address was being written to the ledger, then you likely would not want
532+
this data to appear in plaintext. Chaincode encryption is achieved by leveraging
533+
the `entities extension <https://github.com/hyperledger/fabric/tree/master/core/chaincode/shim/ext/entities>`__
534+
which is a BCCSP wrapper with commodity factories and functions to perform cryptographic
535+
operations such as encryption and elliptic curve digital signatures. For example,
536+
to encrypt, the invoker of a chaincode passes in a cryptographic key via the
537+
transient field. The same key may then be used for subsequent query operations, allowing
538+
for proper decryption of the encrypted state values.
539+
540+
For more information and samples, see the
541+
`Encc Example <https://github.com/hyperledger/fabric/tree/master/examples/chaincode/go/enccc_example>`__
542+
within the ``fabric/examples`` directory. Pay specific attention to the ``utils.go``
543+
helper program. This utility loads the chaincode shim APIs and Entities extension
544+
and builds a new class of functions (e.g. ``encryptAndPutState`` & ``getStateAndDecrypt``)
545+
that the sample encryption chaincode then leverages. As such, the chaincode can
546+
now marry the basic shim APIs of ``Get`` and ``Put`` with the added functionality of
547+
``Encrypt`` and ``Decrypt``.
548+
526549
.. Licensed under Creative Commons Attribution 4.0 International License
527550
https://creativecommons.org/licenses/by/4.0/

docs/source/fabric_model.rst

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,14 @@ thereby isolate/segregate their transactions and ledger. In order to solve
9494
scenarios that want to bridge the gap between total transparency and privacy,
9595
chaincode can be installed only on peers that need to access the asset states
9696
to perform reads and writes (in other words, if a chaincode is not installed on
97-
a peer, it will not be able to properly interface with the ledger). To further
98-
obfuscate the data, values within chaincode can be encrypted (in part or in total) using common
99-
cryptographic algorithms such as AES before appending to the ledger.
97+
a peer, it will not be able to properly interface with the ledger).
98+
99+
To further obfuscate the data, values within chaincode can be encrypted
100+
(in part or in total) using common cryptographic algorithms such as AES before
101+
sending transactions to the ordering service and appending blocks to the ledger.
102+
Once encrypted data has been written to the ledger, it can only be decrypted by
103+
a user in possession of the corresponding key that was used to generate the cipher text.
104+
For further details on chaincode encryption, see the :doc:`chaincode4ade` topic.
100105

101106
.. _Security-Membership-Services:
102107

0 commit comments

Comments
 (0)