From a91624fb789c598ac42c819785594a611e249e26 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Mon, 11 Feb 2019 22:38:40 +0000 Subject: [PATCH] use seconds for exp, not rfc timestamp --- keypairs.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/keypairs.go b/keypairs.go index d131c81..76796ed 100644 --- a/keypairs.go +++ b/keypairs.go @@ -151,7 +151,7 @@ func MarshalECPublicKey(k *ecdsa.PublicKey, exp ...time.Time) []byte { y := base64.RawURLEncoding.EncodeToString(k.Y.Bytes()) expstr := "" if 0 != len(exp) { - expstr = fmt.Sprintf(`"exp":%q,`, exp[0].Format(time.RFC3339)) + 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)) } @@ -175,7 +175,7 @@ func MarshalRSAPublicKey(p *rsa.PublicKey, exp ...time.Time) []byte { n := base64.RawURLEncoding.EncodeToString(p.N.Bytes()) expstr := "" if 0 != len(exp) { - expstr = fmt.Sprintf(`"exp":%q,`, exp[0].Format(time.RFC3339)) + 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)) }