public abstract class SSLUtil extends Object
| Constructor and Description |
|---|
SSLUtil() |
| Modifier and Type | Method and Description |
|---|---|
static long |
crc32(String data)
Generates a CRC 32 Value of String passed
|
static InputStream |
downloadCertificateFromPath(String urlPath)
Downloads Certificate from URL
|
static Collection<X509Certificate> |
getCertificateFromStream(InputStream stream)
Generate Collection of Certificate from Input Stream
|
static SSLContext |
getSSLContext(KeyManager[] keymanagers)
Returns a SSLContext
|
static SSLContext |
setupClientSSL(String certPath,
String certPassword)
Create a SSLContext with provided client certificate
|
static boolean |
validateCertificateChain(Collection<X509Certificate> clientCerts,
Collection<X509Certificate> trustCerts,
String authType)
Performs Certificate Chain Validation on provided certificates.
|
static Boolean |
validateData(Collection<X509Certificate> clientCerts,
String algo,
String actualSignatureEncoded,
String expectedSignature,
String requestBody,
String webhookId)
Validates Webhook Signature validation based on https://developer.paypal.com/docs/integration/direct/rest-webhooks-overview/#event-signature
Returns true if signature is valid
|
public static SSLContext getSSLContext(KeyManager[] keymanagers) throws SSLConfigurationException
keymanagers - KeyManager[] The key managersSSLConfigurationExceptionpublic static SSLContext setupClientSSL(String certPath, String certPassword) throws SSLConfigurationException
certPath - certPassword - SSLConfigurationExceptionpublic static boolean validateCertificateChain(Collection<X509Certificate> clientCerts, Collection<X509Certificate> trustCerts, String authType) throws PayPalRESTException
clientCerts - Collection of X509Certificates provided in requesttrustCerts - Collection of X509Certificates trusted by applicationauthType - Auth Type for CertificatePayPalRESTExceptionpublic static InputStream downloadCertificateFromPath(String urlPath) throws PayPalRESTException
urlPath - PayPalRESTExceptionpublic static Collection<X509Certificate> getCertificateFromStream(InputStream stream) throws PayPalRESTException
stream - InputStream of Certificate dataPayPalRESTExceptionpublic static long crc32(String data)
data - public static Boolean validateData(Collection<X509Certificate> clientCerts, String algo, String actualSignatureEncoded, String expectedSignature, String requestBody, String webhookId) throws NoSuchAlgorithmException, SignatureException, InvalidKeyException
clientCerts - Client Certificatesalgo - Algorithm used for signature creation by serveractualSignatureEncoded - Paypal-Transmission-Sig header value passed by serverexpectedSignature - Signature generated by formatting data with CRC32 value of request bodyrequestBody - Request body from serverwebhookId - Id for PayPal Webhook created for receiving the dataNoSuchAlgorithmExceptionSignatureExceptionInvalidKeyExceptionCopyright © 2015. All Rights Reserved.