mirror of
https://github.com/floci-io/floci.git
synced 2026-11-25 23:00:59 -05:00
UploadSSHPublicKey, GetSSHPublicKey, ListSSHPublicKeys, UpdateSSHPublicKey and DeleteSSHPublicKey, stored per user with the documented quota of five. AWS accepts the body in ssh-rsa form or as PEM, so both are read, and the body is kept exactly as it arrived: a caller that uploaded PEM gets that PEM back rather than a re-encoding. GetSSHPublicKey converts, because Encoding is required and decides the form of the response. Fingerprint is the MD5 of the OpenSSH blob, confirmed by reproducing the worked example in the IAM API Reference rather than assumed. It is not the digest EC2 reports for the same key, which is taken over the DER: both are sixteen bytes of colon hex, so the wrong one would look right. The two rejection errors are kept apart the way the model separates them. A body in neither accepted encoding is UnrecognizedPublicKeyEncoding; one in a recognised encoding that will not parse, or that carries a key type other than ssh-rsa, is InvalidPublicKey. An OpenSSH line is recognised by its key-type token rather than by whether part of it base64-decodes, since a short word often does. DuplicateSSHPublicKey is per user, unlike the account-wide rule for signing certificates, and compares fingerprints so the same key in the other encoding still counts. A key blocks DeleteUser until removed and follows the user across an UpdateUser rename, both under a lock taken in the same order DeleteUser takes it.