|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.security.pkcs1.PKCS1
PKCS #1 object. This interface was derived from the RSA specifications at http://www.rsa.com/rsalabs/pubs/PKCS/. This class implements version 1.5 of the PKCS #1 specifications.
PKCS1 objects are immutable; they cannot be changed once created.
Field Summary | |
static String |
PKCS1_VERSION_1_5
PKCS1 Version 1.5 = "1.5" |
static String |
PKCS1_VERSION2
PKCS1 Version 2.0 = "2.0" |
Constructor Summary | |
PKCS1(String version,
String encryptionAlg,
String digestAlg,
String mgf)
Create a PKCS1 object with the input values. |
|
PKCS1(String version,
String encryptionAlg,
String digestAlg,
String mgf,
String provider)
Create a PKCS1 object with the input values. |
Method Summary | |
byte[] |
decrypt(PrivateKey privateKey,
byte[] ciphertext)
Decrypts the input ciphertext according to the encryption algorithm in this object. |
byte[] |
encrypt(Certificate cert,
byte[] message)
Encrypts the input message according to the encryption algorithm in this object. |
byte[] |
encrypt(PublicKey publicKey,
byte[] message)
Encrypts the input message according to the encryption algorithm in this object. |
String |
getEncryptionAlgorithmString()
Returns the encryption algorithm string. |
String |
getMGF()
|
String |
getSignatureAlgorithmString()
Returns the signature algorithm string. |
String |
getSignatureHashAlgorithmString()
Returns the signature digest algorithm string. |
String |
getVersion()
Returns the version number. |
byte[] |
sign(PrivateKey privateKey,
byte[] message)
Creates a digital signature using the input message and the signature algorithmin this object. |
String |
toString()
Returns a string representation of the PKCS1 object. |
boolean |
verify(Certificate cert,
byte[] message,
byte[] signature)
Verifies the input digital signature against the input message. |
boolean |
verify(PublicKey publicKey,
byte[] message,
byte[] signature)
Verifies the input digital signature against the input message. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
public static final String PKCS1_VERSION_1_5
public static final String PKCS1_VERSION2
Constructor Detail |
public PKCS1(String version, String encryptionAlg, String digestAlg, String mgf, String provider)
version
- the version number. Currently ignored, as only
PKCS1.PKCS1_VERSION_1_5 is supported.encryptionAlg
- is the encryption algorithm. Currently ignored,
as only RSA is supported.digestAlg
- is the digest algorithm. Valid values are SHA, MD2
and MD5. The default value is SHA.mgf
- is the message generation function. Currently ignored, as
no message generation functions are supported in this release.public PKCS1(String version, String encryptionAlg, String digestAlg, String mgf)
version
- the version number. Currently ignored, as only
PKCS1.PKCS1_VERSION_1_5 is supported.encryptionAlg
- is the encryption algorithm. Currently ignored,
as only RSA is supported.digestAlg
- is the digest algorithm. Valid values are SHA, MD2
and MD5. The default value is SHA.mgf
- is the message generation function. Currently ignored, as
no message generation functions are supported in this release.provider
- the provider to be used.Method Detail |
public String getVersion()
public String getEncryptionAlgorithmString()
public String getSignatureHashAlgorithmString()
public String getSignatureAlgorithmString()
public String getMGF()
public byte[] encrypt(PublicKey publicKey, byte[] message) throws PKCSException, NoSuchAlgorithmException
publicKey
- the RSA public key used to encrypt the message.message
- the message to be encrypted.public byte[] encrypt(Certificate cert, byte[] message) throws PKCSException, NoSuchAlgorithmException
cert
- the certificate that contains the RSA public key used to
encrypt the message.message
- the message to be encrypted.public byte[] decrypt(PrivateKey privateKey, byte[] ciphertext) throws PKCSException, NoSuchAlgorithmException
privateKey
- the RSA private key used to decrypt the message.ciphertext
- the message to be decrypted.public byte[] sign(PrivateKey privateKey, byte[] message) throws PKCSException, NoSuchAlgorithmException
privateKey
- the RSA private key used to create the signature.message
- the message to be signed.public boolean verify(PublicKey publicKey, byte[] message, byte[] signature) throws PKCSException, NoSuchAlgorithmException
publicKey
- the RSA public key used to verify the signature.message
- the message to be used in the verification process. This
should be identical to the message used to create the input signature.signature
- the digital signature to be verified.public boolean verify(Certificate cert, byte[] message, byte[] signature) throws PKCSException, NoSuchAlgorithmException
cert
- the certificate containing the RSA public key used to
verify the signature.message
- the message to be used in the verification process. This
should be identical to the message used to create the input signature.signature
- the digital signature to be verified.public String toString()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |