public class SaslEcdsaNist256PChallenge extends AbstractSaslProtocol<ECPrivateKey>
| Modifier and Type | Class and Description |
|---|---|
static class |
SaslEcdsaNist256PChallenge.ECKeyPair
Holds a private and public key.
|
| Constructor and Description |
|---|
SaslEcdsaNist256PChallenge(Client client,
String accountName,
ECPrivateKey privateKey)
Creates an instance.
|
| Modifier and Type | Method and Description |
|---|---|
static String |
base64Encode(ECPrivateKey privateKey)
Encodes a given
ECPrivateKey to base64. |
static String |
base64Encode(ECPublicKey publicKey)
Encodes a given
ECPublicKey to base64. |
protected String |
getAuthLine()
Gets the info to base64 encode in the first AUTHENTICATE message.
|
static String |
getCompressedBase64PublicKey(ECPublicKey publicKey)
Applies point compression to a public key and returns the result,
encoded with base64.
|
Object |
getEventListener()
Gets the object for listening.
|
static SaslEcdsaNist256PChallenge.ECKeyPair |
getNewKey()
Generates a new
SaslEcdsaNist256PChallenge.ECKeyPair for use with this SASL protocol. |
static ECPrivateKey |
getPrivateKey(String base64Encoded)
Gets a
ECPrivateKey from a base64 encoded String. |
static ECPublicKey |
getPublicKey(String base64Encoded)
Gets a
ECPublicKey from a base64 encoded String. |
static String |
sign(ECPrivateKey privateKey,
String base64Challenge)
Signs a given base64'd challenge via ECDSA.
|
static boolean |
verify(ECPublicKey publicKey,
String base64Challenge,
String signature)
Verifies a signature.
|
getAuthentication, getAuthValue, setAuthValuegetAccountName, getClient, setAccountName, startAuthentication, toString@Nonnull protected String getAuthLine()
AbstractSaslProtocolgetAuthLine in class AbstractSaslProtocol<ECPrivateKey>@Nonnull public Object getEventListener()
EventListeninggetEventListener in interface EventListeninggetEventListener in class AbstractSaslProtocol<ECPrivateKey>@Nonnull public static String base64Encode(@Nonnull ECPrivateKey privateKey)
ECPrivateKey to base64.privateKey - key to encodeIllegalArgumentException - if privateKey is nullgetPrivateKey(String)@Nonnull public static String base64Encode(@Nonnull ECPublicKey publicKey)
ECPublicKey to base64.publicKey - key to encodeIllegalArgumentException - if publicKey is nullgetPublicKey(String)@Nonnull public static ECPrivateKey getPrivateKey(@Nonnull String base64Encoded) throws NoSuchAlgorithmException, InvalidKeySpecException
ECPrivateKey from a base64 encoded String.base64Encoded - encoded stringNoSuchAlgorithmException - if the JVM doesn't support ECInvalidKeySpecException - if the encoded key is invalidIllegalArgumentException - if base64Encoded is nullbase64Encode(ECPrivateKey)@Nonnull public static ECPublicKey getPublicKey(@Nonnull String base64Encoded) throws NoSuchAlgorithmException, InvalidKeySpecException
ECPublicKey from a base64 encoded String.base64Encoded - encoded stringNoSuchAlgorithmException - if the JVM doesn't support ECInvalidKeySpecException - if the encoded key is invalidIllegalArgumentException - if base64Encoded is nullbase64Encode(ECPublicKey)@Nonnull public static String getCompressedBase64PublicKey(@Nonnull ECPublicKey publicKey)
publicKey - the public key to get the compressed X9.62
representation forIllegalArgumentException - if publicKey is null@Nonnull public static String sign(@Nonnull ECPrivateKey privateKey, @Nonnull String base64Challenge) throws SignatureException, NoSuchAlgorithmException, InvalidKeyException
privateKey - private key for signingbase64Challenge - challenge to signSignatureException - if signing failsNoSuchAlgorithmException - if the JVM doesn't support NONEwithECDSAInvalidKeyException - if the key is invalidIllegalArgumentException - if either parameter is null@Nonnull public static SaslEcdsaNist256PChallenge.ECKeyPair getNewKey() throws NoSuchAlgorithmException
SaslEcdsaNist256PChallenge.ECKeyPair for use with this SASL protocol.NoSuchAlgorithmException - if the JVM doesn't support NONEwithECDSApublic static boolean verify(@Nonnull ECPublicKey publicKey, @Nonnull String base64Challenge, @Nonnull String signature) throws SignatureException, NoSuchAlgorithmException, InvalidKeyException
publicKey - public key to use in verificationbase64Challenge - the challenge that was signedsignature - signatureSignatureException - if something has gone horribly wrongNoSuchAlgorithmException - if the JVM doesn't support NONEwithECDSAInvalidKeyException - if the key is invalidIllegalArgumentException - if any parameter is nullCopyright © 2013–2019 Kitteh. All rights reserved.