public class IaikEccProvider extends IaikProvider
iaik.security.ssl.ECCelerateProvider
) is included within the iaik_ssl.jar
file.
This iSaSiLk SecurityProvider implements some methods that are required for supporting elliptic curve cipher suites according to RFC 4492.
To install this security provider call:
// register IAIK-ECC provider iaik.security.ecc.provider.ECCProvider.addAsProvider(); // install security provider SecurityProvider.setSecurityProvider(new IaikEccProvider());
SecurityProvider
,
IaikProvider
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
EC_DEFAULT_BINARY
Deprecated.
Default binary curve to be used if arbitrary char2
curves are suggested by the client.
|
static java.lang.String |
EC_DEFAULT_PRIME
Deprecated.
Default prime curve to be used if arbitrary prime
curves are suggested by the client.
|
ALG_CIPHER_3DES, ALG_CIPHER_AES, ALG_CIPHER_AES_CCM, ALG_CIPHER_AES_GCM, ALG_CIPHER_AES_PKCS5, ALG_CIPHER_CAMELLIA, ALG_CIPHER_CAMELLIA_GCM, ALG_CIPHER_CHACHA20_POLY1305, ALG_CIPHER_DES, ALG_CIPHER_IDEA, ALG_CIPHER_RC2, ALG_CIPHER_RC4, ALG_CIPHER_RSA, ALG_CIPHER_RSA_DECRYPT, ALG_CIPHER_RSA_ENCRYPT, ALG_CIPHER_RSA_ENCRYPT_SSL2, ALG_CIPHER_RSA_SIGN, ALG_CIPHER_RSA_VERIFY, ALG_DIGEST_MD5, ALG_DIGEST_SHA, ALG_DIGEST_SHA1, ALG_DIGEST_SHA224, ALG_DIGEST_SHA256, ALG_DIGEST_SHA384, ALG_DIGEST_SHA512, ALG_HMAC_MD5, ALG_HMAC_SHA, ALG_HMAC_SHA256, ALG_HMAC_SHA384, ALG_HMAC_SHA512, ALG_KEM_MLKEM1024, ALG_KEM_MLKEM512, ALG_KEM_MLKEM768, ALG_KEYEX_DH, ALG_KEYEX_DSA, ALG_KEYEX_DSA_CLIENT, ALG_KEYEX_ECDH, ALG_KEYEX_ECDSA, ALG_KEYEX_ECDSA_CLIENT, ALG_KEYEX_RSA, ALG_KEYGEN_AES, ALG_KEYGEN_HMAC_SHA, ALG_KEYGEN_HMAC_SHA256, ALG_KEYGEN_PBKDF2, ALG_KEYPAIR_RSA, ALG_SIGNATURE_MD5RSA, ALG_SIGNATURE_RAWDSA, ALG_SIGNATURE_RAWECDSA, ALG_SIGNATURE_RAWRSAPSS, ALG_SIGNATURE_SHA1ECDSA, ALG_SIGNATURE_SHA1RSA, ALG_SIGNATURE_SHA224ECDSA, ALG_SIGNATURE_SHA224RSA, ALG_SIGNATURE_SHA256ECDSA, ALG_SIGNATURE_SHA256RSA, ALG_SIGNATURE_SHA384ECDSA, ALG_SIGNATURE_SHA384RSA, ALG_SIGNATURE_SHA512ECDSA, ALG_SIGNATURE_SHA512RSA, ALG_SIGNATURE_SHADSA, ALG_SIGNATURE_SHAECDSA, CIPHER_DECRYPT, CIPHER_ENCRYPT, CIPHER_NONE, configuration_, CONFIGURATION_PROPERTIES, KEYAGREEMENT_INIT, KEYAGREEMENT_NONE, provider, providerName, SIGNATURE_NONE, SIGNATURE_SIGN, SIGNATURE_VERIFY
Constructor and Description |
---|
IaikEccProvider()
Deprecated.
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
checkIfOnSameCurve(java.security.PublicKey ecdhServerPublicKey,
java.security.PublicKey ecdhClientPublicKey)
Deprecated.
Checks if the given public server and client key are on the same
elliptic curve.
|
boolean |
checkKeyECPointFormat(java.security.PublicKey publicKey,
SupportedPointFormats supportedPointFormats)
Deprecated.
Checks if the given public key complies with the given
SupportedPointFormats extension.
|
boolean |
checkKeyEllipticCurve(java.security.PublicKey publicKey,
SupportedEllipticCurves supportedEllipticCurves)
Deprecated.
Checks if the given public key complies with the given
SupportedEllipticCurves extension.
|
java.security.PublicKey |
decodeECPublicKey(byte[] ecPoint,
java.security.PrivateKey privateKey,
SupportedPointFormats supportedPointFormats)
Deprecated.
Decodes the given encoded EC PublicKey according to the Octet-String-to-Point conversion
of ANSI X9.62 (1998), section 4.3.7.
|
java.security.PublicKey |
decodeECPublicKey(byte[] ecPoint,
SupportedEllipticCurves.NamedCurve curve,
SupportedPointFormats supportedPointFormats,
SupportedEllipticCurves supportedEllipticCurves)
Deprecated.
Decodes the given encoded EC PublicKey according to the Octet-String-to-Point conversion
of ANSI X9.62 (1998), section 4.3.7.
|
byte[] |
encodeECPublicKey(java.security.PublicKey publicKey,
SupportedPointFormats supportedPointFormats)
Deprecated.
Encodes the given EC PublicKey according to the Point-To-Octet-String conversion
of ANSI X9.62 (1998), section 4.3.6.
|
java.security.KeyPair |
generateECKeyPair(java.security.PublicKey serverKey)
Deprecated.
Generates a key pair with same domain parameters as the given public key
for the given key agreement method.
|
java.security.KeyPair |
generateECKeyPair(SupportedEllipticCurves supportedEllipticCurves,
SupportedPointFormats supportedPointFormats)
Deprecated.
Generates a EC key pair according to the given list of supported curves.
|
SupportedEllipticCurves.NamedCurve |
getCurve(java.security.PrivateKey ecPrivateKey)
Deprecated.
Gets the NamedCurve belonging to the given private EC key.
|
SupportedEllipticCurves.NamedCurve |
getCurve(java.security.PublicKey ecPublicKey)
Deprecated.
Gets the NamedCurve belonging to the given public EC key.
|
java.lang.String |
getCurveName(java.security.PrivateKey ecPrivateKey)
Deprecated.
Gets the curve name belonging to the given private EC key.
|
java.lang.String |
getCurveName(java.security.PublicKey ecPublicKey)
Deprecated.
Gets the curve name belonging to the given public EC key.
|
SupportedPointFormats.ECPointFormat |
getECPointFormat(java.security.PublicKey ecPublicKey)
Deprecated.
Gets the ECPointFormat (uncompressed, compressed prime, compressed char2)
of the given public EC key.
|
javax.crypto.KeyAgreement |
getKeyAgreement(java.lang.String algorithm,
int mode,
java.security.Key key,
java.security.spec.AlgorithmParameterSpec params,
java.security.SecureRandom random)
Deprecated.
Gets a KeyAgreement object for the given algorithm.
|
int |
getKeyLength(java.security.PrivateKey privKey)
Deprecated.
Calculates the length of the given private key.
|
int |
getKeyLength(java.security.PublicKey pubKey)
Deprecated.
Calculates the length of the given public key.
|
protected java.security.Signature |
getSignature(java.lang.String algorithm,
int mode,
java.security.Key key,
java.security.SecureRandom random)
Deprecated.
Return a Signature implementation for the requested algorithm from the IAIK_ECC
provider.
|
boolean |
isBinary(java.security.PublicKey ecPublicKey)
Deprecated.
Checks if the curve of the given EC Public Key is binary or prime.
|
boolean |
isNamedCurveSupported(SupportedEllipticCurves.NamedCurve curve)
Deprecated.
Checks if the given NamedCurve is supported by this SecurityProvider.
|
boolean |
isPointFormatSupported(SupportedPointFormats.ECPointFormat pointFormat)
Deprecated.
Checks if the given ECPointFormat is supported by this SecurityProvider.
|
aeadDecrypt, aeadEncrypt, calculateTrustedAuthorityIdentifier, canBeUsedWithKey, checkCreatedRSAServerKeyExchangeSignature, checkExtendedKeyUsage, createCertStatusRequest, createPkiPath, deriveKey, getCipher, getDHPrivateKey, getDHPublicKey, getEncodedPrincipal, getMessageDigest, getPrincipal, getRSAPssParameterSpec, getRSAPublicKey, getSecureRandom, getTLSServerName, getTLSServerName, getX509Certificate, getX509Certificate, getX509Certificates, loadKeyStore, loadKeyStore
calculateRawSignature, calculateRawSignature, canBeUsedWithKey, canBeUsedWithKey, canBeUsedWithKey, canBeUsedWithVersion, checkCertSignatureAlgorithm, checkCertSignatureAlgorithm, checkCertSignatureAlgorithm, checkKeyLength, checkKeyLength, continueIfPeerDoesNotSupportSecureRenegotiation, createSharedECDHSecret, decapsulate, decodePqcPublicKey, decodeURL, encapsulate, encodePqcPublicKey, encodeURL, generateECKeyPair, generateExtendedMasterSecret, generateMasterSecret, generateMasterSecret, generatePqcKeyPair, getAlgorithmParameterGenerator, getCurve, getDefaultCurve, getKeyGenerator, getKeyLength, getKeyPairGenerator, getMac, getMacLength, getNamedCurve, getSecurityProvider, getSignature, getSignatureAlgorithms, getSignatureAlgorithms, getSignatureScheme, getTLSServerName, getTLSServerName, isImplemented, isImplemented, isImplementedSignatureAlgorithm, isNamedGroupSupported, setImplementationCheckDebugStream, setSecurityProvider, validateDHPublicKey, verifyRawSignature
public static final java.lang.String EC_DEFAULT_PRIME
public static final java.lang.String EC_DEFAULT_BINARY
protected java.security.Signature getSignature(java.lang.String algorithm, int mode, java.security.Key key, java.security.SecureRandom random) throws java.lang.Exception
getSignature
in class IaikProvider
algorithm
- the name of the signature algorithmmode
- the mode deciding whether to initialize the Signature engine for
signing (SIGNATURE_SIGN
), for verification
(SIGNATURE_VERIFY
) or whether to do not
initialize the engine at all (SIGNATURE_NONE
)key
- the key with which to -- if requested -- init the Signature object
(if not null
)random
- the random generator with which to -- if requested -- init the
Signature object (if not null
) (ignored because of
JDK 1.1 compatibility; an application may override this method
to use signature.initSign(privateKey, random);
)java.lang.Exception
public javax.crypto.KeyAgreement getKeyAgreement(java.lang.String algorithm, int mode, java.security.Key key, java.security.spec.AlgorithmParameterSpec params, java.security.SecureRandom random) throws java.lang.Exception
KeyAgreement
engine for ECDH
based cipher suites.
If the mode parameter is KEYAGREEMENT_INIT
the
KeyAgreement object is to be initialized with the provided key,
parameters (if not null
) and random number generator
(if not null
).
getKeyAgreement
in class SecurityProvider
algorithm
- the name of the KeyAgreement algorithm (e.g. "ECDH")mode
- the mode deciding whether to initialize (KEYAGREEMENT_INIT
) the KeyAgreement or not (KEYAGREEMENT_NONE
)key
- the key with which to -- if requested -- init the KeyAgreement object
(if not null
)params
- the parameters with which to (-- if requested -- init the KeyAgreement
object (if not null
)random
- the random generator with which to -- if requested -- init the
KeyAgreement object (if not null
)java.lang.Exception
- if no KeyAgreement instance for the required algorithm is available
or initialization of the KeyAgreement object failspublic int getKeyLength(java.security.PublicKey pubKey)
getKeyLength
in class SecurityProvider
pubKey
- the public key for which to calculate the lengthjava.lang.IllegalArgumentException
- if the public key algorithm is not supportedpublic int getKeyLength(java.security.PrivateKey privKey)
getKeyLength
in class SecurityProvider
privKey
- the public key for which to calculate the lengthjava.lang.IllegalArgumentException
- if the private key algorithm is not supportedpublic byte[] encodeECPublicKey(java.security.PublicKey publicKey, SupportedPointFormats supportedPointFormats) throws java.lang.Exception
encodeECPublicKey
in class SecurityProvider
publicKey
- the public EC key to be encodedsupportedPointFormats
- the supported point formats of the peer;
or null
if the peer did not
send a SupportedPointFormats
extension (in this case the uncompressed format has to
be used)java.lang.Exception
- if an error occurs when encoding the keypublic java.security.PublicKey decodeECPublicKey(byte[] ecPoint, SupportedEllipticCurves.NamedCurve curve, SupportedPointFormats supportedPointFormats, SupportedEllipticCurves supportedEllipticCurves) throws java.lang.Exception
This method is called on the client side to decode the public server key contained in an ECDH ServerKeyExchange message received from the server.
decodeECPublicKey
in class SecurityProvider
ecPoint
- the (client) public key ECPoint, encoded according to
ANSI X9.62 (1998), section 4.3.6curve
- the curve of the keysupportedPointFormats
- the supported point formats sent to the server within
the SupportedPointFormats
extension; if not null
check if the received
key corresponds with the supported point formatssupportedEllipticCurves
- the supported elliptic curves sent to the server within
the SupportedEllipticCurves
extension; if not null
check if the received
curve corresponds with the supported curve listjava.lang.Exception
- if an error occurs when decoding the keypublic java.security.PublicKey decodeECPublicKey(byte[] ecPoint, java.security.PrivateKey privateKey, SupportedPointFormats supportedPointFormats) throws java.lang.Exception
This method is called on the server side to decode the public client key contained in an ECDH ClientKeyExchange message received from the client.
decodeECPublicKey
in class SecurityProvider
ecPoint
- the (client) public key ECPoint, encoded according to
ANSI X9.62 (1998), section 4.3.6privateKey
- the private (server) key containing the required domain
parameterssupportedPointFormats
- the SupportedPointFormats
extension sent to the client; if not null
check
if the received key corresponds with the supported point formatsjava.lang.Exception
- if an error occurs when decoding the keypublic java.security.KeyPair generateECKeyPair(java.security.PublicKey serverKey) throws java.lang.Exception
This method is called by the library for creating the client key pair if ECDH or ECDHE ephemeral key exchange is used without fixed client authentication.
generateECKeyPair
in class SecurityProvider
serverKey
- the public key of the serverjava.lang.Exception
- if an error occurs when creating the key pairpublic java.security.KeyPair generateECKeyPair(SupportedEllipticCurves supportedEllipticCurves, SupportedPointFormats supportedPointFormats) throws java.lang.Exception
generateECKeyPair
in class SecurityProvider
supportedEllipticCurves
- the supported elliptic curves, maybe
null
if the client has not sent
a SupportedEllipticCurves extensionsupportedPointFormats
- the supported point formats; if not null
maybe used to check if the peer may prefer a char2
curve (if no SupportedEllipticCurves extension has
been sent)java.lang.Exception
- if an error occurs when generating the EC KeyPairpublic SupportedEllipticCurves.NamedCurve getCurve(java.security.PublicKey ecPublicKey)
getCurve
in class SecurityProvider
ecPublicKey
- the public ECnull
if the
curve of the key is not supportedpublic java.lang.String getCurveName(java.security.PublicKey ecPublicKey)
getCurveName
in class SecurityProvider
ecPublicKey
- the public EC key for which to get the NamedCurvenull
if the
curve of the key is not supportedpublic SupportedEllipticCurves.NamedCurve getCurve(java.security.PrivateKey ecPrivateKey)
getCurve
in class SecurityProvider
ecPrivateKey
- the private EC keynull
if the
curve of the key is not supportedpublic java.lang.String getCurveName(java.security.PrivateKey ecPrivateKey)
getCurveName
in class SecurityProvider
ecPrivateKey
- the private EC key for which to get the NamedCurvenull
if the
curve of the key is not supportedpublic SupportedPointFormats.ECPointFormat getECPointFormat(java.security.PublicKey ecPublicKey)
getECPointFormat
in class SecurityProvider
ecPublicKey
- the public EC key for which to get the EC point formatnull
if the
point format cannot be checkedpublic boolean isBinary(java.security.PublicKey ecPublicKey) throws java.lang.Exception
isBinary
in class SecurityProvider
ecPublicKey
- the EC public keyjava.lang.Exception
- if the key does not represent an EC key or it cannot
be determined if the underlying field is prime or binarypublic boolean checkIfOnSameCurve(java.security.PublicKey ecdhServerPublicKey, java.security.PublicKey ecdhClientPublicKey)
ECDSA_fixed_ECDH
and RSA_fixed_ECDH
.checkIfOnSameCurve
in class SecurityProvider
ecdhServerPublicKey
- the ECDH public key of the serverecdhClientPublicKey
- the ECDH public key of the clienttrue
if the two keys are on the same curve,
false
if notpublic boolean isPointFormatSupported(SupportedPointFormats.ECPointFormat pointFormat)
isPointFormatSupported
in class SecurityProvider
pointFormat
- the ECPointFormat to be checkedtrue
if the given ECPointFormat is supported,
false
if it is not supported.public boolean isNamedCurveSupported(SupportedEllipticCurves.NamedCurve curve)
isNamedCurveSupported
in class SecurityProvider
curve
- the NamedCurve to be checkedtrue
if the given NamedCurve is supported,
false
if it is not supported.public boolean checkKeyEllipticCurve(java.security.PublicKey publicKey, SupportedEllipticCurves supportedEllipticCurves)
checkKeyEllipticCurve
in class SecurityProvider
publicKey
- the public key used by the serversupportedEllipticCurves
- the SupportedEllipticCurves extension sent
by the client; maybe null
if
the client has not sent a SupportedEllipticCurves
extensiontrue
if the public key complies with the SupportedEllipticCurves
extension, false
if it is does not comply with it.public boolean checkKeyECPointFormat(java.security.PublicKey publicKey, SupportedPointFormats supportedPointFormats)
false
(since EC
point format check is not supported JDK- and provider independently).checkKeyECPointFormat
in class SecurityProvider
publicKey
- the public key used by the serversupportedPointFormats
- the SupportedPointFormats extension sent
within the Hello message; maybe null
if
no SupportedPointFormats extension has been sent
to the peer (in this case the uncompressed format
has to be used!)true
if the public key complies with the SupportedPointFormats
extension, false
if it is does not comply with it.
By default this method returns false
(since EC
point format is not supported JDK- and provider independently)