|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectCipher
COM.claymoresystems.provider.RawRSACipher
public class RawRSACipher
The raw RSA encryption algorithm, without any block framing.
If the number of bits in the modulus is bitlength, the plaintext and
ciphertext block sizes will both be (int) ((bitlength+7)/8)
.
When in ENCRYPT mode, if the value of any plaintext block, considered as a
BigInteger with Big-Endian byte order, is greater than or equal to the
modulus, a CryptixException will be thrown.
This class is designed to allow any input to the RSA encryption algorithm, in order to facilitate implementation of standards which use a block framing format not otherwise supported by Cryptix. Note that using raw RSA directly on application data is potentially insecure; wherever possible a higher level algorithm such as "RSA/PKCS#1" should be used.
(Note: RSA/PKCS#1 is not implemented in this version of Cryptix.)
References:
Copyright © 1997
Systemics Ltd on behalf of the
Cryptix Development Team.
All rights reserved.
$Revision: 1.11 $
Constructor Summary | |
---|---|
RawRSACipher()
Constructs a RawRSA cipher object, in the UNINITIALIZED state. |
Method Summary | |
---|---|
protected int |
engineCiphertextBlockSize()
|
protected void |
engineInitDecrypt(java.security.Key key)
SPI: Initializes this cipher object for decryption, using the given private key. |
protected void |
engineInitEncrypt(java.security.Key key)
SPI: Initializes this cipher object for encryption, using the given public key. |
protected int |
enginePlaintextBlockSize()
SPI: Return the block size, in bytes. |
protected int |
engineUpdate(byte[] in,
int inOffset,
int inLen,
byte[] out,
int outOffset)
|
static void |
main(java.lang.String[] args)
Entry point for very basic self_test . |
static void |
self_test(java.io.PrintWriter out)
|
void |
setBlindingInfo(java.security.SecureRandom rng,
CryptixRSAPublicKey pubKey)
set the RNG for blinding |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RawRSACipher()
Method Detail |
---|
protected void engineInitEncrypt(java.security.Key key) throws java.security.InvalidKeyException
key
- the public key to be used for encryption.
java.security.InvalidKeyException
- if the key class does not implement
java.security.interfaces.RSAPublicKey.protected void engineInitDecrypt(java.security.Key key) throws java.security.InvalidKeyException
key
- the private key to be used for decryption.
java.security.InvalidKeyException
- if the key class does not implement
java.security.interfaces.RSAPrivateKey.protected int enginePlaintextBlockSize()
CryptixException
- if the cipher object is uninitialized.protected int engineCiphertextBlockSize()
protected int engineUpdate(byte[] in, int inOffset, int inLen, byte[] out, int outOffset)
public void setBlindingInfo(java.security.SecureRandom rng, CryptixRSAPublicKey pubKey)
setBlindingInfo
in interface Blindable
rng
- a secure RNGpublic static final void main(java.lang.String[] args)
self_test
.
public static void self_test(java.io.PrintWriter out) throws java.lang.Exception
java.lang.Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |