mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(paymentcryptography): the list of keys answers with their summaries (#8135)
The model's KeySummary holds the identifier, the state, the attributes, the check value and the two flags, and not the whole key. The list answered with the whole key, so it carried the timestamps and the origin that a summary does not hold. The list answers with the summary now, and the whole key stays the answer of the operation that names one key. The control plane's answers are driven through a real SDK and through the AWS CLI, so the wire format of the operations the summary fix touches is the one the clients read. The certificate of a key pair, a tag that is added and removed, a key pair that keeps the usage its derived keys have, the RSA cryptogram the key exchange serves, the key the two parties agreed, and the timestamps the answers carry. The page said the member was read and checked. Nothing reads it: the shape check is what checks it, against the range the model states. The page said each key in the list is the whole key rather than the summary the model names, which the change that answers with the summary makes untrue. The page says what a listed key carries now. The round trip through the RSA cryptogram asserted the ARN of the key that came in and the usage it was given, which a wrong key of the same usage would also pass. It compares the check value with the exported key's, so the test shows that the same key came back. The key that came in was not added to the list the cleanup walks, so it was left in the service when the class finished. It is added now.
This commit is contained in:
1 parent
9fac49cdb0
commit
7c138ce3f1
7 files changed
+404
-8
No files matched your search
+30
-6
@@ -146,7 +146,7 @@ public class PaymentCryptographyJsonHandler {
|
||||
Pagination.parseNextToken(request, "NextToken", PAGINATION_ERROR));
|
||||
List<Map<String, Object>> keys = new ArrayList<>();
|
||||
for (PaymentCryptographyKey key : page.items()) {
|
||||
keys.add(keyObject(key));
|
||||
keys.add(keySummary(key));
|
||||
}
|
||||
Map<String, Object> out = new LinkedHashMap<>();
|
||||
out.put("Keys", keys);
|
||||
@@ -345,14 +345,28 @@ public class PaymentCryptographyJsonHandler {
|
||||
return request.path("AliasName").asText();
|
||||
}
|
||||
|
||||
/**
|
||||
* A key as a list answers it.
|
||||
*
|
||||
* <p>A list carries the key's summary and not the whole key: its identifier, its state,
|
||||
* its attributes, its check value and the two flags, which is what the model says a
|
||||
* summary holds.
|
||||
*/
|
||||
private static Map<String, Object> keySummary(PaymentCryptographyKey key) {
|
||||
Map<String, Object> out = new LinkedHashMap<>();
|
||||
out.put("KeyArn", key.getArn());
|
||||
out.put("KeyState", key.getKeyState());
|
||||
out.put("KeyAttributes", keyAttributes(key));
|
||||
out.put("KeyCheckValue", key.getKeyCheckValue());
|
||||
out.put("Enabled", key.isEnabled());
|
||||
out.put("Exportable", key.isExportable());
|
||||
return out;
|
||||
}
|
||||
|
||||
private static Map<String, Object> keyObject(PaymentCryptographyKey key) {
|
||||
Map<String, Object> out = new LinkedHashMap<>();
|
||||
out.put("KeyArn", key.getArn());
|
||||
Map<String, Object> attributes = new LinkedHashMap<>();
|
||||
attributes.put("KeyAlgorithm", key.getKeyAlgorithm());
|
||||
attributes.put("KeyClass", key.getKeyClass());
|
||||
attributes.put("KeyUsage", key.getKeyUsage());
|
||||
attributes.put("KeyModesOfUse", answeredModes(key));
|
||||
Map<String, Object> attributes = keyAttributes(key);
|
||||
out.put("KeyAttributes", attributes);
|
||||
if (key.getDeriveKeyUsage() != null && !key.getDeriveKeyUsage().isEmpty()) {
|
||||
out.put("DeriveKeyUsage", key.getDeriveKeyUsage());
|
||||
@@ -374,6 +388,16 @@ public class PaymentCryptographyJsonHandler {
|
||||
return out;
|
||||
}
|
||||
|
||||
/** The attributes of a key, as the answers carry them. */
|
||||
private static Map<String, Object> keyAttributes(PaymentCryptographyKey key) {
|
||||
Map<String, Object> attributes = new LinkedHashMap<>();
|
||||
attributes.put("KeyAlgorithm", key.getKeyAlgorithm());
|
||||
attributes.put("KeyClass", key.getKeyClass());
|
||||
attributes.put("KeyUsage", key.getKeyUsage());
|
||||
attributes.put("KeyModesOfUse", answeredModes(key));
|
||||
return attributes;
|
||||
}
|
||||
|
||||
private static Map<String, Object> aliasObject(PaymentCryptographyAlias alias) {
|
||||
Map<String, Object> out = new LinkedHashMap<>();
|
||||
out.put("AliasName", alias.getAliasName());
|
||||
|
||||
Reference in new issue
Block a user