is it possible to include the x5t and x5c in the jwks? #38
Replies: 2 comments
-
it is! the library will calculate the thumbprints (x5t and x5t#S256) if you provide your key's certificate as Say that i have a key like so (private is irrelevant, certificates are containing the public key only), but even if private key components are present the certificate will be validated to belong to the key. {
e: 'AQAB',
kid: 'z74stT3qQkZWDjWvTw1x2UVGyOb2Bu6QgmqqB8l2ABQ',
kty: 'RSA',
n: 'x2WwCF7ekBS2IQapfaVgWcdUewNdqO4FeYblVXlRFfYPqZl3SlNSavzq0IDbEtUnGN3Easehy6pgcVYecK0OoNNndUFdvkRyaKQtZIOweP6c534-OCcVtB0JkmGIvgE738rswVPkWsfOwC4py6-YGUwevVv_T6_bJj2xh691DNZh8_CnfFr7OPeBEKP7u4r721fCq_KEeVYLAQkzEAO35Wu08V_Dm4ETUpsBv0o69Q79m2qhr7oUO9LaomUUaNbrh48DlM6UHhfS3RZ4ih8IY5y5RbnFSuopw2dlQ_6CchDquP6Y0xXpgekIETcqilJnfJaXp1Urroye0yTRMlcN9w'
} and a certificate for this key
A JWK with the x5c would be jwk = {
e: 'AQAB',
kid: 'z74stT3qQkZWDjWvTw1x2UVGyOb2Bu6QgmqqB8l2ABQ',
kty: 'RSA',
n: 'x2WwCF7ekBS2IQapfaVgWcdUewNdqO4FeYblVXlRFfYPqZl3SlNSavzq0IDbEtUnGN3Easehy6pgcVYecK0OoNNndUFdvkRyaKQtZIOweP6c534-OCcVtB0JkmGIvgE738rswVPkWsfOwC4py6-YGUwevVv_T6_bJj2xh691DNZh8_CnfFr7OPeBEKP7u4r721fCq_KEeVYLAQkzEAO35Wu08V_Dm4ETUpsBv0o69Q79m2qhr7oUO9LaomUUaNbrh48DlM6UHhfS3RZ4ih8IY5y5RbnFSuopw2dlQ_6CchDquP6Y0xXpgekIETcqilJnfJaXp1Urroye0yTRMlcN9w',
x5c: ['MIIFUDCCAzigAwIBAgICEAAwDQYJKoZIhvcNAQELBQAwgYExCzAJBgNVBAYTAkdCMRAwDgYDVQQIDAdFbmdsYW5k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BDZXJ0aWZpY2F0ZTAdBgNVHQ4EFgQUoT7Nh2gJLqlru7QH7sSgxBaNcOswHwYDVR0jBBgwFoAU9aXgCTQVzkjeGVwlbmtKkYn5/rIwDgYDVR0PAQH/BAQDAgXgMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDANBgkqhkiG9w0BAQsFAAOCAgEAqjXoNfaOG1Kxk9jOvrHfTNdgGdrpaudZH4gRU2044m8JvazUxhnWgk+n4mkjVD5CrNu7FWza3twt2nIR50GKWilg2fiBIPcH5RVYz7gdO3r2N1nWohx3P49bGEyyDwxR1aeM/O8w0gQ70AydoPPKggpef61MsLgYl+tiVqKx3VHO5A6hPScH26p56DOq28fjLZPnTskoXxn1IHB4Ea4fUC1x4gXDS38qvvcBVWmQWbeTm1dWEUsmRVp6D1jPAsikYjzb86lOzC0S7V6lX1QwAL4nxDsBpxx1JlKeNDk5sdr7mHQtODjq8w+Uo0EPmgGdTsCiBgPfWHRgYAs9HTFbC6FWeu+Bu2Nfuo8MAYCY2+FhGEwUHuUtYUR04V9F6+J4xmSsPZp46PNo4F2ugL4Nm81py3eDOq9WcuoN0iB8XqcjmFb3BvirpSzmNuP1FsqDj+QGN73W/seHylFMAGnsAaF3A3gBUFF26+xz7hSXLGbEhoR6FYBZKvLBQgS3zna6KbYdw0pqUBvrEJfrVXCQPy/Y1C3EnEhQqJDx9Rmw5qm6RpuCPga4pDzQPBLny+ggmb4BqHieD+Xz3g0bN/// 84lxiSg60mlyuEwOHcQMmlOxjYf2zliCqRptD/LlfITlmzGjds9BhLlkHIBR3IkEejZluclYP0Dljd65DCTqY1z0c='
// ],
// x5t: 'qOf1YEg_zFLX0PtGjiEVvjM1WsU'
// } This library however will not generate the certificate for your key. |
Beta Was this translation helpful? Give feedback.
-
To generate the certificate from a given key-pair:
With this setup the (self-signed) certificate chain and fingerprint is included into the jwks. |
Beta Was this translation helpful? Give feedback.
-
Is there a way to have the x5t and x5c produced along with the output of the jwks using keystore.toJWKS([private])?
As of now I receive the e and n which is fine for validation but I was wondering if its possible to also included the x5t and x5c without having to perform a hack.
Thank you for your time!
Beta Was this translation helpful? Give feedback.
All reactions