public final class KeysBridge extends Object
| Modifier and Type | Method and Description |
|---|---|
static PrivateKeyBuilder |
builder(PrivateKey key) |
static SecretKeyBuilder |
builder(SecretKey key) |
static String |
findAlgorithm(Key key) |
static int |
findBitLength(Key key)
Returns the specified key's key length (in bits) if possible, or
-1 if unable to determine the length. |
static byte[] |
findEncoded(Key key)
Returns the specified key's available encoded bytes, or
null if not available. |
static byte[] |
getEncoded(Key key) |
static boolean |
isGenericSecret(Key key) |
static Password |
password(char[] password) |
static <K extends Key> |
root(K key)
If the specified
key is a KeySupplier, the 'root' (lowest level) key that may exist in
a KeySupplier chain is returned, otherwise the key is returned. |
static <K extends Key> |
root(KeySupplier<K> supplier) |
static String |
toString(Key key) |
public static Password password(char[] password)
public static SecretKeyBuilder builder(SecretKey key)
public static PrivateKeyBuilder builder(PrivateKey key)
public static <K extends Key> K root(K key)
key is a KeySupplier, the 'root' (lowest level) key that may exist in
a KeySupplier chain is returned, otherwise the key is returned.K - the key typekey - the key to check if it is a KeySupplierpublic static <K extends Key> K root(KeySupplier<K> supplier)
public static byte[] findEncoded(Key key)
null if not available.
Some KeyStore implementations - like Hardware Security Modules, PKCS11 key stores, and later versions of Android - will not allow applications or libraries to obtain a key's encoded bytes. In these cases, this method will return null.
key - the key to inspectnull if not available.public static boolean isGenericSecret(Key key)
public static int findBitLength(Key key)
-1 if unable to determine the length.key - the key to inspect-1 if unable to determine length.public static byte[] getEncoded(Key key)
Copyright © 2014–2024 jsonwebtoken.io. All rights reserved.