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

Method sign

CodenameOne/src/com/codename1/security/Jwt.java:124–134  ·  view source on GitHub ↗
(Map<String, Object> claims, byte[] secret, String algorithm)

Source from the content-addressed store, hash-verified

122 /// Signs `claims` with the given HMAC algorithm. Use this when you want
123 /// to pass the algorithm dynamically.
124 public static String sign(Map<String, Object> claims, byte[] secret, String algorithm) {
125 if (claims == null) {
126 throw new CryptoException("claims must not be null");
127 }
128 if (algorithm == null) {
129 throw new CryptoException("algorithm must not be null");
130 }
131 String signingInput = signingInput(algorithm, claims);
132 byte[] sig = computeHmac(algorithm, secret, signingInput);
133 return signingInput + "." + com.codename1.util.Base64.encodeUrlSafe(sig);
134 }
135
136 /// Signs `claims` with the given RSA or ECDSA algorithm.
137 ///

Callers 8

signHs256Method · 0.95
signHs384Method · 0.95
signHs512Method · 0.95
runJwtRs256Method · 0.95
jwtRsRoundTripMethod · 0.95
invokeStatic5Method · 0.45
invokeStatic12Method · 0.45
cryptoSignMethod · 0.45

Calls 9

signingInputMethod · 0.95
computeHmacMethod · 0.95
signatureAlgorithmForMethod · 0.95
getBytesMethod · 0.95
signMethod · 0.95
derToJoseEcdsaMethod · 0.95
ecdsaCoordinateLengthMethod · 0.95
encodeUrlSafeMethod · 0.80
startsWithMethod · 0.65

Tested by 3

runJwtRs256Method · 0.76
jwtRsRoundTripMethod · 0.76
cryptoSignMethod · 0.36