public class EventWebhook extends Object
Constructor and Description |
---|
EventWebhook() |
Modifier and Type | Method and Description |
---|---|
ECPublicKey |
ConvertPublicKeyToECDSA(String publicKey)
Convert the public key string to a ECPublicKey.
|
boolean |
VerifySignature(ECPublicKey publicKey,
byte[] payload,
String signature,
String timestamp)
Verify signed event webhook requests.
|
boolean |
VerifySignature(ECPublicKey publicKey,
String payload,
String signature,
String timestamp)
Verify signed event webhook requests.
|
public ECPublicKey ConvertPublicKeyToECDSA(String publicKey) throws NoSuchAlgorithmException, NoSuchProviderException, InvalidKeySpecException
publicKey:
- verification key under Mail SettingsNoSuchAlgorithmException
NoSuchProviderException
InvalidKeySpecException
public boolean VerifySignature(ECPublicKey publicKey, String payload, String signature, String timestamp) throws NoSuchAlgorithmException, NoSuchProviderException, InvalidKeyException, SignatureException, IOException
publicKey:
- elliptic curve public keypayload:
- event payload string in the request bodysignature:
- value obtained from the
'X-Twilio-Email-Event-Webhook-Signature' headertimestamp:
- value obtained from the
'X-Twilio-Email-Event-Webhook-Timestamp' headerNoSuchAlgorithmException
NoSuchProviderException
InvalidKeyException
SignatureException
IOException
public boolean VerifySignature(ECPublicKey publicKey, byte[] payload, String signature, String timestamp) throws NoSuchAlgorithmException, NoSuchProviderException, InvalidKeyException, SignatureException, IOException
publicKey:
- elliptic curve public keypayload:
- event payload bytes in the request bodysignature:
- value obtained from the
'X-Twilio-Email-Event-Webhook-Signature' headertimestamp:
- value obtained from the
'X-Twilio-Email-Event-Webhook-Timestamp' headerNoSuchAlgorithmException
NoSuchProviderException
InvalidKeyException
SignatureException
IOException
Copyright © 2020. All rights reserved.