| 26 | } |
| 27 | |
| 28 | JSONWebKey JSONWebKey::fromRSAKey(const KeyPair & key) |
| 29 | { |
| 30 | auto e = key.encryptionExponent(); |
| 31 | auto n = key.modulus(); |
| 32 | |
| 33 | auto e_enc = base64Encode({e.begin(), e.end()}, /*url_encoding*/ true, /*no_padding*/ true); |
| 34 | auto n_enc = base64Encode({n.begin(), n.end()}, /*url_encoding*/ true, /*no_padding*/ true); |
| 35 | |
| 36 | return JSONWebKey{ |
| 37 | .e = e_enc, |
| 38 | .n = n_enc, |
| 39 | .kty = "RSA", |
| 40 | }; |
| 41 | } |
| 42 | |
| 43 | } |
| 44 | #endif |
nothing calls this directly
no test coverage detected