github.com/bencicandrej/quorum@v2.2.6-0.20190909091323-878cab86f711+incompatible/docs/Privacy/Tessera/Configuration/Keys.md (about)

     1  Tessera uses cryptographic keys to provide transaction privacy.  
     2  
     3  You can use existing private/public key pairs as well as use Tessera to generate new key pairs for you.  See [Generating & securing keys](../../Tessera%20Services/Keys/Keys) for more info.
     4  ```
     5  "keys": {
     6      "passwords": [],
     7      "passwordFile": "Path",
     8      "azureKeyVaultConfig": {
     9          "url": "Url"
    10      },
    11      "hashicorpKeyVaultConfig": {
    12          "url": "Url",
    13          "approlePath": "String",
    14          "tlsKeyStorePath": "Path",
    15          "tlsTrustStorePath": "Path" 
    16      },
    17      "keyData": [
    18          {
    19              //The data for a private/public key pair
    20          }
    21      ]
    22  }
    23  ```
    24  
    25  ## KeyData
    26  Key pairs can be provided in several ways:
    27  
    28  #### 1. Direct key pairs
    29  Direct key pairs are convenient but are the least secure configuration option available, as you expose your private key in the configuration file. More secure options are available and preferable for production environments.
    30  
    31  The key pair data is provided in plain text in the configfile:
    32  ```
    33  "keys": {
    34      "keyData": [
    35          {
    36          "privateKey": "yAWAJjwPqUtNVlqGjSrBmr1/iIkghuOh1803Yzx9jLM=",
    37          "publicKey": "/+UuD63zItL1EbjxkKUljMgG8Z1w0AJ8pNOR4iq2yQc="
    38          }
    39      ]
    40  }
    41  ```  
    42  
    43  #### 2. Inline key pairs
    44  The public key is provided in plain text.  The private key is provided through additional config:
    45  ```
    46  "keys": {
    47      "keyData": [
    48          {
    49              "config": {
    50                  "data": {
    51                      "bytes": "yAWAJjwPqUtNVlqGjSrBmr1/iIkghuOh1803Yzx9jLM="
    52                  },
    53                  "type": "unlocked"
    54              },
    55              "publicKey": "/+UuD63zItL1EbjxkKUljMgG8Z1w0AJ8pNOR4iq2yQc="
    56          }
    57      ]
    58  }     
    59  ```
    60  
    61  This allows for the use of Argon2 password-secured private keys by including the corresponding Argon2 settings in the additional config:
    62  
    63  ```
    64  "keys": {
    65      "passwords": ["password"],
    66      "keyData": [
    67          {
    68              "config": {
    69                  "data": {
    70                      "aopts": {
    71                          "variant": "id",
    72                          "memory": 1048576,
    73                          "iterations": 10,
    74                          "parallelism": 4,
    75                      },
    76                      "snonce": "x3HUNXH6LQldKtEv3q0h0hR4S12Ur9pC",
    77                      "asalt": "7Sem2tc6fjEfW3yYUDN/kSslKEW0e1zqKnBCWbZu2Zw=",
    78                      "sbox": "d0CmRus0rP0bdc7P7d/wnOyEW14pwFJmcLbdu2W3HmDNRWVJtoNpHrauA/Sr5Vxc"
    79                  },
    80                  "type": "argon2sbox"
    81              },
    82              "publicKey": "/+UuD63zItL1EbjxkKUljMgG8Z1w0AJ8pNOR4iq2yQc="
    83          }
    84      ]
    85  }
    86  ```
    87  
    88  #### 3. Azure Key Vault key pairs
    89  The keys in the pair are stored as secrets in an Azure Key Vault.  This requires providing the vault url and the secret IDs for both keys:
    90  ```
    91  "keys": {
    92      "azureKeyVaultConfig": {
    93          "url": "https://my-vault.vault.azure.net"
    94      },
    95      "keyData": [
    96          {
    97              "azureVaultPrivateKeyId": "Key",
    98              "azureVaultPublicKeyId": "Pub",
    99              "azureVaultPublicKeyVersion": "bvfw05z4cbu11ra2g94e43v9xxewqdq7",
   100              "azureVaultPrivateKeyVersion": "0my1ora2dciijx5jq9gv07sauzs5wjo2"
   101          }
   102      ]
   103  }
   104  ```
   105  
   106  This example configuration will retrieve the specified versions of the secrets `Key` and `Pub` from the key vault with DNS name `https://my-vault.vault.azure.net`.    If no version is specified then the latest version of the secret is retrieved.
   107  
   108  > Environment variables must be set if using an Azure Key Vault, for more information see [Setting up an Azure Key Vault](../../Tessera%20Services/Keys/Setting%20up%20an%20Azure%20Key%20Vault)
   109  
   110  #### 4. Hashicorp Vault key pairs
   111  The keys in the pair are stored as a secret in a Hashicorp Vault.  Additional configuration can also be provided if the Vault is configured to use TLS and if the AppRole auth method is being used at a different path to the default (`approle`):
   112  ```
   113  "hashicorpKeyVaultConfig": {
   114      "url": "https://localhost:8200",
   115      "tlsKeyStorePath": "/path/to/keystore.jks",
   116      "tlsTrustStorePath": "/path/to/truststore.jks",
   117      "approlePath": "not-default",
   118  },
   119  "keyData": [
   120      {
   121          "hashicorpVaultSecretEngineName": "engine",
   122          "hashicorpVaultSecretName": "secret",
   123          "hashicorpVaultSecretVersion": 1,
   124          "hashicorpVaultPrivateKeyId": "privateKey",
   125          "hashicorpVaultPublicKeyId": "publicKey",
   126      }
   127  ]
   128  ```
   129  
   130  This example configuration will retrieve version 1 of the secret `engine/secret` from Vault and its corresponding values for `privateKey` and `publicKey`.  
   131  
   132  If no `hashicorpVaultSecretVersion` is provided then the latest version for the secret will be retrieved by default.
   133  
   134  Tessera requires TLS certificates and keys to be stored in `.jks` Java keystore format.  If the `.jks` files are password protected then the following environment variables must be set: 
   135  * `HASHICORP_CLIENT_KEYSTORE_PWD`
   136  * `HASHICORP_CLIENT_TRUSTSTORE_PWD` 
   137  
   138  > If using a Hashicorp Vault additional environment variables must be set and a version 2 K/V secret engine must be enabled.  For more information see [Setting up a Hashicorp Vault](../../Tessera%20Services/Keys/Setting%20up%20a%20Hashicorp%20Vault).
   139  
   140  #### 5. Filesystem key pairs   
   141  The keys in the pair are stored in files:
   142  ```
   143  "keys": {
   144      "passwordFile": "/path/to/passwords",
   145      "keyData": [
   146          {
   147              "privateKeyPath": "/path/to/privateKey.key",
   148              "publicKeyPath": "/path/to/publicKey.pub"
   149          }
   150      ]
   151  }
   152  ```
   153  The contents of the public key file must contain the public key only, e.g.: 
   154  ```
   155  /+UuD63zItL1EbjxkKUljMgG8Z1w0AJ8pNOR4iq2yQc=
   156  ```
   157  
   158  The contents of the private key file must contain the private key in the config format, e.g.:
   159  ```
   160  {
   161      "type" : "unlocked",
   162      "data" : {
   163          "bytes" : "DK0HDgMWJKtZVaP31mPhk6TJNACfVzz7VZv2PsQZeKM="
   164      }
   165  }
   166  ```
   167  ## Multiple Keys
   168  If wished, multiple key pairs can be specified for a Tessera node. In this case, any one of the public keys can be used to address a private transaction to that node. Tessera will sequentially try each key to find one that can decrypt the payload. This can be used, for example, to simplify key rotation.
   169  
   170  Note that multiple key pairs can only be set up within the configuration file, not via separate filesystem key files.
   171  
   172  ## Viewing the keys registered for a node
   173  An ADMIN API endpoint `/config/keypairs` exists to allow you to view the public keys of the key pairs currently in use by your Tessera node.  This requires configuring an ADMIN server in the node's configuration file, as described in [Configuration Overview](../Configuration%20Overview).
   174  
   175  A sample response for the request `adminhost:port/config/keypairs` is:
   176  ```json
   177  [
   178     {
   179        "publicKey" : "oNspPPgszVUFw0qmGFfWwh1uxVUXgvBxleXORHj07g8="
   180     },
   181     {
   182        "publicKey" : "ABn6zhBth2qpdrJXp98IvjExV212ALl3j4U//nj4FAI="
   183     }
   184  ]
   185  ```