blob: 1681a1222a049621727bd80f1ab89c0f508a46cf [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../jacoco-resources/report.gif" type="image/gif"/><title>OperationMode.java</title><link rel="stylesheet" href="../jacoco-resources/prettify.css" type="text/css"/><script type="text/javascript" src="../jacoco-resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">Apache Shiro :: Cryptography :: Ciphers</a> &gt; <a href="index.source.html" class="el_package">org.apache.shiro.crypto</a> &gt; <span class="el_source">OperationMode.java</span></div><h1>OperationMode.java</h1><pre class="source lang-java linenums">/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* &quot;License&quot;); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* &quot;AS IS&quot; BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.shiro.crypto;
/**
* A cipher &lt;a href=&quot;http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation&quot;&gt;mode of operation&lt;/a&gt;
* directs a cipher algorithm how to convert data during the encryption or decryption process. This enum represents
* all JDK-standard Cipher operation mode names as defined in
* &lt;a href=&quot;http://java.sun.com/javase/6/docs/technotes/guides/security/StandardNames.html&quot;&gt;JDK Security Standard
* Names&lt;/a&gt;, as well as a few more that are well-known and supported by other JCA Providers.
* &lt;p/&gt;
* This {@code enum} exists to provide Shiro end-users type-safety when declaring an operation mode. This helps reduce
* error by providing a compile-time mechanism to specify a mode and guarantees a valid name that will be
* recognized by an underlying JCA Provider.
* &lt;h2&gt;Standard or Non-Standard?&lt;/h2&gt;
* All modes listed specify whether they are a JDK standard mode or a non-standard mode. Standard modes are included
* in all JDK distributions. Non-standard modes can
* sometimes result in better performance or more secure output, but may not be available on the target JDK
* platform and rely on an external JCA Provider to be installed. Some providers
* (like &lt;a href=&quot;http://www.bouncycastle.org&quot;&gt;Bouncy Castle&lt;/a&gt;) may support these modes however.
*
* @see &lt;a href=&quot;http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation&quot;&gt;Block Cipher Modes of Operation&lt;a/&gt;
* @since 1.0
*/
<span class="fc" id="L41">public enum OperationMode {</span>
/**
* &lt;a href=&quot;http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher-block_chaining_.28CBC.29&quot;&gt;
* Cipher-block Chaining&lt;/a&gt; mode, defined in &lt;a href=&quot;http://csrc.nist.gov/publications/fips/index.html&quot;&gt;FIPS
* PUB 81&lt;/a&gt;.
* &lt;p/&gt;
* This is a standard JDK operation mode and should be supported by all JDK environments.
*/
<span class="fc" id="L50"> CBC,</span>
/**
* &lt;a href=&quot;http://en.wikipedia.org/wiki/CCM_mode&quot;&gt;Counter with CBC-MAC&lt;/a&gt; mode&lt;b&gt;*&lt;/b&gt; - for block ciphers with
* 128 bit block-size only. See &lt;a href=&quot;http://www.ietf.org/rfc/rfc3610.txt&quot;&gt;RFC 3610&lt;/a&gt; for AES Ciphers.
* This mode has essentially been replaced by the more-capable {@link #EAX EAX} mode.
* &lt;p/&gt;
* &lt;b&gt;*THIS IS A NON-STANDARD MODE&lt;/b&gt;. It is not guaranteed to be supported across JDK installations. You must
* ensure you have a JCA Provider that can support this cipher operation mode.
* &lt;a href=&quot;http://www.bouncycastle.org&quot;&gt;Bouncy Castle&lt;/a&gt; &lt;em&gt;may&lt;/em&gt; be one such provider.
*/
<span class="fc" id="L61"> CCM,</span>
/**
* &lt;a href=&quot;http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher_feedback_.28CFB.29&quot;&gt;Cipher
* Feedback&lt;a/&gt; mode, defined in &lt;a href=&quot;http://csrc.nist.gov/publications/fips/index.html&quot;&gt;FIPS PUB 81&lt;/a&gt;.
* &lt;p/&gt;
* This is a standard JDK operation mode and should be supported by all JDK environments.
*/
<span class="fc" id="L69"> CFB,</span>
/**
* &lt;a href=&quot;http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Counter_.28CTR.29&quot;&gt;Counter Mode&lt;/a&gt;, aka
* Integer Counter Mode (ICM) and Segmented Integer Counter (SIC). Counter is a simplification of {@link #OFB OFB}
* and updates the input block as a counter.
* &lt;p/&gt;
* This is a standard JDK operation mode and should be supported by all JDK environments.
*/
<span class="fc" id="L78"> CTR,</span>
/**
* &lt;a href=&quot;http://en.wikipedia.org/wiki/EAX_mode&quot;&gt;EAX Mode&lt;/a&gt;&lt;b&gt;*&lt;/b&gt;. This is a patent-free but less-effecient
* alternative to {@link #OCB OCB} and has capabilities beyond what {@link #CCM CCM} can provide.
* &lt;p/&gt;
* &lt;b&gt;*THIS IS A NON-STANDARD MODE&lt;/b&gt;. It is not guaranteed to be supported across JDK installations. You must
* ensure you have a JCA Provider that can support this cipher operation mode.
* &lt;a href=&quot;http://www.bouncycastle.org&quot;&gt;Bouncy Castle&lt;/a&gt; &lt;em&gt;may&lt;/em&gt; be one such provider.
*/
<span class="fc" id="L88"> EAX,</span>
/**
* &lt;a href=&quot;http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Electronic_codebook_.28ECB.29&quot;&gt;Electronic
* Codebook&lt;/a&gt; mode, defined in &lt;a href=&quot;http://csrc.nist.gov/publications/fips/index.html&quot;&gt;FIPS PUB 81&lt;/a&gt;.
* ECB is the only mode that does &lt;em&gt;not&lt;/em&gt; require an Initialization Vector, but because of this, can be seen
* as less secure than operation modes that require an IV.
* &lt;p/&gt;
* This is a standard JDK operation mode and should be supported by all JDK environments.
*/
<span class="fc" id="L98"> ECB,</span>
/**
* &lt;a href=&quot;http://en.wikipedia.org/wiki/GCM_mode&quot;&gt;Galois/Counter&lt;/a&gt; mode&lt;b&gt;*&lt;/b&gt; - for block ciphers with 128
* bit block-size only.
* &lt;p/&gt;
* &lt;b&gt;*THIS IS A NON-STANDARD MODE&lt;/b&gt;. It is not guaranteed to be supported across JDK installations. You must
* ensure you have a JCA Provider that can support this cipher operation mode.
* &lt;a href=&quot;http://www.bouncycastle.org&quot;&gt;Bouncy Castle&lt;/a&gt; &lt;em&gt;may&lt;/em&gt; be one such provider.
*/
<span class="fc" id="L108"> GCM,</span>
/**
* No mode.
* &lt;p/&gt;
* This is a standard JDK operation mode and should be supported by all JDK environments.
*/
<span class="fc" id="L115"> NONE,</span>
/**
* &lt;a href=&quot;http://en.wikipedia.org/wiki/OCB_mode&quot;&gt;Offset Codebook&lt;/a&gt; mode&lt;b&gt;*&lt;/b&gt;. Parallel mode that provides
* both message privacy and authenticity in a single pass. This is a very efficient mode, but is patent-encumbered.
* A less-efficient (two pass) alternative is available by using {@link #EAX EAX} mode.
* &lt;p/&gt;
* &lt;b&gt;*THIS IS A NON-STANDARD MODE&lt;/b&gt;. It is not guaranteed to be supported across JDK installations. You must
* ensure you have a JCA Provider that can support this cipher operation mode.
* &lt;a href=&quot;http://www.bouncycastle.org&quot;&gt;Bouncy Castle&lt;/a&gt; &lt;em&gt;may&lt;/em&gt; be one such provider.
*/
<span class="fc" id="L126"> OCB,</span>
/**
* &lt;a href=&quot;http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Output_feedback_.28OFB.29&quot;&gt;Output
* Feedback&lt;/a&gt; mode, defined in &lt;a href=&quot;http://csrc.nist.gov/publications/fips/index.html&quot;&gt;FIPS PUB 81&lt;/a&gt;.
* &lt;p/&gt;
* This is a standard JDK operation mode and should be supported by all JDK environments.
*/
<span class="fc" id="L134"> OFB,</span>
/**
* &lt;a href=&quot;http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Propagating_cipher-block_chaining_.28PCBC.29&quot;&gt;
* Propagating Cipher Block Chaining&lt;/a&gt; mode, defined in &lt;a href=&quot;http://web.mit.edu/kerberos/&quot;&gt;Kerberos version 4&lt;a/&gt;.
* &lt;p/&gt;
* This is a standard JDK operation mode and should be supported by all JDK environments.
*/
<span class="fc" id="L142"> PCBC</span>
}
</pre><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.8.3.201901230119</span></div></body></html>