public class PkiUtils extends Object
Modifier and Type | Field and Description |
---|---|
protected static org.slf4j.Logger |
log |
Constructor and Description |
---|
PkiUtils() |
Modifier and Type | Method and Description |
---|---|
static byte[] |
decodeBase64Message(String message)
Convert a JSON friendly PKI token to a standard base64 encoded string.
|
static byte[] |
decodeToken(String token)
Decode a CMS token retrieved from keystone by stripping headers, footers, and other extraneous characters to
produce a PKCS7 compatible signed message which can be used to instantiate a sun PCKS7 object.
|
static byte[] |
decompressPkizBytes(byte[] compressedBytes) |
static String |
getMD5Hash(String token) |
static boolean |
isTokenPKIType(String token)
Checks the token type i.e.
|
static byte[] |
validatePkiToken(Certificate certificate,
String token)
Verify signature by checking all signers and bailing as soon as a signerInfo verification fails
|
static byte[] |
validatePkiToken(File certificateFile,
String token)
Verify signature by checking all signers and bailing as soon as a signerInfo verification fails
|
public static byte[] decompressPkizBytes(byte[] compressedBytes) throws IOException, DataFormatException
IOException
DataFormatException
public static byte[] decodeBase64Message(String message) throws IOException, DataFormatException
message
- - Base64 encoded message.IOException
DataFormatException
public static byte[] validatePkiToken(File certificateFile, String token) throws AuthenticationException
certificateFile
- - Signing certificate public keytoken
- - PKCS7 message containing the signed text and the signature.AuthenticationException
public static byte[] decodeToken(String token) throws IOException, DataFormatException
token
- - A string formatted PKI or PKIZ tokenIOException
DataFormatException
public static byte[] validatePkiToken(Certificate certificate, String token) throws AuthenticationException
certificate
- - Signing certificate public keytoken
- - PKCS7 message containing the signed text and the signature.AuthenticationException
public static String getMD5Hash(String token) throws UnsupportedEncodingException, NoSuchAlgorithmException
public static boolean isTokenPKIType(String token)
token
- the token need to checkedCopyright © 2015. All Rights Reserved.