MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / signingInput

Method signingInput

CodenameOne/src/com/codename1/security/Jwt.java:295–307  ·  view source on GitHub ↗
(String algorithm, Map<String, Object> claims)

Source from the content-addressed store, hash-verified

293 // internals
294
295 private static String signingInput(String algorithm, Map<String, Object> claims) {
296 Map<String, Object> hdr = new LinkedHashMap<String, Object>();
297 hdr.put("alg", algorithm);
298 hdr.put("typ", "JWT");
299 String headerJson = JSONParser.mapToJson(hdr);
300 String claimsJson = JSONParser.mapToJson(claims);
301 try {
302 return com.codename1.util.Base64.encodeUrlSafe(headerJson.getBytes("UTF-8")) + "."
303 + com.codename1.util.Base64.encodeUrlSafe(claimsJson.getBytes("UTF-8"));
304 } catch (UnsupportedEncodingException e) {
305 throw new CryptoException("UTF-8 not supported", e);
306 }
307 }
308
309 private static byte[] computeHmac(String algorithm, byte[] secret, String signingInput) {
310 String hashAlg;

Callers 2

signMethod · 0.95
signNoneMethod · 0.95

Calls 4

putMethod · 0.95
mapToJsonMethod · 0.95
getBytesMethod · 0.95
encodeUrlSafeMethod · 0.80

Tested by

no test coverage detected