AWS IAM - 安全地连接生成的访问密钥 ID 和秘密访问密钥
AWS IAM - Safely concatenate generated Access Key ID and Secret Access Key
我想将我的访问密钥 ID 和秘密访问密钥连接在一起,以便我可以轻松地使用 Azure Key Vault 轮换凭据。我无法找出生成的访问密钥 ID 或秘密访问密钥不会使用哪些字符来将它们分隔在连接的字符串中。使用分号或冒号是否安全?
编辑:https://docs.aws.amazon.com/IAM/latest/APIReference/API_AccessKey.html 表示访问密钥 ID 可以包含任何非 space 字符,但我不确定生成的 ID 在实践中是否更受限制。不幸的是,没有给出秘密访问密钥的指南。 space 是合理的分隔符吗?
Amazon其实在this article中提供了用于搜索access keys和secret access keys的正则表达式,我们可以通过它来判断使用了哪些字符:
Search for access key IDs: (?<![A-Z0-9])[A-Z0-9]{20}(?![A-Z0-9])
. In English, this regular expression says: Find me 20-character, uppercase, alphanumeric strings that don’t have any uppercase, alphanumeric characters immediately before or after.
Search for secret access keys: (?<![A-Za-z0-9/+=])[A-Za-z0-9/+=]{40}(?![A-Za-z0-9/+=])
. In English, this regular expression says: Find me 40-character, base-64 strings that don’t have any base 64 characters immediately before or after.
因此访问密钥中的字母和数字以及那些加上字符 /+=
的字符和数字可能会出现在密钥中。这意味着分号或冒号是分隔符的安全选择。
我想将我的访问密钥 ID 和秘密访问密钥连接在一起,以便我可以轻松地使用 Azure Key Vault 轮换凭据。我无法找出生成的访问密钥 ID 或秘密访问密钥不会使用哪些字符来将它们分隔在连接的字符串中。使用分号或冒号是否安全?
编辑:https://docs.aws.amazon.com/IAM/latest/APIReference/API_AccessKey.html 表示访问密钥 ID 可以包含任何非 space 字符,但我不确定生成的 ID 在实践中是否更受限制。不幸的是,没有给出秘密访问密钥的指南。 space 是合理的分隔符吗?
Amazon其实在this article中提供了用于搜索access keys和secret access keys的正则表达式,我们可以通过它来判断使用了哪些字符:
Search for access key IDs:
(?<![A-Z0-9])[A-Z0-9]{20}(?![A-Z0-9])
. In English, this regular expression says: Find me 20-character, uppercase, alphanumeric strings that don’t have any uppercase, alphanumeric characters immediately before or after.Search for secret access keys:
(?<![A-Za-z0-9/+=])[A-Za-z0-9/+=]{40}(?![A-Za-z0-9/+=])
. In English, this regular expression says: Find me 40-character, base-64 strings that don’t have any base 64 characters immediately before or after.
因此访问密钥中的字母和数字以及那些加上字符 /+=
的字符和数字可能会出现在密钥中。这意味着分号或冒号是分隔符的安全选择。