Package com.braintreegateway.exceptions

Examples of com.braintreegateway.exceptions.InvalidSignatureException


    public WebhookNotification parse(String signature, String payload) {
        Pattern p = Pattern.compile("[^A-Za-z0-9+=/\n]");
        Matcher m = p.matcher(payload);
        if (m.find()) {
          throw new InvalidSignatureException("payload contains illegal characters");
        }
        validateSignature(signature, payload);
        String xmlPayload = new String(Base64.decodeBase64(payload));
        NodeWrapper node = NodeWrapperFactory.instance.create(xmlPayload);
        return new WebhookNotification(node);
View Full Code Here


                }
            }
        }

        if (matchingSignature == null) {
          throw new InvalidSignatureException("no matching public key");
        }

        if (!(matchSignature(payload, matchingSignature) || matchSignature(payload + "\n", matchingSignature))) {
            throw new InvalidSignatureException("signature does not match payload - one has been modified");
        }
    }
View Full Code Here

        }

        Crypto crypto = new Crypto();
        String computedSignature = crypto.hmacHash(configuration.privateKey, payload);
        if (!crypto.secureCompare(computedSignature, matchingSignature)) {
            throw new InvalidSignatureException();
        }
    }
View Full Code Here

TOP

Related Classes of com.braintreegateway.exceptions.InvalidSignatureException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.