public abstract class SignatureUtil
extends java.lang.Object
Modifier | Constructor and Description |
---|---|
protected |
SignatureUtil()
Provide no public constructor, to avoid unintended use.
|
Modifier and Type | Method and Description |
---|---|
static byte[] |
ASN1toRS(byte[] sigBytes,
int lengthRS)
This method decodes a X.509 DSA or ECDSA signature and returns the raw r and s values into an
byte array.
|
static byte[] |
RStoASN1(byte[] rs)
This method encodes the raw r and s values of a DSA or ECDSA signature into an X.509 signature.
|
protected SignatureUtil()
public static byte[] RStoASN1(byte[] rs) throws java.security.SignatureException
rs
- The byte array containing the concatenation of r and s, most significant byte first
(no signum bits).java.security.SignatureException
- If encoding the signature value fails.public static byte[] ASN1toRS(byte[] sigBytes, int lengthRS) throws java.security.SignatureException
sigBytes
- The X.509 encoded DSA or ECDSA signature value.lengthRS
- The length of R and S in bytes, which have both the same length; e.g. 20 bytes. If
this is 0, the byte length of r and s will be determined and the longer of both will
be taken.java.security.SignatureException
- If decoding the signature value fails.IAIK JavaSecurity Website https://jce.iaik.tugraz.at/
IAIK at Graz University of Technology, Austria, Europe
Copyright 2001-2023 IAIK, Graz University of Technology, Inffeldgasse 16a, 8010 Graz, Austria. All Rights Reserved. Version 1.9.4