public final class KeyUtils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
RSA_ECB_OAEPWITH_SHA1_AND_MGF1_PADDING |
Modifier and Type | Method and Description |
---|---|
static byte[] |
generateDigest(byte[] inputBytes)
Generate a (SHA1) digest of the input bytes.
|
static Cipher |
getCipherInstance(String cipherAlgo)
Translate the "cipherAlgo" URI to a JCE ID, and return a javax.crypto.Cipher instance
of this type.
|
static Cipher |
getCipherInstance(String cipherAlgo,
String provider)
Translate the "cipherAlgo" URI to a JCE ID, and request a javax.crypto.Cipher instance
of this type from the given provider.
|
static KeyGenerator |
getKeyGenerator(String algorithm) |
static int |
getKeyLength(String algorithm)
Returns the length of the key in # of bytes
|
static SecretKey |
prepareSecretKey(String algorithm,
byte[] rawKey)
Convert the raw key bytes into a SecretKey object of type algorithm.
|
public static final String RSA_ECB_OAEPWITH_SHA1_AND_MGF1_PADDING
public static int getKeyLength(String algorithm) throws WSSecurityException
algorithm
- the URI of the algorithm. See http://www.w3.org/TR/xmlenc-core1/WSSecurityException
public static SecretKey prepareSecretKey(String algorithm, byte[] rawKey)
public static KeyGenerator getKeyGenerator(String algorithm) throws WSSecurityException
WSSecurityException
public static Cipher getCipherInstance(String cipherAlgo) throws WSSecurityException
cipherAlgo
- The cipher in it's WSS URI form,
ref. https://www.w3.org/TR/xmlenc-core1/#sec-AlgorithmsWSSecurityException
public static Cipher getCipherInstance(String cipherAlgo, String provider) throws WSSecurityException
cipherAlgo
- The cipher in it's WSS URI form, ref. https://www.w3.org/TR/xmlenc-core1/#sec-Algorithmsprovider
- The provider which shall instantiate the cipher.WSSecurityException
public static byte[] generateDigest(byte[] inputBytes) throws WSSecurityException
inputBytes
- the bytes to digestWSSecurityException
Copyright © 2017 JBoss by Red Hat. All rights reserved.