public class IaikProvider extends SecurityProvider
SecurityProviderALG_CIPHER_RSA, ALG_CIPHER_RSA_DECRYPT, ALG_CIPHER_RSA_ENCRYPT, ALG_CIPHER_RSA_SIGN, ALG_CIPHER_RSA_VERIFY, ALG_DIGEST_MD5, ALG_DIGEST_SHA, ALG_HMAC_MD5, ALG_HMAC_SHA, ALG_KEY_EC, ALG_KEY_ECDSA, ALG_KEYEX_COFACTOR_ECDH, ALG_KEYEX_DH, ALG_KEYEX_ESDH, ALG_KEYEX_STD_ECDH, ALG_SIGNATURE_MD5RSA, ALG_SIGNATURE_RAWDSA, ALG_SIGNATURE_RAWECDSA, ALG_SIGNATURE_RAWRSA, ALG_SIGNATURE_RAWRSAPSS, ALG_SIGNATURE_SHADSA, CIPHER_DECRYPT, CIPHER_ENCRYPT, CIPHER_NONE, CIPHER_UNWRAP, CIPHER_WRAP, IMPLEMENTATION_NAME_DSA, IMPLEMENTATION_NAME_ECDSA, IMPLEMENTATION_NAME_RSA, providerName, providerNames, random, SIGNATURE_NONE, SIGNATURE_SIGN, SIGNATURE_VERIFY| Constructor and Description |
|---|
IaikProvider()
Default Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected byte[] |
calculateSignatureFromSignedAttributes(AlgorithmID signatureAlgorithm,
AlgorithmID digestAlgorithm,
java.security.PrivateKey privateKey,
byte[] signedAttributes)
Calculates the signature value for a CMS SignerInfo over the given signed
attributes with the given algorithm using the supplied private key.
|
protected void |
checkDomainParameters(java.security.PrivateKey myKey,
java.security.PublicKey otherKey)
Checks if the given private and public key agreement keya have the same domain
parameters.
|
javax.crypto.SecretKey |
decryptKey(byte[] encryptedKey,
AlgorithmID kea,
java.security.PrivateKey recipientKey)
Decrypts the given encrypted content encryption key for a
KeyTransRecipientInfo. |
protected java.security.KeyPair |
generateKeyAgreementKeyPair(AlgorithmID keyAgreeAlgorithm,
java.security.PublicKey otherKey)
Generates a key pair with same domain parameters of the given public key
for the given key agreement method.
|
java.security.Key |
getPBEKey(char[] password,
AlgorithmID pbeAlg)
Creates secret key from the supplied password using the specified
PBE algorithm.
|
java.security.SecureRandom |
getSecureRandom()
Returns a new instance of the default SecureRandom class set in the
Entrust provider. |
protected boolean |
verifySignatureFromSignedAttributes(AlgorithmID signatureAlgorithm,
AlgorithmID digestAlgorithm,
java.security.PublicKey publicKey,
byte[] signedAttributes,
byte[] signatureValue)
Verifies the signature value of a CMS SignerInfo caclculated over the given signed
attributes with the given algorithm using the supplied public key.
|
calculateSignatureFromHash, convertCipherMode, createSharedKeyEncryptionKey, encryptKey, getAlgorithmParameters, getCipher, getCipher, getCipher, getKeyAgreement, getKeyFactory, getKeyGenerator, getKeyPairGenerator, getMac, getMessageDigest, getMicAlgs, getSecretKeyFactory, getSecurityProvider, getSignature, getSignature, setSecureRandom, setSecurityProvider, unwrapKey, verifySignatureFromHash, wrapKeypublic IaikProvider()
protected byte[] calculateSignatureFromSignedAttributes(AlgorithmID signatureAlgorithm, AlgorithmID digestAlgorithm, java.security.PrivateKey privateKey, byte[] signedAttributes) throws java.lang.Exception
Each SignerInfo included in a CMS SignedData
object may calculate the signature value differently depending on the
presence of signed attributes:
SignerInfo for
calculating the signature when signed attributes are present.
This method uses the supplied digest algorithm to calculate
a hash from the given signed attributes and then forwards this hash
to method calculateSignatureFromHash for calculating the signature value (respectively
doing the digest encryption).
calculateSignatureFromSignedAttributes in class SecurityProvidersignatureAlgorithm - signatureAlgorithm the signature algorithm to be
used, e.g. rsaEncryption, DSAdigestAlgorithm - the digest algorithm used for hash computation (e.g.
SHA-1 or MD5); may be necessary for some signature schemes (e.g.
to be included as a DigestInfo in a PKCS#1 RSA signature)privateKey - the private key of the signer (i.e. the one supplied when
creating a SignerInfo object; may be
some kind of "dummy" key when used for smartcardssignedAttributes - the DER encoding of the signed attributes over which
the signature shall be calculatedjava.lang.Exception - if any kind of exception occurs during signature calculation (e.g.
NoSuchProviderException, NoSuchAlgorithmException (if another signature
algorithm than PKCS#1 RSA, DSA or ECDSA is requested), BadPaddingException,
InvalidKeyException, SignatureException)protected boolean verifySignatureFromSignedAttributes(AlgorithmID signatureAlgorithm, AlgorithmID digestAlgorithm, java.security.PublicKey publicKey, byte[] signedAttributes, byte[] signatureValue) throws java.lang.Exception
Each SignerInfo included in a CMS SignedData
object may calculate the signature value differently depending on the
presence of signed attributes:
SignerInfo for
verifying the signature when no signed attributes are present.
This method uses the supplied digest algorithm to calculate
a hash from the given signed attributes and then forwards this hash
to method verifySignatureFromHash for verifying the signature value (respectively
doing the digest decryption).
verifySignatureFromSignedAttributes in class SecurityProvidersignatureAlgorithm - signatureAlgorithm the signature algorithm,
e.g. rsaEncryption, DSAdigestAlgorithm - the digest algorithm used for hash computation (e.g.
SHA-1 or MD5);publicKey - the public key of the signersignedAttributes - the DER encoding of the signed attributes over which
the signature has been calculatedtrue if the signature is ok, false if notjava.lang.Exception - if any kind of exception occurs during signature verification (e.g.
NoSuchProviderException, NoSuchAlgorithmException (if another signature
algorithm than PKCS#1 RSA, DSA or ECDSA is requested), BadPaddingException,
InvalidKeyException, SignatureException)public javax.crypto.SecretKey decryptKey(byte[] encryptedKey,
AlgorithmID kea,
java.security.PrivateKey recipientKey)
throws java.lang.Exception
KeyTransRecipientInfo.
CMS EnvelopedData uses the KeyTransRecipientInfo type for
encrypting the secret content encryption key with the public key of
the recipient. Currently in general RSA PKCS#1v1.5 is used for key
transport. If rsaEncryption is requested as key encryption algorithm
this method uses a RSA Cipher ("RSA/ECB/PKCS1Padding/Encrypt") for
decrypting the encrypted content encryption key with the supplied
private key of the recipient. If another algorithm than RSA is requested,
this method throws a NoSuchAlgorithmException. An application wishing to
support another algorithm may override this method.
decryptKey in class SecurityProviderencryptedKey - the encrypted content encryption key to be decryptedkea - the key encryption alglorithm to be used, e.g. rsaEncryptionrecipientKey - the private key of the recipient to be used for decrypting
the encrypted content encryption keyjava.lang.Exception - if any kind of exception occurs during cek encryption (e.g.
NoSuchProviderException, NoSuchAlgorithmException, BadPaddingException,
InvalidKeyException)protected void checkDomainParameters(java.security.PrivateKey myKey,
java.security.PublicKey otherKey)
throws java.security.InvalidParameterException
Currently, the key types that are supported are: DH, ESDH, and EC.
checkDomainParameters in class SecurityProvidermyKey - the private key of the first partyotherKey - the public key of the other partyInvalidParameterEyception - if the domain parameters do not matchjava.security.InvalidParameterExceptionprotected java.security.KeyPair generateKeyAgreementKeyPair(AlgorithmID keyAgreeAlgorithm, java.security.PublicKey otherKey) throws java.lang.Exception
This method is called by the library for creating the originator key pair if
the OriginatorPublicKey alternative is used
for representing the public key of the originator within a KeyAgreeRecipientInfo. The public key supplied
to this method is the one of the recipient and the key pair returned by this
method must have domain parameters matching to those of the given recipient public
key. Note that ephemeral static Diffie Hellmean (ESDH) is the default key
agreement method used by the CMS types EnvelopedData and
AuthenticatedData. According RFC 2630 the
OriginatorPublicKey has to be used for representing the public
key of the originator if ESDH is used as key agreement algorithm.
generateKeyAgreementKeyPair in class SecurityProviderkeyAgreeAlgorithm - the key agreement algorithm to be usedotherKey - the public key of the other partyjava.lang.Exception - if another key agreement method than (ES)DH is requested,
key agreement and public key algorithm do not match, or
an error occurs during key pair generator initialization
or key pair generationpublic java.security.Key getPBEKey(char[] password,
AlgorithmID pbeAlg)
throws java.lang.Exception
getPBEKey in class SecurityProviderpassword - the password for creating the secret keypbeAlg - the PBE algorithm to be usedjava.lang.Exception - if the PBE key cannot be createdpublic java.security.SecureRandom getSecureRandom()
Entrust provider.
For more documentation see the superclass SecurityProvider.
getSecureRandom in class SecurityProvider