O'Reilly logo

Java Security by Scott Oaks

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

Class javax.crypto.Cipher

Synopsis

This engine class represents a cryptographic cipher, either symmetric or asymmetric. To get a cipher for a particular algorithm, call one of the getInstance() methods, specifying an algorithm name, a cipher mode, and a padding scheme. The cipher should be initialized for encryption or decryption using an init() method and an appropriate key (and, optionally, a set of algorithm-specific parameters, though these are typically unused). Then you can perform the encryption or decryption, using the update() and doFinal() methods.

Class Definition

public class javax.crypto.Cipher extends java.lang.Object { // Constants public static final int DECRYPT_MODE; public static final int ENCRYPT_MODE; // Constructors protected Cipher(CipherSpi, Provider, String); // Class Methods public static final Cipher getInstance(String); public static final Cipher getInstance(String, String); // Instance Methods public final byte[] doFinal(); public final byte[] doFinal(byte[]); public final int doFinal(byte[], int); public final byte[] doFinal(byte[], int, int); public final int doFinal(byte[], int, int, byte[]); public final int doFinal(byte[], int, int, byte[], int); public final int getBlockSize(); public final byte[] getIV(); public final int getOutputSize(int); public final AlgorithmParameters getParameters(); public final Provider getProvider(); public final void init(int, Key); public final void init(int, Key, SecureRandom); public final void init(int, Key, AlgorithmParameterSpec); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required