| <!DOCTYPE HTML> |
| <!-- NewPage --> |
| <html lang="en"> |
| <head> |
| <!-- Generated by javadoc --> |
| <title>DefaultBlockCipherService (Apache Shiro 1.12.0 API)</title> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style"> |
| <link rel="stylesheet" type="text/css" href="../../../../jquery/jquery-ui.min.css" title="Style"> |
| <link rel="stylesheet" type="text/css" href="../../../../jquery-ui.overrides.css" title="Style"> |
| <script type="text/javascript" src="../../../../script.js"></script> |
| <script type="text/javascript" src="../../../../jquery/jszip/dist/jszip.min.js"></script> |
| <script type="text/javascript" src="../../../../jquery/jszip-utils/dist/jszip-utils.min.js"></script> |
| <!--[if IE]> |
| <script type="text/javascript" src="../../../../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script> |
| <![endif]--> |
| <script type="text/javascript" src="../../../../jquery/jquery-3.6.0.min.js"></script> |
| <script type="text/javascript" src="../../../../jquery/jquery-ui.min.js"></script> |
| </head> |
| <body> |
| <script type="text/javascript"><!-- |
| try { |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="DefaultBlockCipherService (Apache Shiro 1.12.0 API)"; |
| } |
| } |
| catch(err) { |
| } |
| //--> |
| var data = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10,"i14":10,"i15":10,"i16":10,"i17":10,"i18":10}; |
| var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]}; |
| var altColor = "altColor"; |
| var rowColor = "rowColor"; |
| var tableTab = "tableTab"; |
| var activeTableTab = "activeTableTab"; |
| var pathtoroot = "../../../../"; |
| var useModuleDirectories = true; |
| loadScripts(document, 'script');</script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <header role="banner"> |
| <nav role="navigation"> |
| <div class="fixedNav"><!-- Matomo --> <script> var _paq = window._paq = window._paq || []; /* tracker methods like "setCustomDimension" should be called before "trackPageView" */ /* We explicitly disable cookie tracking to avoid privacy issues */ _paq.push(['disableCookies']); _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); (function() { var u="//matomo.privacy.apache.org/"; _paq.push(['setTrackerUrl', u+'matomo.php']); _paq.push(['setSiteId', '2']); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s); })(); </script> <!-- End Matomo Code --> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="topNav"><a id="navbar.top"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> |
| <a id="navbar.top.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../index.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/DefaultBlockCipherService.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList" id="allclasses_navbar_top"> |
| <li><a href="../../../../allclasses.html">All Classes</a></li> |
| </ul> |
| <ul class="navListSearch"> |
| <li><label for="search">SEARCH:</label> |
| <input type="text" id="search" value="search" disabled="disabled"> |
| <input type="reset" id="reset" value="reset" disabled="disabled"> |
| </li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_top"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li>Field | </li> |
| <li><a href="#constructor.summary">Constr</a> | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li><a href="#constructor.detail">Constr</a> | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a id="skip.navbar.top"> |
| <!-- --> |
| </a></div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| </div> |
| <div class="navPadding"> </div> |
| <script type="text/javascript"><!-- |
| $('.navPadding').css('padding-top', $('.fixedNav').css("height")); |
| //--> |
| </script> |
| </nav> |
| </header> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <main role="main"> |
| <div class="header"> |
| <div class="subTitle"><span class="packageLabelInType">Package</span> <a href="package-summary.html">org.apache.shiro.crypto</a></div> |
| <h2 title="Class DefaultBlockCipherService" class="title">Class DefaultBlockCipherService</h2> |
| </div> |
| <div class="contentContainer"> |
| <ul class="inheritance"> |
| <li><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">java.lang.Object</a></li> |
| <li> |
| <ul class="inheritance"> |
| <li><a href="JcaCipherService.html" title="class in org.apache.shiro.crypto">org.apache.shiro.crypto.JcaCipherService</a></li> |
| <li> |
| <ul class="inheritance"> |
| <li><a href="AbstractSymmetricCipherService.html" title="class in org.apache.shiro.crypto">org.apache.shiro.crypto.AbstractSymmetricCipherService</a></li> |
| <li> |
| <ul class="inheritance"> |
| <li>org.apache.shiro.crypto.DefaultBlockCipherService</li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <dl> |
| <dt>All Implemented Interfaces:</dt> |
| <dd><code><a href="CipherService.html" title="interface in org.apache.shiro.crypto">CipherService</a></code></dd> |
| </dl> |
| <dl> |
| <dt>Direct Known Subclasses:</dt> |
| <dd><code><a href="AesCipherService.html" title="class in org.apache.shiro.crypto">AesCipherService</a></code>, <code><a href="BlowfishCipherService.html" title="class in org.apache.shiro.crypto">BlowfishCipherService</a></code></dd> |
| </dl> |
| <hr> |
| <pre>public class <a href="../../../../src-html/org/apache/shiro/crypto/DefaultBlockCipherService.html#line.133">DefaultBlockCipherService</a> |
| extends <a href="AbstractSymmetricCipherService.html" title="class in org.apache.shiro.crypto">AbstractSymmetricCipherService</a></pre> |
| <div class="block">Base abstract class for block cipher algorithms. |
| |
| <h2>Usage</h2> |
| Note that this class exists mostly to simplify algorithm-specific subclasses. Unless you understand the concepts of |
| cipher modes of operation, block sizes, and padding schemes, and you want direct control of these things, you should |
| typically not uses instances of this class directly. Instead, algorithm-specific subclasses, such as |
| <a href="AesCipherService.html" title="class in org.apache.shiro.crypto"><code>AesCipherService</code></a>, <a href="BlowfishCipherService.html" title="class in org.apache.shiro.crypto"><code>BlowfishCipherService</code></a>, and others are usually better suited for regular use. |
| <p/> |
| However, if you have the need to create a custom block cipher service where no sufficient algorithm-specific subclass |
| exists in Shiro, this class would be very useful. |
| |
| <h2>Configuration</h2> |
| Block ciphers can accept configuration parameters that direct how they operate. These parameters concatenated |
| together in a single String comprise what the JDK JCA documentation calls a |
| <a href="http://java.sun.com/javase/6/docs/technotes/guides/security/crypto/CryptoSpec.html#trans">transformation |
| string</a>. We think that it is better for Shiro to construct this transformation string automatically based on its |
| constituent parts instead of having the end-user construct the string manually, which may be error prone or |
| confusing. To that end, Shiro <a href="DefaultBlockCipherService.html" title="class in org.apache.shiro.crypto"><code>DefaultBlockCipherService</code></a>s have attributes that can be set individually in |
| a type-safe manner based on your configuration needs, and Shiro will build the transformation string for you. |
| <p/> |
| The following sections typically document the configuration options for block (byte array) |
| <a href="JcaCipherService.html#encrypt(byte%5B%5D,byte%5B%5D)"><code>JcaCipherService.encrypt(byte[], byte[])</code></a> and <a href="JcaCipherService.html#decrypt(byte%5B%5D,byte%5B%5D)"><code>JcaCipherService.decrypt(byte[], byte[])</code></a> method invocations. Streaming configuration |
| for those same attributes are done via mirrored <code>streaming</code>* attributes, and their purpose is identical, but |
| they're only used during streaming <a href="JcaCipherService.html#encrypt(java.io.InputStream,java.io.OutputStream,byte%5B%5D)"><code>JcaCipherService.encrypt(java.io.InputStream, java.io.OutputStream, byte[])</code></a> and |
| <a href="JcaCipherService.html#decrypt(java.io.InputStream,java.io.OutputStream,byte%5B%5D)"><code>JcaCipherService.decrypt(java.io.InputStream, java.io.OutputStream, byte[])</code></a> methods. See the "Streaming" |
| section below for more. |
| |
| <h3>Block Size</h3> |
| The block size specifies the number of bits (not bytes) that the cipher operates on when performing an operation. |
| It can be specified explicitly via the <a href="#setBlockSize(int)"><code>blockSize</code></a> attribute. If not set, the JCA Provider |
| default will be used based on the cipher algorithm. Block sizes are usually very algorithm specific, so set this |
| value only if you know you don't want the JCA Provider's default for the desired algorithm. For example, the |
| AES algorithm's Rijndael implementation <em>only</em> supports a 128 bit block size and will not work with any other |
| size. |
| <p/> |
| Also note that the <a href="JcaCipherService.html#setInitializationVectorSize(int)"><code>initializationVectorSize</code></a> is usually the same as the |
| <a href="#setBlockSize(int)"><code>blockSize</code></a> in block ciphers. If you change either attribute, you should ensure that the other |
| attribute is correct for the target cipher algorithm. |
| |
| <h3>Operation Mode</h3> |
| You may set the block cipher's<a href="http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation">mode of |
| operation</a> via the <a href="#setMode(org.apache.shiro.crypto.OperationMode)"><code>mode</code></a> attribute, which accepts a type-safe |
| <a href="OperationMode.html" title="enum in org.apache.shiro.crypto"><code>OperationMode</code></a> enum instance. This type safety helps avoid typos when specifying the mode and |
| guarantees that the mode name will be recognized by the underlying JCA Provider. |
| <p/> |
| <b>*</b>If no operation mode is specified, Shiro defaults all of its block <code>CipherService</code> instances to the |
| <a href="OperationMode.html#CBC"><code>CBC</code></a> mode, specifically to support auto-generation of initialization vectors during |
| encryption. This is different than the JDK's default <a href="OperationMode.html#ECB"><code>ECB</code></a> mode because <code>ECB</code> does |
| not support initialization vectors, which are necessary for strong encryption. See the |
| <a href="JcaCipherService.html" title="class in org.apache.shiro.crypto"><code>JcaCipherService parent class</code></a> class JavaDoc for an extensive |
| explanation on why we do this and why we do not use the Sun <code>ECB</code> default. You also might also want read |
| the <a href="http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Electronic_codebook_.28ECB.29">Wikipedia |
| section on ECB<a/> and look at the encrypted image to see an example of why <code>ECB</code> should not be used in |
| security-sensitive environments. |
| <p/> |
| In the rare case that you need to override the default with a mode not represented |
| by the <a href="OperationMode.html" title="enum in org.apache.shiro.crypto"><code>OperationMode</code></a> enum, you may specify the raw mode name string that will be recognized by your JCA |
| provider via the <a href="#setModeName(java.lang.String)"><code>modeName</code></a> attribute. Because this is not type-safe, it is recommended only to |
| use this attribute if the <a href="OperationMode.html" title="enum in org.apache.shiro.crypto"><code>OperationMode</code></a> enum does not represent your desired mode. |
| <p/> |
| <b>NOTE:</b> If you change the mode to one that does not support initialization vectors (such as |
| <a href="OperationMode.html#ECB"><code>ECB</code></a> or <a href="OperationMode.html#NONE"><code>NONE</code></a>), you <em>must</em> turn off auto-generated |
| initialization vectors by setting <a href="JcaCipherService.html#setGenerateInitializationVectors(boolean)"><code>generateInitializationVectors</code></a> |
| to <code>false</code>. Abandoning initialization vectors significantly weakens encryption, so think twice before |
| disabling this feature. |
| |
| <h3>Padding Scheme</h3> |
| Because block ciphers process messages in fixed-length blocks, if the final block in a message is not equal to the |
| block length, <a href="http://en.wikipedia.org/wiki/Padding_(cryptography)">padding</a> is applied to match that |
| size to maintain the total length of the message. This is good because it protects data patterns from being |
| identified - when all chunks look the same length, it is much harder to infer what that data might be. |
| <p/> |
| You may set a padding scheme via the <a href="#setPaddingScheme(org.apache.shiro.crypto.PaddingScheme)"><code>paddingScheme</code></a> attribute, which |
| accepts a type-safe <a href="PaddingScheme.html" title="enum in org.apache.shiro.crypto"><code>PaddingScheme</code></a> enum instance. Like the <a href="OperationMode.html" title="enum in org.apache.shiro.crypto"><code>OperationMode</code></a> enum, |
| this enum offers type safety to help avoid typos and guarantees that the mode will be recongized by the underlying |
| JCA provider. |
| <p/> |
| <b>*</b>If no padding scheme is specified, this class defaults to the <a href="PaddingScheme.html#PKCS5"><code>PaddingScheme.PKCS5</code></a> scheme, specifically |
| to be compliant with the default behavior of auto-generating initialization vectors during encryption (see the |
| <a href="JcaCipherService.html" title="class in org.apache.shiro.crypto"><code>JcaCipherService parent class</code></a> class JavaDoc for why). |
| <p/> |
| In the rare case that you need to override the default with a scheme not represented by the <a href="PaddingScheme.html" title="enum in org.apache.shiro.crypto"><code>PaddingScheme</code></a> |
| enum, you may specify the raw padding scheme name string that will be recognized by your JCA provider via the |
| <a href="#setPaddingScheme(org.apache.shiro.crypto.PaddingScheme)"><code>paddingSchemeName</code></a> attribute. Because this is not type-safe, it is recommended only to |
| use this attribute if the <a href="PaddingScheme.html" title="enum in org.apache.shiro.crypto"><code>PaddingScheme</code></a> enum does not represent your desired scheme. |
| |
| <h2>Streaming</h2> |
| Most people don't think of using block ciphers as stream ciphers, since their name implies working |
| with block data (i.e. byte arrays) only. However, block ciphers can be turned into byte-oriented stream ciphers by |
| using an appropriate <a href="OperationMode.html" title="enum in org.apache.shiro.crypto"><code>operation mode</code></a> with a <a href="#getStreamingBlockSize()"><code>streaming block size</code></a> |
| of 8 bits. This is why the <a href="CipherService.html" title="interface in org.apache.shiro.crypto"><code>CipherService</code></a> interface provides both block and streaming operations. |
| <p/> |
| Because this streaming 8-bit block size rarely changes across block-cipher algorithms, default values have been set |
| for all three streaming configuration parameters. The defaults are: |
| <ul> |
| <li><a href="#setStreamingBlockSize(int)"><code>streamingBlockSize</code></a> = <code>8</code> (bits)</li> |
| <li><a href="#setStreamingMode(org.apache.shiro.crypto.OperationMode)"><code>streamingMode</code></a> = <a href="OperationMode.html#CBC"><code>CBC</code></a></li> |
| <li><a href="#setStreamingPaddingScheme(org.apache.shiro.crypto.PaddingScheme)"><code>streamingPaddingScheme</code></a> = <a href="PaddingScheme.html#PKCS5"><code>PKCS5</code></a></li> |
| </ul> |
| <p/> |
| These attributes have the same meaning as the <code>mode</code>, <code>blockSize</code>, and <code>paddingScheme</code> attributes |
| described above, but they are applied during streaming method invocations only (<a href="JcaCipherService.html#encrypt(java.io.InputStream,java.io.OutputStream,byte%5B%5D)"><code>JcaCipherService.encrypt(java.io.InputStream, java.io.OutputStream, byte[])</code></a> |
| and <a href="JcaCipherService.html#decrypt(java.io.InputStream,java.io.OutputStream,byte%5B%5D)"><code>JcaCipherService.decrypt(java.io.InputStream, java.io.OutputStream, byte[])</code></a>).</div> |
| <dl> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>1.0</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="BlowfishCipherService.html" title="class in org.apache.shiro.crypto"><code>BlowfishCipherService</code></a>, |
| <a href="AesCipherService.html" title="class in org.apache.shiro.crypto"><code>AesCipherService</code></a>, |
| <a href="http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation">Wikipedia: Block Cipher Modes of Operation</a></dd> |
| </dl> |
| </li> |
| </ul> |
| </div> |
| <div class="summary"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ======== CONSTRUCTOR SUMMARY ======== --> |
| <section> |
| <ul class="blockList"> |
| <li class="blockList"><a id="constructor.summary"> |
| <!-- --> |
| </a> |
| <h3>Constructor Summary</h3> |
| <table class="memberSummary"> |
| <caption><span>Constructors</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Constructor</th> |
| <th class="colLast" scope="col">Description</th> |
| </tr> |
| <tr class="altColor"> |
| <th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E(java.lang.String)">DefaultBlockCipherService</a></span>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> algorithmName)</code></th> |
| <td class="colLast"> |
| <div class="block">Creates a new <a href="DefaultBlockCipherService.html" title="class in org.apache.shiro.crypto"><code>DefaultBlockCipherService</code></a> using the specified block cipher <code>algorithmName</code>.</div> |
| </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| </section> |
| <!-- ========== METHOD SUMMARY =========== --> |
| <section> |
| <ul class="blockList"> |
| <li class="blockList"><a id="method.summary"> |
| <!-- --> |
| </a> |
| <h3>Method Summary</h3> |
| <table class="memberSummary"> |
| <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colSecond" scope="col">Method</th> |
| <th class="colLast" scope="col">Description</th> |
| </tr> |
| <tr id="i0" class="altColor"> |
| <td class="colFirst"><code>protected byte[]</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#generateInitializationVector(boolean)">generateInitializationVector</a></span>​(boolean streaming)</code></th> |
| <td class="colLast"> </td> |
| </tr> |
| <tr id="i1" class="rowColor"> |
| <td class="colFirst"><code>int</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getBlockSize()">getBlockSize</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Returns the block cipher's block size to be used when constructing |
| <a href="https://docs.oracle.com/javase/8/docs/api/javax/crypto/Cipher.html?is-external=true" title="class or interface in javax.crypto" class="externalLink"><code>Cipher</code></a> transformation string or <code>0</code> if the JCA Provider default block size |
| for the specified <a href="JcaCipherService.html#getAlgorithmName()"><code>algorithm</code></a> should be used.</div> |
| </td> |
| </tr> |
| <tr id="i2" class="altColor"> |
| <td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getModeName()">getModeName</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Returns the cipher operation mode name (as a String) to be used when constructing |
| <a href="https://docs.oracle.com/javase/8/docs/api/javax/crypto/Cipher.html?is-external=true" title="class or interface in javax.crypto" class="externalLink"><code>Cipher</code></a> transformation string or <code>null</code> if the JCA Provider default mode for |
| the specified <a href="JcaCipherService.html#getAlgorithmName()"><code>algorithm</code></a> should be used.</div> |
| </td> |
| </tr> |
| <tr id="i3" class="rowColor"> |
| <td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getPaddingSchemeName()">getPaddingSchemeName</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Returns the cipher algorithm padding scheme name (as a String) to be used when constructing |
| <a href="https://docs.oracle.com/javase/8/docs/api/javax/crypto/Cipher.html?is-external=true" title="class or interface in javax.crypto" class="externalLink"><code>Cipher</code></a> transformation string or <code>null</code> if the JCA Provider default mode for |
| the specified <a href="JcaCipherService.html#getAlgorithmName()"><code>algorithm</code></a> should be used.</div> |
| </td> |
| </tr> |
| <tr id="i4" class="altColor"> |
| <td class="colFirst"><code>int</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getStreamingBlockSize()">getStreamingBlockSize</a></span>()</code></th> |
| <td class="colLast"> </td> |
| </tr> |
| <tr id="i5" class="rowColor"> |
| <td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getStreamingModeName()">getStreamingModeName</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Same purpose as the <a href="#getModeName()"><code>modeName</code></a> attribute, but is used instead only for for streaming |
| operations (<a href="JcaCipherService.html#encrypt(java.io.InputStream,java.io.OutputStream,byte%5B%5D)"><code>JcaCipherService.encrypt(java.io.InputStream, java.io.OutputStream, byte[])</code></a> and |
| <a href="JcaCipherService.html#decrypt(java.io.InputStream,java.io.OutputStream,byte%5B%5D)"><code>JcaCipherService.decrypt(java.io.InputStream, java.io.OutputStream, byte[])</code></a>).</div> |
| </td> |
| </tr> |
| <tr id="i6" class="altColor"> |
| <td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getStreamingPaddingSchemeName()">getStreamingPaddingSchemeName</a></span>()</code></th> |
| <td class="colLast"> </td> |
| </tr> |
| <tr id="i7" class="rowColor"> |
| <td class="colFirst"><code>protected <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getTransformationString(boolean)">getTransformationString</a></span>​(boolean streaming)</code></th> |
| <td class="colLast"> |
| <div class="block">Returns the transformation string to use with the <a href="https://docs.oracle.com/javase/8/docs/api/javax/crypto/Cipher.html?is-external=true#getInstance(java.lang.String)" title="class or interface in javax.crypto" class="externalLink"><code>Cipher.getInstance(java.lang.String)</code></a> call.</div> |
| </td> |
| </tr> |
| <tr id="i8" class="altColor"> |
| <td class="colFirst"><code>protected boolean</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isGenerateInitializationVectors(boolean)">isGenerateInitializationVectors</a></span>​(boolean streaming)</code></th> |
| <td class="colLast"> |
| <div class="block">Overrides the parent implementation to ensure initialization vectors are always generated if streaming is |
| enabled (block ciphers <em>must</em> use initialization vectors if they are to be used as a stream cipher).</div> |
| </td> |
| </tr> |
| <tr id="i9" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setBlockSize(int)">setBlockSize</a></span>​(int blockSize)</code></th> |
| <td class="colLast"> |
| <div class="block">Sets the block cipher's block size to be used when constructing |
| <a href="https://docs.oracle.com/javase/8/docs/api/javax/crypto/Cipher.html?is-external=true" title="class or interface in javax.crypto" class="externalLink"><code>Cipher</code></a> transformation string.</div> |
| </td> |
| </tr> |
| <tr id="i10" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setMode(org.apache.shiro.crypto.OperationMode)">setMode</a></span>​(<a href="OperationMode.html" title="enum in org.apache.shiro.crypto">OperationMode</a> mode)</code></th> |
| <td class="colLast"> |
| <div class="block">Sets the cipher operation mode of operation to be used when constructing the |
| <a href="https://docs.oracle.com/javase/8/docs/api/javax/crypto/Cipher.html?is-external=true" title="class or interface in javax.crypto" class="externalLink"><code>Cipher</code></a> transformation string.</div> |
| </td> |
| </tr> |
| <tr id="i11" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setModeName(java.lang.String)">setModeName</a></span>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> modeName)</code></th> |
| <td class="colLast"> |
| <div class="block">Sets the cipher operation mode name to be used when constructing the |
| <a href="https://docs.oracle.com/javase/8/docs/api/javax/crypto/Cipher.html?is-external=true" title="class or interface in javax.crypto" class="externalLink"><code>Cipher</code></a> transformation string.</div> |
| </td> |
| </tr> |
| <tr id="i12" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setPaddingScheme(org.apache.shiro.crypto.PaddingScheme)">setPaddingScheme</a></span>​(<a href="PaddingScheme.html" title="enum in org.apache.shiro.crypto">PaddingScheme</a> paddingScheme)</code></th> |
| <td class="colLast"> |
| <div class="block">Sets the padding scheme to be used when constructing the |
| <a href="https://docs.oracle.com/javase/8/docs/api/javax/crypto/Cipher.html?is-external=true" title="class or interface in javax.crypto" class="externalLink"><code>Cipher</code></a> transformation string.</div> |
| </td> |
| </tr> |
| <tr id="i13" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setPaddingSchemeName(java.lang.String)">setPaddingSchemeName</a></span>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> paddingSchemeName)</code></th> |
| <td class="colLast"> |
| <div class="block">Sets the padding scheme name to be used when constructing the |
| <a href="https://docs.oracle.com/javase/8/docs/api/javax/crypto/Cipher.html?is-external=true" title="class or interface in javax.crypto" class="externalLink"><code>Cipher</code></a> transformation string, or <code>null</code> if the JCA Provider default mode for |
| the specified <a href="JcaCipherService.html#getAlgorithmName()"><code>algorithm</code></a> should be used.</div> |
| </td> |
| </tr> |
| <tr id="i14" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setStreamingBlockSize(int)">setStreamingBlockSize</a></span>​(int streamingBlockSize)</code></th> |
| <td class="colLast"> </td> |
| </tr> |
| <tr id="i15" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setStreamingMode(org.apache.shiro.crypto.OperationMode)">setStreamingMode</a></span>​(<a href="OperationMode.html" title="enum in org.apache.shiro.crypto">OperationMode</a> mode)</code></th> |
| <td class="colLast"> |
| <div class="block">Sets the transformation string mode to be used for streaming operations only.</div> |
| </td> |
| </tr> |
| <tr id="i16" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setStreamingModeName(java.lang.String)">setStreamingModeName</a></span>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> streamingModeName)</code></th> |
| <td class="colLast"> |
| <div class="block">Sets the transformation string mode name to be used for streaming operations only.</div> |
| </td> |
| </tr> |
| <tr id="i17" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setStreamingPaddingScheme(org.apache.shiro.crypto.PaddingScheme)">setStreamingPaddingScheme</a></span>​(<a href="PaddingScheme.html" title="enum in org.apache.shiro.crypto">PaddingScheme</a> scheme)</code></th> |
| <td class="colLast"> </td> |
| </tr> |
| <tr id="i18" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setStreamingPaddingSchemeName(java.lang.String)">setStreamingPaddingSchemeName</a></span>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> streamingPaddingSchemeName)</code></th> |
| <td class="colLast"> </td> |
| </tr> |
| </table> |
| <ul class="blockList"> |
| <li class="blockList"><a id="methods.inherited.from.class.org.apache.shiro.crypto.AbstractSymmetricCipherService"> |
| <!-- --> |
| </a> |
| <h3>Methods inherited from class org.apache.shiro.crypto.<a href="AbstractSymmetricCipherService.html" title="class in org.apache.shiro.crypto">AbstractSymmetricCipherService</a></h3> |
| <code><a href="AbstractSymmetricCipherService.html#generateNewKey()">generateNewKey</a>, <a href="AbstractSymmetricCipherService.html#generateNewKey(int)">generateNewKey</a></code></li> |
| </ul> |
| <ul class="blockList"> |
| <li class="blockList"><a id="methods.inherited.from.class.org.apache.shiro.crypto.JcaCipherService"> |
| <!-- --> |
| </a> |
| <h3>Methods inherited from class org.apache.shiro.crypto.<a href="JcaCipherService.html" title="class in org.apache.shiro.crypto">JcaCipherService</a></h3> |
| <code><a href="JcaCipherService.html#createParameterSpec(byte%5B%5D,boolean)">createParameterSpec</a>, <a href="JcaCipherService.html#decrypt(byte%5B%5D,byte%5B%5D)">decrypt</a>, <a href="JcaCipherService.html#decrypt(java.io.InputStream,java.io.OutputStream,byte%5B%5D)">decrypt</a>, <a href="JcaCipherService.html#encrypt(byte%5B%5D,byte%5B%5D)">encrypt</a>, <a href="JcaCipherService.html#encrypt(java.io.InputStream,java.io.OutputStream,byte%5B%5D)">encrypt</a>, <a href="JcaCipherService.html#ensureSecureRandom()">ensureSecureRandom</a>, <a href="JcaCipherService.html#getAlgorithmName()">getAlgorithmName</a>, <a href="JcaCipherService.html#getDefaultSecureRandom()">getDefaultSecureRandom</a>, <a href="JcaCipherService.html#getInitializationVectorSize()">getInitializationVectorSize</a>, <a href="JcaCipherService.html#getKeySize()">getKeySize</a>, <a href="JcaCipherService.html#getSecureRandom()">getSecureRandom</a>, <a href="JcaCipherService.html#getStreamingBufferSize()">getStreamingBufferSize</a>, <a href="JcaCipherService.html#isGenerateInitializationVectors()">isGenerateInitializationVectors</a>, <a href="JcaCipherService.html#setGenerateInitializationVectors(boolean)">setGenerateInitializationVectors</a>, <a href="JcaCipherService.html#setInitializationVectorSize(int)">setInitializationVectorSize</a>, <a href="JcaCipherService.html#setKeySize(int)">setKeySize</a>, <a href="JcaCipherService.html#setSecureRandom(java.security.SecureRandom)">setSecureRandom</a>, <a href="JcaCipherService.html#setStreamingBufferSize(int)">setStreamingBufferSize</a></code></li> |
| </ul> |
| <ul class="blockList"> |
| <li class="blockList"><a id="methods.inherited.from.class.java.lang.Object"> |
| <!-- --> |
| </a> |
| <h3>Methods inherited from class java.lang.<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a></h3> |
| <code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang" class="externalLink">clone</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang" class="externalLink">equals</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang" class="externalLink">finalize</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang" class="externalLink">getClass</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang" class="externalLink">hashCode</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang" class="externalLink">notify</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang" class="externalLink">notifyAll</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang" class="externalLink">toString</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang" class="externalLink">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang" class="externalLink">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait(long,int)" title="class or interface in java.lang" class="externalLink">wait</a></code></li> |
| </ul> |
| </li> |
| </ul> |
| </section> |
| </li> |
| </ul> |
| </div> |
| <div class="details"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ========= CONSTRUCTOR DETAIL ======== --> |
| <section> |
| <ul class="blockList"> |
| <li class="blockList"><a id="constructor.detail"> |
| <!-- --> |
| </a> |
| <h3>Constructor Detail</h3> |
| <a id="<init>(java.lang.String)"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>DefaultBlockCipherService</h4> |
| <pre>public <a href="../../../../src-html/org/apache/shiro/crypto/DefaultBlockCipherService.html#line.164">DefaultBlockCipherService</a>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> algorithmName)</pre> |
| <div class="block">Creates a new <a href="DefaultBlockCipherService.html" title="class in org.apache.shiro.crypto"><code>DefaultBlockCipherService</code></a> using the specified block cipher <code>algorithmName</code>. Per this |
| class's JavaDoc, this constructor also sets the following defaults: |
| <ul> |
| <li><code>streamingMode</code> = <a href="OperationMode.html#CBC"><code>CBC</code></a></li> |
| <li><code>streamingPaddingScheme</code> = <a href="PaddingScheme.html#NONE"><code>none</code></a></li> |
| <li><code>streamingBlockSize</code> = 8</li> |
| </ul> |
| All other attributes are null/unset, indicating the JCA Provider defaults will be used.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>algorithmName</code> - the block cipher algorithm to use when encrypting and decrypting</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </section> |
| <!-- ============ METHOD DETAIL ========== --> |
| <section> |
| <ul class="blockList"> |
| <li class="blockList"><a id="method.detail"> |
| <!-- --> |
| </a> |
| <h3>Method Detail</h3> |
| <a id="getModeName()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getModeName</h4> |
| <pre class="methodSignature">public <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> <a href="../../../../src-html/org/apache/shiro/crypto/DefaultBlockCipherService.html#line.192">getModeName</a>()</pre> |
| <div class="block">Returns the cipher operation mode name (as a String) to be used when constructing |
| <a href="https://docs.oracle.com/javase/8/docs/api/javax/crypto/Cipher.html?is-external=true" title="class or interface in javax.crypto" class="externalLink"><code>Cipher</code></a> transformation string or <code>null</code> if the JCA Provider default mode for |
| the specified <a href="JcaCipherService.html#getAlgorithmName()"><code>algorithm</code></a> should be used. |
| <p/> |
| This attribute is used <em>only</em> when constructing the transformation string for block (byte array) |
| operations (<a href="JcaCipherService.html#encrypt(byte%5B%5D,byte%5B%5D)"><code>JcaCipherService.encrypt(byte[], byte[])</code></a> and <a href="JcaCipherService.html#decrypt(byte%5B%5D,byte%5B%5D)"><code>JcaCipherService.decrypt(byte[], byte[])</code></a>). The |
| <a href="#getStreamingModeName()"><code>streamingModeName</code></a> attribute is used when the block cipher is used for |
| streaming operations. |
| <p/> |
| The default value is <code>null</code> to retain the JCA Provider default.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the cipher operation mode name (as a String) to be used when constructing the |
| <a href="https://docs.oracle.com/javase/8/docs/api/javax/crypto/Cipher.html?is-external=true" title="class or interface in javax.crypto" class="externalLink"><code>Cipher</code></a> transformation string, or <code>null</code> if the JCA Provider default |
| mode for the specified <a href="JcaCipherService.html#getAlgorithmName()"><code>algorithm</code></a> should be used.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="setModeName(java.lang.String)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setModeName</h4> |
| <pre class="methodSignature">public void <a href="../../../../src-html/org/apache/shiro/crypto/DefaultBlockCipherService.html#line.218">setModeName</a>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> modeName)</pre> |
| <div class="block">Sets the cipher operation mode name to be used when constructing the |
| <a href="https://docs.oracle.com/javase/8/docs/api/javax/crypto/Cipher.html?is-external=true" title="class or interface in javax.crypto" class="externalLink"><code>Cipher</code></a> transformation string. A <code>null</code> value indicates that the JCA Provider |
| default mode for the specified <a href="JcaCipherService.html#getAlgorithmName()"><code>algorithm</code></a> should be used. |
| <p/> |
| This attribute is used <em>only</em> when constructing the transformation string for block (byte array) |
| operations (<a href="JcaCipherService.html#encrypt(byte%5B%5D,byte%5B%5D)"><code>JcaCipherService.encrypt(byte[], byte[])</code></a> and <a href="JcaCipherService.html#decrypt(byte%5B%5D,byte%5B%5D)"><code>JcaCipherService.decrypt(byte[], byte[])</code></a>). The |
| <a href="#getStreamingModeName()"><code>streamingModeName</code></a> attribute is used when the block cipher is used for |
| streaming operations. |
| <p/> |
| The default value is <code>null</code> to retain the JCA Provider default. |
| <p/> |
| <b>NOTE:</b> most standard mode names are represented by the <a href="OperationMode.html" title="enum in org.apache.shiro.crypto"><code>OperationMode</code></a> enum. That enum |
| should be used with the <a href="#setMode(org.apache.shiro.crypto.OperationMode)"><code>mode</code></a> attribute when possible to retain type-safety and reduce the |
| possibility of errors. This method is better used if the <a href="OperationMode.html" title="enum in org.apache.shiro.crypto"><code>OperationMode</code></a> enum does not represent the |
| necessary mode.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>modeName</code> - the cipher operation mode name to be used when constructing |
| <a href="https://docs.oracle.com/javase/8/docs/api/javax/crypto/Cipher.html?is-external=true" title="class or interface in javax.crypto" class="externalLink"><code>Cipher</code></a> transformation string, or <code>null</code> if the JCA Provider |
| default mode for the specified <a href="JcaCipherService.html#getAlgorithmName()"><code>algorithm</code></a> should be used.</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="#setMode(org.apache.shiro.crypto.OperationMode)"><code>setMode(org.apache.shiro.crypto.OperationMode)</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="setMode(org.apache.shiro.crypto.OperationMode)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setMode</h4> |
| <pre class="methodSignature">public void <a href="../../../../src-html/org/apache/shiro/crypto/DefaultBlockCipherService.html#line.242">setMode</a>​(<a href="OperationMode.html" title="enum in org.apache.shiro.crypto">OperationMode</a> mode)</pre> |
| <div class="block">Sets the cipher operation mode of operation to be used when constructing the |
| <a href="https://docs.oracle.com/javase/8/docs/api/javax/crypto/Cipher.html?is-external=true" title="class or interface in javax.crypto" class="externalLink"><code>Cipher</code></a> transformation string. A <code>null</code> value indicates that the JCA Provider |
| default mode for the specified <a href="JcaCipherService.html#getAlgorithmName()"><code>algorithm</code></a> should be used. |
| <p/> |
| This attribute is used <em>only</em> when constructing the transformation string for block (byte array) |
| operations (<a href="JcaCipherService.html#encrypt(byte%5B%5D,byte%5B%5D)"><code>JcaCipherService.encrypt(byte[], byte[])</code></a> and <a href="JcaCipherService.html#decrypt(byte%5B%5D,byte%5B%5D)"><code>JcaCipherService.decrypt(byte[], byte[])</code></a>). The |
| <a href="#setStreamingMode(org.apache.shiro.crypto.OperationMode)"><code>streamingMode</code></a> attribute is used when the block cipher is used for |
| streaming operations. |
| <p/> |
| If the <a href="OperationMode.html" title="enum in org.apache.shiro.crypto"><code>OperationMode</code></a> enum cannot represent your desired mode, you can set the name explicitly |
| via the <a href="#setModeName(java.lang.String)"><code>modeName</code></a> attribute directly. However, because <a href="OperationMode.html" title="enum in org.apache.shiro.crypto"><code>OperationMode</code></a> represents all |
| standard JDK mode names already, ensure that your underlying JCA Provider supports the non-standard name first.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>mode</code> - the cipher operation mode to be used when constructing |
| <a href="https://docs.oracle.com/javase/8/docs/api/javax/crypto/Cipher.html?is-external=true" title="class or interface in javax.crypto" class="externalLink"><code>Cipher</code></a> transformation string, or <code>null</code> if the JCA Provider |
| default mode for the specified <a href="JcaCipherService.html#getAlgorithmName()"><code>algorithm</code></a> should be used.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="getPaddingSchemeName()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getPaddingSchemeName</h4> |
| <pre class="methodSignature">public <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> <a href="../../../../src-html/org/apache/shiro/crypto/DefaultBlockCipherService.html#line.262">getPaddingSchemeName</a>()</pre> |
| <div class="block">Returns the cipher algorithm padding scheme name (as a String) to be used when constructing |
| <a href="https://docs.oracle.com/javase/8/docs/api/javax/crypto/Cipher.html?is-external=true" title="class or interface in javax.crypto" class="externalLink"><code>Cipher</code></a> transformation string or <code>null</code> if the JCA Provider default mode for |
| the specified <a href="JcaCipherService.html#getAlgorithmName()"><code>algorithm</code></a> should be used. |
| <p/> |
| This attribute is used <em>only</em> when constructing the transformation string for block (byte array) |
| operations (<a href="JcaCipherService.html#encrypt(byte%5B%5D,byte%5B%5D)"><code>JcaCipherService.encrypt(byte[], byte[])</code></a> and <a href="JcaCipherService.html#decrypt(byte%5B%5D,byte%5B%5D)"><code>JcaCipherService.decrypt(byte[], byte[])</code></a>). The |
| <a href="#getStreamingPaddingSchemeName()"><code>streamingPaddingSchemeName</code></a> attribute is used when the block cipher is |
| used for streaming operations. |
| <p/> |
| The default value is <code>null</code> to retain the JCA Provider default.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the padding scheme name (as a String) to be used when constructing the |
| <a href="https://docs.oracle.com/javase/8/docs/api/javax/crypto/Cipher.html?is-external=true" title="class or interface in javax.crypto" class="externalLink"><code>Cipher</code></a> transformation string, or <code>null</code> if the JCA Provider default |
| padding scheme for the specified <a href="JcaCipherService.html#getAlgorithmName()"><code>algorithm</code></a> should be used.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="setPaddingSchemeName(java.lang.String)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setPaddingSchemeName</h4> |
| <pre class="methodSignature">public void <a href="../../../../src-html/org/apache/shiro/crypto/DefaultBlockCipherService.html#line.289">setPaddingSchemeName</a>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> paddingSchemeName)</pre> |
| <div class="block">Sets the padding scheme name to be used when constructing the |
| <a href="https://docs.oracle.com/javase/8/docs/api/javax/crypto/Cipher.html?is-external=true" title="class or interface in javax.crypto" class="externalLink"><code>Cipher</code></a> transformation string, or <code>null</code> if the JCA Provider default mode for |
| the specified <a href="JcaCipherService.html#getAlgorithmName()"><code>algorithm</code></a> should be used. |
| <p/> |
| This attribute is used <em>only</em> when constructing the transformation string for block (byte array) |
| operations (<a href="JcaCipherService.html#encrypt(byte%5B%5D,byte%5B%5D)"><code>JcaCipherService.encrypt(byte[], byte[])</code></a> and <a href="JcaCipherService.html#decrypt(byte%5B%5D,byte%5B%5D)"><code>JcaCipherService.decrypt(byte[], byte[])</code></a>). The |
| <a href="#getStreamingPaddingSchemeName()"><code>streamingPaddingSchemeName</code></a> attribute is used when the block cipher is |
| used for streaming operations. |
| <p/> |
| The default value is <code>null</code> to retain the JCA Provider default. |
| <p/> |
| <b>NOTE:</b> most standard padding schemes are represented by the <a href="PaddingScheme.html" title="enum in org.apache.shiro.crypto"><code>PaddingScheme</code></a> enum. |
| That enum should be used with the <a href="#setPaddingScheme(org.apache.shiro.crypto.PaddingScheme)"><code>paddingScheme</code></a> attribute when possible to retain |
| type-safety and reduce the possibility of errors. Calling this method however is suitable if the |
| <code>PaddingScheme</code> enum does not represent the desired scheme.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>paddingSchemeName</code> - the padding scheme name to be used when constructing |
| <a href="https://docs.oracle.com/javase/8/docs/api/javax/crypto/Cipher.html?is-external=true" title="class or interface in javax.crypto" class="externalLink"><code>Cipher</code></a> transformation string, or <code>null</code> if the JCA |
| Provider default padding scheme for the specified <a href="JcaCipherService.html#getAlgorithmName()"><code>algorithm</code></a> |
| should be used.</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="#setPaddingScheme(org.apache.shiro.crypto.PaddingScheme)"><code>setPaddingScheme(org.apache.shiro.crypto.PaddingScheme)</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="setPaddingScheme(org.apache.shiro.crypto.PaddingScheme)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setPaddingScheme</h4> |
| <pre class="methodSignature">public void <a href="../../../../src-html/org/apache/shiro/crypto/DefaultBlockCipherService.html#line.314">setPaddingScheme</a>​(<a href="PaddingScheme.html" title="enum in org.apache.shiro.crypto">PaddingScheme</a> paddingScheme)</pre> |
| <div class="block">Sets the padding scheme to be used when constructing the |
| <a href="https://docs.oracle.com/javase/8/docs/api/javax/crypto/Cipher.html?is-external=true" title="class or interface in javax.crypto" class="externalLink"><code>Cipher</code></a> transformation string. A <code>null</code> value indicates that the JCA Provider |
| default padding scheme for the specified <a href="JcaCipherService.html#getAlgorithmName()"><code>algorithm</code></a> should be used. |
| <p/> |
| This attribute is used <em>only</em> when constructing the transformation string for block (byte array) |
| operations (<a href="JcaCipherService.html#encrypt(byte%5B%5D,byte%5B%5D)"><code>JcaCipherService.encrypt(byte[], byte[])</code></a> and <a href="JcaCipherService.html#decrypt(byte%5B%5D,byte%5B%5D)"><code>JcaCipherService.decrypt(byte[], byte[])</code></a>). The |
| <a href="#setStreamingPaddingScheme(org.apache.shiro.crypto.PaddingScheme)"><code>streamingPaddingScheme</code></a> attribute is used when the block cipher is used for |
| streaming operations. |
| <p/> |
| If the <a href="PaddingScheme.html" title="enum in org.apache.shiro.crypto"><code>PaddingScheme</code></a> enum does represent your desired scheme, you can set the name explicitly |
| via the <a href="#setPaddingSchemeName(java.lang.String)"><code>paddingSchemeName</code></a> attribute directly. However, because |
| <code>PaddingScheme</code> represents all standard JDK scheme names already, ensure that your underlying JCA Provider |
| supports the non-standard name first.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>paddingScheme</code> - the padding scheme to be used when constructing |
| <a href="https://docs.oracle.com/javase/8/docs/api/javax/crypto/Cipher.html?is-external=true" title="class or interface in javax.crypto" class="externalLink"><code>Cipher</code></a> transformation string, or <code>null</code> if the JCA Provider |
| default padding scheme for the specified <a href="JcaCipherService.html#getAlgorithmName()"><code>algorithm</code></a> should be used.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="getBlockSize()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getBlockSize</h4> |
| <pre class="methodSignature">public int <a href="../../../../src-html/org/apache/shiro/crypto/DefaultBlockCipherService.html#line.334">getBlockSize</a>()</pre> |
| <div class="block">Returns the block cipher's block size to be used when constructing |
| <a href="https://docs.oracle.com/javase/8/docs/api/javax/crypto/Cipher.html?is-external=true" title="class or interface in javax.crypto" class="externalLink"><code>Cipher</code></a> transformation string or <code>0</code> if the JCA Provider default block size |
| for the specified <a href="JcaCipherService.html#getAlgorithmName()"><code>algorithm</code></a> should be used. |
| <p/> |
| This attribute is used <em>only</em> when constructing the transformation string for block (byte array) |
| operations (<a href="JcaCipherService.html#encrypt(byte%5B%5D,byte%5B%5D)"><code>JcaCipherService.encrypt(byte[], byte[])</code></a> and <a href="JcaCipherService.html#decrypt(byte%5B%5D,byte%5B%5D)"><code>JcaCipherService.decrypt(byte[], byte[])</code></a>). The |
| <a href="#getStreamingBlockSize()"><code>streamingBlockSize</code></a> attribute is used when the block cipher is used for |
| streaming operations. |
| <p/> |
| The default value is <code>0</code> which retains the JCA Provider default.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the block cipher block size to be used when constructing the |
| <a href="https://docs.oracle.com/javase/8/docs/api/javax/crypto/Cipher.html?is-external=true" title="class or interface in javax.crypto" class="externalLink"><code>Cipher</code></a> transformation string, or <code>0</code> if the JCA Provider default |
| block size for the specified <a href="JcaCipherService.html#getAlgorithmName()"><code>algorithm</code></a> should be used.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="setBlockSize(int)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setBlockSize</h4> |
| <pre class="methodSignature">public void <a href="../../../../src-html/org/apache/shiro/crypto/DefaultBlockCipherService.html#line.357">setBlockSize</a>​(int blockSize)</pre> |
| <div class="block">Sets the block cipher's block size to be used when constructing |
| <a href="https://docs.oracle.com/javase/8/docs/api/javax/crypto/Cipher.html?is-external=true" title="class or interface in javax.crypto" class="externalLink"><code>Cipher</code></a> transformation string. <code>0</code> indicates that the JCA Provider default |
| block size for the specified <a href="JcaCipherService.html#getAlgorithmName()"><code>algorithm</code></a> should be used. |
| <p/> |
| This attribute is used <em>only</em> when constructing the transformation string for block (byte array) |
| operations (<a href="JcaCipherService.html#encrypt(byte%5B%5D,byte%5B%5D)"><code>JcaCipherService.encrypt(byte[], byte[])</code></a> and <a href="JcaCipherService.html#decrypt(byte%5B%5D,byte%5B%5D)"><code>JcaCipherService.decrypt(byte[], byte[])</code></a>). The |
| <a href="#getStreamingBlockSize()"><code>streamingBlockSize</code></a> attribute is used when the block cipher is used for |
| streaming operations. |
| <p/> |
| The default value is <code>0</code> which retains the JCA Provider default. |
| <p/> |
| <b>NOTE:</b> block cipher block sizes are very algorithm-specific. If you change this value, ensure that it |
| will work with the specified <a href="JcaCipherService.html#getAlgorithmName()"><code>algorithm</code></a>.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>blockSize</code> - the block cipher block size to be used when constructing the |
| <a href="https://docs.oracle.com/javase/8/docs/api/javax/crypto/Cipher.html?is-external=true" title="class or interface in javax.crypto" class="externalLink"><code>Cipher</code></a> transformation string, or <code>0</code> if the JCA Provider |
| default block size for the specified <a href="JcaCipherService.html#getAlgorithmName()"><code>algorithm</code></a> should be used.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="getStreamingModeName()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getStreamingModeName</h4> |
| <pre class="methodSignature">public <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> <a href="../../../../src-html/org/apache/shiro/crypto/DefaultBlockCipherService.html#line.374">getStreamingModeName</a>()</pre> |
| <div class="block">Same purpose as the <a href="#getModeName()"><code>modeName</code></a> attribute, but is used instead only for for streaming |
| operations (<a href="JcaCipherService.html#encrypt(java.io.InputStream,java.io.OutputStream,byte%5B%5D)"><code>JcaCipherService.encrypt(java.io.InputStream, java.io.OutputStream, byte[])</code></a> and |
| <a href="JcaCipherService.html#decrypt(java.io.InputStream,java.io.OutputStream,byte%5B%5D)"><code>JcaCipherService.decrypt(java.io.InputStream, java.io.OutputStream, byte[])</code></a>). |
| <p/> |
| Note that unlike the <a href="#getModeName()"><code>modeName</code></a> attribute, the default value of this attribute is not |
| <code>null</code> - it is <a href="OperationMode.html#CBC"><code>CBC</code></a> for reasons described in the class-level JavaDoc in the |
| <code>Streaming</code> section.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the transformation string mode name to be used for streaming operations only.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="setStreamingModeName(java.lang.String)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setStreamingModeName</h4> |
| <pre class="methodSignature">public void <a href="../../../../src-html/org/apache/shiro/crypto/DefaultBlockCipherService.html#line.390">setStreamingModeName</a>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> streamingModeName)</pre> |
| <div class="block">Sets the transformation string mode name to be used for streaming operations only. The default value is |
| <a href="OperationMode.html#CBC"><code>CBC</code></a> for reasons described in the class-level JavaDoc in the <code>Streaming</code> section.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>streamingModeName</code> - transformation string mode name to be used for streaming operations only</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="setStreamingMode(org.apache.shiro.crypto.OperationMode)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setStreamingMode</h4> |
| <pre class="methodSignature">public void <a href="../../../../src-html/org/apache/shiro/crypto/DefaultBlockCipherService.html#line.406">setStreamingMode</a>​(<a href="OperationMode.html" title="enum in org.apache.shiro.crypto">OperationMode</a> mode)</pre> |
| <div class="block">Sets the transformation string mode to be used for streaming operations only. The default value is |
| <a href="OperationMode.html#CBC"><code>CBC</code></a> for reasons described in the class-level JavaDoc in the <code>Streaming</code> section.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>mode</code> - the transformation string mode to be used for streaming operations only</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="getStreamingPaddingSchemeName()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getStreamingPaddingSchemeName</h4> |
| <pre class="methodSignature">public <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> <a href="../../../../src-html/org/apache/shiro/crypto/DefaultBlockCipherService.html#line.410">getStreamingPaddingSchemeName</a>()</pre> |
| </li> |
| </ul> |
| <a id="setStreamingPaddingSchemeName(java.lang.String)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setStreamingPaddingSchemeName</h4> |
| <pre class="methodSignature">public void <a href="../../../../src-html/org/apache/shiro/crypto/DefaultBlockCipherService.html#line.414">setStreamingPaddingSchemeName</a>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> streamingPaddingSchemeName)</pre> |
| </li> |
| </ul> |
| <a id="setStreamingPaddingScheme(org.apache.shiro.crypto.PaddingScheme)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setStreamingPaddingScheme</h4> |
| <pre class="methodSignature">public void <a href="../../../../src-html/org/apache/shiro/crypto/DefaultBlockCipherService.html#line.420">setStreamingPaddingScheme</a>​(<a href="PaddingScheme.html" title="enum in org.apache.shiro.crypto">PaddingScheme</a> scheme)</pre> |
| </li> |
| </ul> |
| <a id="getStreamingBlockSize()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getStreamingBlockSize</h4> |
| <pre class="methodSignature">public int <a href="../../../../src-html/org/apache/shiro/crypto/DefaultBlockCipherService.html#line.424">getStreamingBlockSize</a>()</pre> |
| </li> |
| </ul> |
| <a id="setStreamingBlockSize(int)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setStreamingBlockSize</h4> |
| <pre class="methodSignature">public void <a href="../../../../src-html/org/apache/shiro/crypto/DefaultBlockCipherService.html#line.428">setStreamingBlockSize</a>​(int streamingBlockSize)</pre> |
| </li> |
| </ul> |
| <a id="getTransformationString(boolean)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getTransformationString</h4> |
| <pre class="methodSignature">protected <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> <a href="../../../../src-html/org/apache/shiro/crypto/DefaultBlockCipherService.html#line.444">getTransformationString</a>​(boolean streaming)</pre> |
| <div class="block">Returns the transformation string to use with the <a href="https://docs.oracle.com/javase/8/docs/api/javax/crypto/Cipher.html?is-external=true#getInstance(java.lang.String)" title="class or interface in javax.crypto" class="externalLink"><code>Cipher.getInstance(java.lang.String)</code></a> call. If |
| <code>streaming</code> is <code>true</code>, a block-cipher transformation string compatible with streaming operations will |
| be constructed and cached for re-use later (see the class-level JavaDoc for more on using block ciphers |
| for streaming). If <code>streaming</code> is <code>false</code> a normal block-cipher transformation string will |
| be constructed and cached for later re-use.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JcaCipherService.html#getTransformationString(boolean)">getTransformationString</a></code> in class <code><a href="JcaCipherService.html" title="class in org.apache.shiro.crypto">JcaCipherService</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>streaming</code> - if the transformation string is going to be used for a Cipher performing stream-based encryption or not.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the transformation string</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="isGenerateInitializationVectors(boolean)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>isGenerateInitializationVectors</h4> |
| <pre class="methodSignature">protected boolean <a href="../../../../src-html/org/apache/shiro/crypto/DefaultBlockCipherService.html#line.505">isGenerateInitializationVectors</a>​(boolean streaming)</pre> |
| <div class="block">Overrides the parent implementation to ensure initialization vectors are always generated if streaming is |
| enabled (block ciphers <em>must</em> use initialization vectors if they are to be used as a stream cipher). If |
| not being used as a stream cipher, then the value is computed based on whether or not the currently configured |
| <a href="#getModeName()"><code>modeName</code></a> is compatible with initialization vectors as well as the result of the configured |
| <a href="JcaCipherService.html#setGenerateInitializationVectors(boolean)"><code>generateInitializationVectors</code></a> value.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JcaCipherService.html#isGenerateInitializationVectors(boolean)">isGenerateInitializationVectors</a></code> in class <code><a href="JcaCipherService.html" title="class in org.apache.shiro.crypto">JcaCipherService</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>streaming</code> - whether or not streaming is being performed</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd><code>true</code> if streaming or a value computed based on if the currently configured mode is compatible |
| with initialization vectors.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="generateInitializationVector(boolean)"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>generateInitializationVector</h4> |
| <pre class="methodSignature">protected byte[] <a href="../../../../src-html/org/apache/shiro/crypto/DefaultBlockCipherService.html#line.510">generateInitializationVector</a>​(boolean streaming)</pre> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="JcaCipherService.html#generateInitializationVector(boolean)">generateInitializationVector</a></code> in class <code><a href="JcaCipherService.html" title="class in org.apache.shiro.crypto">JcaCipherService</a></code></dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </section> |
| </li> |
| </ul> |
| </div> |
| </div> |
| </main> |
| <!-- ========= END OF CLASS DATA ========= --> |
| <footer role="contentinfo"> |
| <nav role="navigation"> |
| <!-- ======= START OF BOTTOM NAVBAR ====== --> |
| <div class="bottomNav"><a id="navbar.bottom"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> |
| <a id="navbar.bottom.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../index.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/DefaultBlockCipherService.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList" id="allclasses_navbar_bottom"> |
| <li><a href="../../../../allclasses.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_bottom"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li>Field | </li> |
| <li><a href="#constructor.summary">Constr</a> | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li><a href="#constructor.detail">Constr</a> | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a id="skip.navbar.bottom"> |
| <!-- --> |
| </a></div> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| </nav> |
| <p class="legalCopy"><small>Copyright © 2004–2023 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p> |
| </footer> |
| </body> |
| </html> |