MCPcopy Create free account
hub / github.com/jwtk/jjwt / getKey

Method getKey

impl/src/main/java/io/jsonwebtoken/impl/security/KeyPairs.java:42–48  ·  view source on GitHub ↗
(KeyPair pair, Class<K> clazz)

Source from the content-addressed store, hash-verified

40 }
41
42 public static <K> K getKey(KeyPair pair, Class<K> clazz) {
43 Assert.notNull(pair, "KeyPair cannot be null.");
44 String prefix = familyPrefix(clazz) + "KeyPair ";
45 boolean isPrivate = PrivateKey.class.isAssignableFrom(clazz);
46 Key key = isPrivate ? pair.getPrivate() : pair.getPublic();
47 return assertKey(key, clazz, prefix);
48 }
49
50 public static <K> K assertKey(Key key, Class<K> clazz, String msgPrefix) {
51 Assert.notNull(key, "Key argument cannot be null.");

Callers 4

octetKeyPairMethod · 0.95
rsaKeyPairMethod · 0.95
ecKeyPairMethod · 0.95
keyPairMethod · 0.95

Calls 5

notNullMethod · 0.95
familyPrefixMethod · 0.95
assertKeyMethod · 0.95
getPrivateMethod · 0.65
getPublicMethod · 0.65

Tested by

no test coverage detected