Name
Cipher
Synopsis
This class performs encryption and
decryption of byte arrays. Cipher is
provider-based, so to obtain a Cipher object, you
must call the static
getInstance( )
factory method. The arguments to getInstance( ) are a string that
describes the type of encryption desired and, optionally, the name of
the provider whose implementation should be used. To specify the
desired type of encryption, you can simply specify the name of an
encryption algorithm, such as
“DES”. In Java 5.0, the
“SunJCE” provider supports the
following algorithm names:
|
AES |
DES |
RSA |
|
AESWrap |
DESede |
PBEWithMD5AndDES |
|
ARCFOUR |
DESedeWrap |
PBEWithMD5AndTripleDES |
|
Blowfish |
RC2 |
PBEWithSHA1AndRC2_40 |
Advanced users may specify a three-part algorithm name that includes
the encryption algorithm, the algorithm operating mode, and the
padding scheme. These three parts are separated by slash characters,
as in “DES/CBC/PKCS5Padding”.
Finally, if you are requesting a block cipher algorithm in a stream
mode, you can specify the number of bits to be processed at a time by
following the name of the feedback mode with a number of bits. For
example: “DES/CFB8/NoPadding”.
Details of supported operating modes and padding schemes are beyond
the scope of this book. In Java 5.0, you can obtain details about the
services available through the SunJCE (or any other) provider through
the java.security.Provider.Services class.
Once
you have obtained a Cipher object for the desired cryptographic algorithm, mode, and padding ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access