public class SignatureUtil extends Object
| Constructor and Description |
|---|
SignatureUtil() |
| Modifier and Type | Method and Description |
|---|---|
static KeyValueType |
createKeyValue(PublicKey key)
Creates a
KeyValueType that wraps the specified public key. |
static DSAKeyValueType |
getDSAKeyValue(Element element)
Given a dsig:DSAKeyValue element, return
DSAKeyValueType |
static RSAKeyValueType |
getRSAKeyValue(Element element)
Given a dsig:DSAKeyValue element, return
DSAKeyValueType |
static String |
getXMLSignatureAlgorithmURI(String algo)
Get the XML Signature URI for the algo (RSA, DSA)
|
static void |
marshall(SignatureType signature,
OutputStream os)
Marshall a SignatureType to output stream
|
static byte[] |
sign(String stringToBeSigned,
PrivateKey signingKey)
Sign a string using the private key
|
static boolean |
validate(byte[] signedContent,
byte[] signatureValue,
PublicKey validatingKey)
Validate the signed content with the signature value
|
static boolean |
validate(byte[] signedContent,
byte[] signatureValue,
String signatureAlgorithm,
X509Certificate validatingCert)
Validate the signature using a x509 certificate
|
public static void marshall(SignatureType signature, OutputStream os) throws JAXBException, SAXException
signature - os - SAXExceptionJAXBExceptionpublic static String getXMLSignatureAlgorithmURI(String algo)
algo - public static byte[] sign(String stringToBeSigned, PrivateKey signingKey) throws GeneralSecurityException
stringToBeSigned - signingKey - GeneralSecurityExceptionpublic static boolean validate(byte[] signedContent,
byte[] signatureValue,
PublicKey validatingKey)
throws GeneralSecurityException
signedContent - signatureValue - validatingKey - GeneralSecurityExceptionpublic static boolean validate(byte[] signedContent,
byte[] signatureValue,
String signatureAlgorithm,
X509Certificate validatingCert)
throws GeneralSecurityException
signedContent - signatureValue - signatureAlgorithm - validatingCert - GeneralSecurityExceptionpublic static DSAKeyValueType getDSAKeyValue(Element element) throws ParsingException
DSAKeyValueTypeelement - ParsingExceptionpublic static RSAKeyValueType getRSAKeyValue(Element element) throws ParsingException
DSAKeyValueTypeelement - ParsingExceptionpublic static KeyValueType createKeyValue(PublicKey key)
Creates a KeyValueType that wraps the specified public key. This method supports DSA and RSA keys.
key - the PublicKey that will be represented as a KeyValueType.KeyValueType or null if the specified key is neither a DSA nor a RSA
key.Copyright © 2016 JBoss by Red Hat. All rights reserved.