public class SignatureUtil extends Object
| Constructor and Description |
|---|
SignatureUtil() |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
hmac(SecurityAlgorithm securityAlgorithm,
byte[] secretKey,
ByteBuffer... buffers)
Compute the HMAC of the provided buffers.
|
static byte[] |
sign(SecurityAlgorithm securityAlgorithm,
PrivateKey privateKey,
ByteBuffer... buffers)
Sign the contents of the provided buffers using the provided
SecurityAlgorithm. |
static void |
verify(SecurityAlgorithm algorithm,
X509Certificate certificate,
byte[] dataBytes,
byte[] signatureBytes)
Verify that
signatureBytes is a valid signature produced by the private key of certificate
having signed dataBytes using algorithm. |
public static byte[] sign(SecurityAlgorithm securityAlgorithm, PrivateKey privateKey, ByteBuffer... buffers) throws UaException
SecurityAlgorithm.
Note that only the bytes between position and limit of each buffer are considered.securityAlgorithm - the SecurityAlgorithm.privateKey - the PrivateKey to sign with.buffers - the data to sign.UaException - if the signature fails for any reason.public static void verify(SecurityAlgorithm algorithm, X509Certificate certificate, byte[] dataBytes, byte[] signatureBytes) throws UaException
signatureBytes is a valid signature produced by the private key of certificate
having signed dataBytes using algorithm.algorithm - the SecurityAlgorithm used to create the signature.certificate - the X509Certificate used to verify the signature.dataBytes - the bytes the signatureBytes was produced from.signatureBytes - the signature created by signing dataBytes.UaException - if verification fails for any reason.public static byte[] hmac(SecurityAlgorithm securityAlgorithm, byte[] secretKey, ByteBuffer... buffers) throws UaException
securityAlgorithm - the SecurityAlgorithm that provides the transformation for
Mac.getInstance(String)}.secretKey - the secret key.buffers - the buffers to use.UaException - if the HMAC operation fails for any reason.Copyright © 2025. All rights reserved.