From 34e2ec1a8e3027101f98c9eb7ce248e1f9b5a114 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 12 Feb 2019 16:57:01 +0000 Subject: [PATCH] add optional "use":"sig" to public jwk --- keypairs.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/keypairs.go b/keypairs.go index 76796ed..3a75d2a 100644 --- a/keypairs.go +++ b/keypairs.go @@ -153,7 +153,7 @@ func MarshalECPublicKey(k *ecdsa.PublicKey, exp ...time.Time) []byte { if 0 != len(exp) { expstr = fmt.Sprintf(`"exp":%d,`, exp[0].Unix()) } - return []byte(fmt.Sprintf(`{"kid":%q,%s"crv":%q,"kty":"EC","x":%q,"y":%q}`, expstr, thumb, crv, x, y)) + return []byte(fmt.Sprintf(`{"kid":%q,"use":"sig",%s"crv":%q,"kty":"EC","x":%q,"y":%q}`, expstr, thumb, crv, x, y)) } func MarshalECPublicKeyWithoutKeyID(k *ecdsa.PublicKey) []byte { @@ -177,7 +177,7 @@ func MarshalRSAPublicKey(p *rsa.PublicKey, exp ...time.Time) []byte { if 0 != len(exp) { expstr = fmt.Sprintf(`"exp":%d,`, exp[0].Unix()) } - return []byte(fmt.Sprintf(`{"kid":%q,%s"e":%q,"kty":"RSA","n":%q}`, expstr, thumb, e, n)) + return []byte(fmt.Sprintf(`{"kid":%q,"use":"sig",%s"e":%q,"kty":"RSA","n":%q}`, expstr, thumb, e, n)) } func MarshalRSAPublicKeyWithoutKeyID(p *rsa.PublicKey) []byte {