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; public static final int PRIVATE_KEY; public static final int PUBLIC_KEY; public static final int SECRET_KEY; public static final int UNWRAP_MODE; public static final int WRAP_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 int doFinal(byte[], int, int, byte[]); public final int doFinal(byte[], int, int, byte[], int); public final byte[] doFinal(byte[]); public final byte[] doFinal(byte[], int, int); public final byte[] doFinal( ); public final int doFinal(byte[], int); public final String getAlgorithm( ); public final int getBlockSize( ); public final ExemptionMechanism getExemptionMechanism( ...

Get Java Security, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.