org.logi.crypto.padding
Class PadPKCS1v15
java.lang.Object
|
+--org.logi.crypto.padding.PadPKCS1v15
- All Implemented Interfaces:
- Padding
- public class PadPKCS1v15
- extends java.lang.Object
- implements Padding
This class implements PKCS#1 v1.5 padding. Instances of it can perform
padding for encryption and unpad after decryption. There are also static
methods for padding of signatures.
- Author:
- Logi Ragnarsson
(logi@logi.org)
|
Method Summary |
static byte[] |
EMSA_PKCS1_v1_5(Fingerprint F,
int emLen)
Encoding Method for Signature with Appendix. |
byte[] |
pad(byte[] plaintext,
int off,
int len,
EncryptionKey key)
Pad the last, perhaps partial, block of plaintext. |
byte[] |
unPad(byte[] plaintext,
int off,
int len,
DecryptionKey key)
Un-pad the last block of plaintext. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PadPKCS1v15
public PadPKCS1v15()
EMSA_PKCS1_v1_5
public static byte[] EMSA_PKCS1_v1_5(Fingerprint F,
int emLen)
throws PaddingException
- Encoding Method for Signature with Appendix. PKCS#1 v1.5, section 9.2.1.
Here, the message has already been hashed and we recieve the Fingerprint
object F. This also specifies the hash function to use.
- Parameters:
F - The fingerprint to sign.emLen - The intended length of the encoded message.random - The randomness source to use for generating padding bytes.
pad
public byte[] pad(byte[] plaintext,
int off,
int len,
EncryptionKey key)
throws PaddingException
- Pad the last, perhaps partial, block of plaintext.
- Specified by:
pad in interface Padding
- Parameters:
plaintext - The array holding plaintext data to pad.off - The offset of data within plaintext array.len - The length of data within plaintext array. This much be less
than a single plaintext block.key - The key which will be used to encrypt the block.
unPad
public byte[] unPad(byte[] plaintext,
int off,
int len,
DecryptionKey key)
throws PaddingException
- Un-pad the last block of plaintext.
- Specified by:
unPad in interface Padding
- Parameters:
padded - The array holding padded plaintext data.off - The offset of data within padded array.len - The length of data within padded array.key - The key which will be used to decrypt the block.
Copyright (c) 1997-2001 Logi Ragnarsson - Distributed under the GPL