mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 22:11:36 -05:00
* feat(paymentcryptography): the data plane as a service of its own docs(paymentcryptography): the data plane has a page of its own fix(paymentcryptography): a MAC under a three-key Triple DES key is computed test(paymentcryptography): a key of another purpose does not encrypt data feat(paymentcryptography): the data plane's IAM is generated fix(paymentcryptography): a DUKPT MAC needs a base derivation key fix(paymentcryptography): a key whose material is not held is refused docs(paymentcryptography): the data plane's example runs test(paymentcryptography): the data plane through the AWS SDK test(paymentcryptography): the data plane through the AWS CLI fix(paymentcryptography): the CLI test removes the keys it makes docs(compat): the AWS CLI suite names the data plane test(paymentcryptography): the route is read as the registry reads it test(paymentcryptography): the request names its method and its URI fix(paymentcryptography): the cipher pads no data fix(paymentcryptography): the data plane takes the service scope fix(paymentcryptography): a MAC length that is not a number is refused docs(paymentcryptography): the data plane says the cipher pads no data fix(paymentcryptography): the data plane ciphers with Triple DES as well fix(paymentcryptography): the scope alias names the model's scope fix(paymentcryptography): the Triple DES cipher is BouncyCastle's fix(paymentcryptography): the usage and the blob keep their comments fix(paymentcryptography): a key's family is read from its algorithm fix(paymentcryptography): the cipher reads the vector through one helper test(paymentcryptography): the keys are built by one builder fix(paymentcryptography): the data plane checks the model's rules fix(paymentcryptography): the Triple DES check value is BouncyCastle's fix(paymentcryptography): the SDK names it TDES_2_KEY docs(contributing): the ciphers come from BouncyCastle refactor(paymentcryptography): the model owns the request shapes refactor(paymentcryptography): the ciphers are BouncyCastle's test(compat): one helper makes a key of either algorithm docs(contributing): the cipher rule comes out fix(paymentcryptography): the refusals are the model's refactor(paymentcryptography): the ciphers are one helper each refactor(paymentcryptography): the generators share the helper docs(paymentcryptography): the javadocs name both ciphers test(aws): the moved constants read from the shared helper fix(paymentcryptography): the deprecated cipher constructors go chore(paymentcryptography): the duplicate import goes test(paymentcryptography): the DUKPT vectors the standard publishes fix(paymentcryptography): the DUKPT refusal is the derivation's docs(paymentcryptography): the retail MAC is over a double-length key fix(paymentcryptography): the ISO 9797-1 MAC pads only a partial block refactor(paymentcryptography): the refusals the model already makes chore(aws): the routes are generated from the models again * chore(aws): the IAM resources are generated again
99 lines
4.7 KiB
Markdown
99 lines
4.7 KiB
Markdown
# Payment Cryptography
|
|
|
|
**Protocol:** JSON 1.0 (`X-Amz-Target: PaymentCryptographyControlPlane.*`)
|
|
**Endpoint:** `POST http://localhost:4566/`
|
|
|
|
## Supported Actions
|
|
|
|
<!-- floci:actions:start -->
|
|
| Action | Description |
|
|
| --- | --- |
|
|
| `CreateKey` | Create a key with fresh material |
|
|
| `GetKey` | Get a key's attributes, state and check value |
|
|
| `ListKeys` | List the keys of a region |
|
|
| `DeleteKey` | Delete a key |
|
|
| `CreateAlias` | Point an alias name at a key |
|
|
| `GetAlias` | Get the key an alias name points at |
|
|
| `ListAliases` | List the aliases of a region |
|
|
| `UpdateAlias` | Point an alias name at another key |
|
|
| `DeleteAlias` | Remove an alias name |
|
|
| `TagResource` | Add tags to a key |
|
|
| `UntagResource` | Remove tags from a key |
|
|
| `ListTagsForResource` | List the tags of a key |
|
|
<!-- floci:actions:end -->
|
|
|
|
## Emulation Behavior
|
|
|
|
- **Real key material:** `CreateKey` generates the material the algorithm it names
|
|
calls for: 32 bytes of AES-256 for an AES-256 key, 16 or 24 bytes for the two Triple
|
|
DES ones, and a key pair for an RSA or EC one. The `KeyCheckValue` follows the
|
|
algorithm: the leftmost three bytes of the CMAC of sixteen zero bytes under an AES
|
|
key, and the ANSI X9.24 one for a Triple DES key. The material is held by the key
|
|
while the emulator runs and is not written to the store.
|
|
- **Regional:** keys, aliases and tags all live in the region they were made in. The
|
|
service is regional, and so is this.
|
|
- **Alias names are unique in a region, not in an account:** the same name may name a
|
|
key in two regions, and the two are two aliases. A name that is already taken in
|
|
the key's own region is a `ConflictException`.
|
|
- **Tags are the region's:** they are not part of the replication process, so a key in
|
|
another region carries its own tag set, and tagging one leaves the others alone.
|
|
- **Deletion:** `DeleteKey` removes the key and the aliases that name it, and answers
|
|
with the key, its state `DELETE_PENDING` and the moment its deletion takes effect.
|
|
A key that is gone does not come back: a tagging request for it is refused. The
|
|
service deletes a key the moment it is asked to, so the waiting period of
|
|
`DeleteKeyInDays` is read and checked but not waited for.
|
|
- **Creating a key:** `CreateKey` takes `Exportable`, `Enabled` and `Tags`, and a key
|
|
created disabled or with tags comes back that way. The `KeyUsage` and the
|
|
`KeyModesOfUse` of the key are required, as the reference requires them. The answer
|
|
carries every mode of use the reference gives a key, the ones the key was not made
|
|
with as false, so a caller reading them finds a boolean for each of them. The check
|
|
value is a CMAC, which is the only algorithm this service computes, so a request
|
|
naming another one is refused.
|
|
- **Which key a request may name:** `KeyIdentifier` takes the ARN of a key, the ARN of
|
|
an alias or the name of an alias, while `KeyArn` and `ResourceArn` take the ARN of
|
|
a key alone, as the reference states them. A request naming a key another way is
|
|
refused, and the permission check reads the same member the request does.
|
|
- **Listing by state:** `ListKeys` takes a `KeyState` and answers with the keys in
|
|
that state alone, and with every key when it names none.
|
|
- **An alias may name no key:** `UpdateAlias` names the key of an alias, and an update
|
|
that names none removes the key the alias names and leaves the alias. `CreateAlias`
|
|
refuses an alias without a key, as the reference does, though its model requires
|
|
only the name.
|
|
- **Paging:** `ListKeys`, `ListAliases` and `ListTagsForResource` take `MaxResults`
|
|
and `NextToken`, and answer with one page and the token that asks for the next.
|
|
- **The data plane is a service of its own:** the operations that use a key are on
|
|
[the data plane's page](payment-cryptography-data.md), which is reached at its own
|
|
routes.
|
|
- **Not yet emulated:** the import and export formats, and the multi-region replication
|
|
operations.
|
|
|
|
## Configuration
|
|
|
|
| Variable | Default | Description |
|
|
|---|---|---|
|
|
| `FLOCI_SERVICES_PAYMENTCRYPTOGRAPHY_ENABLED` | `true` | Enable or disable the service |
|
|
|
|
## Examples
|
|
|
|
```bash
|
|
export AWS_ENDPOINT_URL=http://localhost:4566
|
|
|
|
# Create a key
|
|
KEY_ARN=$(aws payment-cryptography create-key \
|
|
--key-attributes 'KeyAlgorithm=AES_256,KeyClass=SYMMETRIC_KEY,KeyUsage=TR31_D0_SYMMETRIC_DATA_ENCRYPTION_KEY,KeyModesOfUse={Encrypt=true,Decrypt=true}' \
|
|
--exportable \
|
|
--query Key.KeyArn --output text)
|
|
|
|
# Name it
|
|
aws payment-cryptography create-alias \
|
|
--alias-name alias/team/card-key --key-arn "$KEY_ARN"
|
|
|
|
# Tag it
|
|
aws payment-cryptography tag-resource \
|
|
--resource-arn "$KEY_ARN" \
|
|
--tags Key=Origin,Value=PRIMARY
|
|
|
|
# Read it back
|
|
aws payment-cryptography get-key --key-identifier "$KEY_ARN"
|
|
```
|