public class MacSigner extends MacProvider implements Signer
限定符和类型 | 字段和说明 |
---|---|
protected SignatureAlgorithm |
alg |
static java.security.SecureRandom |
DEFAULT_SECURE_RANDOM
JJWT's default SecureRandom number generator.
|
protected java.security.Key |
key |
构造器和说明 |
---|
MacSigner(SignatureAlgorithm alg,
byte[] key) |
MacSigner(SignatureAlgorithm alg,
java.security.Key key) |
限定符和类型 | 方法和说明 |
---|---|
protected java.security.Signature |
createSignatureInstance() |
protected javax.crypto.Mac |
doGetMacInstance() |
protected javax.crypto.Mac |
getMacInstance() |
protected java.security.Signature |
getSignatureInstance() |
protected boolean |
isBouncyCastleAvailable() |
byte[] |
sign(byte[] data) |
generateKey, generateKey, generateKey
public static final java.security.SecureRandom DEFAULT_SECURE_RANDOM
static {
DEFAULT_SECURE_RANDOM = new SecureRandom();
DEFAULT_SECURE_RANDOM.nextBytes(new byte[64]);
}
nextBytes
is called to force the RNG to initialize itself if not already initialized. The
byte array is not used and discarded immediately for garbage collection.
protected final SignatureAlgorithm alg
protected final java.security.Key key
public MacSigner(SignatureAlgorithm alg, byte[] key)
public MacSigner(SignatureAlgorithm alg, java.security.Key key)
protected javax.crypto.Mac getMacInstance() throws SignatureException
protected javax.crypto.Mac doGetMacInstance() throws java.security.NoSuchAlgorithmException, java.security.InvalidKeyException
java.security.NoSuchAlgorithmException
java.security.InvalidKeyException
protected java.security.Signature createSignatureInstance()
protected java.security.Signature getSignatureInstance() throws java.security.NoSuchAlgorithmException
java.security.NoSuchAlgorithmException
protected boolean isBouncyCastleAvailable()