| <!DOCTYPE HTML> |
| <!-- NewPage --> |
| <html lang="en"> |
| <head> |
| <!-- Generated by javadoc --> |
| <title>JcaCipherService (Apache Shiro 1.11.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.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.5.1.js"></script> |
| <script type="text/javascript" src="../../../../jquery/jquery-ui.js"></script> |
| </head> |
| <body> |
| <script type="text/javascript"><!-- |
| try { |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="JcaCipherService (Apache Shiro 1.11.0 API)"; |
| } |
| } |
| catch(err) { |
| } |
| //--> |
| var data = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":9,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10,"i14":10,"i15":10,"i16":10,"i17":10,"i18":10,"i19":10,"i20":10}; |
| var tabs = {65535:["t0","All Methods"],1:["t1","Static 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/JcaCipherService.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 JcaCipherService" class="title">Class JcaCipherService</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>org.apache.shiro.crypto.JcaCipherService</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="AbstractSymmetricCipherService.html" title="class in org.apache.shiro.crypto">AbstractSymmetricCipherService</a></code></dd> |
| </dl> |
| <hr> |
| <pre>public abstract class <a href="../../../../src-html/org/apache/shiro/crypto/JcaCipherService.html#line.69">JcaCipherService</a> |
| extends <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> |
| implements <a href="CipherService.html" title="interface in org.apache.shiro.crypto">CipherService</a></pre> |
| <div class="block">Abstract <code>CipherService</code> implementation utilizing Java's JCA APIs. |
| <h2>Auto-generated Initialization Vectors</h2> |
| Shiro does something by default for all of its <code>CipherService</code> implementations that the JCA |
| <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> does not do: by default, |
| <a href="http://en.wikipedia.org/wiki/Initialization_vector">initialization vector</a>s are automatically randomly |
| generated and prepended to encrypted data before returning from the <code>encrypt</code> methods. That is, the returned |
| byte array or <code>OutputStream</code> is actually a concatenation of an initialization vector byte array plus the actual |
| encrypted data byte array. The <code>decrypt</code> methods in turn know to read this prepended initialization vector |
| before decrypting the real data that follows. |
| <p/> |
| This is highly desirable because initialization vectors guarantee that, for a key and any plaintext, the encrypted |
| output will always be different <em>even if you call <code>encrypt</code> multiple times with the exact same arguments</em>. |
| This is essential in cryptography to ensure that data patterns cannot be identified across multiple input sources |
| that are the same or similar. |
| <p/> |
| You can turn off this behavior by setting the |
| <a href="#setGenerateInitializationVectors(boolean)"><code>generateInitializationVectors</code></a> property to <code>false</code>, but it |
| is highly recommended that you do not do this unless you have a very good reason to do so, since you would be losing |
| a critical security feature. |
| <h3>Initialization Vector Size</h3> |
| This implementation defaults the <a href="#setInitializationVectorSize(int)"><code>initializationVectorSize</code></a> attribute to |
| <code>128</code> bits, a fairly common size. Initialization vector sizes are very algorithm specific however, so subclass |
| implementations will often override this value in their constructor if necessary. |
| <p/> |
| Also note that <code>initializationVectorSize</code> values are specified in the number of |
| bits (not bytes!) to match common references in most cryptography documentation. In practice though, initialization |
| vectors are always specified as a byte array, so ensure that if you set this property, that the value is a multiple |
| of <code>8</code> to ensure that the IV can be correctly represented as a byte array (the |
| <a href="#setInitializationVectorSize(int)"><code>setInitializationVectorSize</code></a> mutator method enforces this).</div> |
| <dl> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>1.0</dd> |
| </dl> |
| </li> |
| </ul> |
| </div> |
| <div class="summary"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ======== CONSTRUCTOR SUMMARY ======== --> |
| <section role="region"> |
| <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">Modifier</th> |
| <th class="colSecond" scope="col">Constructor</th> |
| <th class="colLast" scope="col">Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>protected </code></td> |
| <th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E(java.lang.String)">JcaCipherService</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 <code>JcaCipherService</code> instance which will use the specified cipher <code>algorithmName</code> |
| for all encryption, decryption, and key operations.</div> |
| </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| </section> |
| <!-- ========== METHOD SUMMARY =========== --> |
| <section role="region"> |
| <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="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></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 <a href="https://docs.oracle.com/javase/8/docs/api/java/security/spec/AlgorithmParameterSpec.html?is-external=true" title="class or interface in java.security.spec" class="externalLink">AlgorithmParameterSpec</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#createParameterSpec(byte%5B%5D,boolean)">createParameterSpec</a></span>​(byte[] iv, |
| boolean streaming)</code></th> |
| <td class="colLast"> </td> |
| </tr> |
| <tr id="i1" class="rowColor"> |
| <td class="colFirst"><code><a href="../util/ByteSource.html" title="interface in org.apache.shiro.util">ByteSource</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#decrypt(byte%5B%5D,byte%5B%5D)">decrypt</a></span>​(byte[] ciphertext, |
| byte[] key)</code></th> |
| <td class="colLast"> |
| <div class="block">Decrypts encrypted data via the specified cipher key and returns the original (pre-encrypted) data.</div> |
| </td> |
| </tr> |
| <tr id="i2" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#decrypt(java.io.InputStream,java.io.OutputStream,byte%5B%5D)">decrypt</a></span>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io" class="externalLink">InputStream</a> in, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io" class="externalLink">OutputStream</a> out, |
| byte[] key)</code></th> |
| <td class="colLast"> |
| <div class="block">Receives encrypted data from the given <code>InputStream</code>, decrypts it, and sends the resulting decrypted data |
| to the given <code>OutputStream</code>.</div> |
| </td> |
| </tr> |
| <tr id="i3" class="rowColor"> |
| <td class="colFirst"><code><a href="../util/ByteSource.html" title="interface in org.apache.shiro.util">ByteSource</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#encrypt(byte%5B%5D,byte%5B%5D)">encrypt</a></span>​(byte[] plaintext, |
| byte[] key)</code></th> |
| <td class="colLast"> |
| <div class="block">Encrypts data via the specified cipher key.</div> |
| </td> |
| </tr> |
| <tr id="i4" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#encrypt(java.io.InputStream,java.io.OutputStream,byte%5B%5D)">encrypt</a></span>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io" class="externalLink">InputStream</a> in, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io" class="externalLink">OutputStream</a> out, |
| byte[] key)</code></th> |
| <td class="colLast"> |
| <div class="block">Receives the data from the given <code>InputStream</code>, encrypts it, and sends the resulting encrypted data to the |
| given <code>OutputStream</code>.</div> |
| </td> |
| </tr> |
| <tr id="i5" class="rowColor"> |
| <td class="colFirst"><code>protected <a href="https://docs.oracle.com/javase/8/docs/api/java/security/SecureRandom.html?is-external=true" title="class or interface in java.security" class="externalLink">SecureRandom</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#ensureSecureRandom()">ensureSecureRandom</a></span>()</code></th> |
| <td class="colLast"> </td> |
| </tr> |
| <tr id="i6" 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="i7" 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="#getAlgorithmName()">getAlgorithmName</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Returns the cipher algorithm name that will be used for all encryption, decryption, and key operations (for |
| example, 'AES', 'Blowfish', 'RSA', 'DSA', 'TripleDES', etc).</div> |
| </td> |
| </tr> |
| <tr id="i8" class="altColor"> |
| <td class="colFirst"><code>protected static <a href="https://docs.oracle.com/javase/8/docs/api/java/security/SecureRandom.html?is-external=true" title="class or interface in java.security" class="externalLink">SecureRandom</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getDefaultSecureRandom()">getDefaultSecureRandom</a></span>()</code></th> |
| <td class="colLast"> </td> |
| </tr> |
| <tr id="i9" class="rowColor"> |
| <td class="colFirst"><code>int</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getInitializationVectorSize()">getInitializationVectorSize</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Returns the algorithm-specific size in bits of generated initialization vectors.</div> |
| </td> |
| </tr> |
| <tr id="i10" class="altColor"> |
| <td class="colFirst"><code>int</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getKeySize()">getKeySize</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Returns the size in bits (not bytes) of generated cipher keys.</div> |
| </td> |
| </tr> |
| <tr id="i11" class="rowColor"> |
| <td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/security/SecureRandom.html?is-external=true" title="class or interface in java.security" class="externalLink">SecureRandom</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getSecureRandom()">getSecureRandom</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Returns a source of randomness for encryption operations.</div> |
| </td> |
| </tr> |
| <tr id="i12" class="altColor"> |
| <td class="colFirst"><code>int</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getStreamingBufferSize()">getStreamingBufferSize</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Returns the size in bytes of the internal buffer used to transfer data from one stream to another during stream |
| operations (<a href="#encrypt(java.io.InputStream,java.io.OutputStream,byte%5B%5D)"><code>encrypt(java.io.InputStream, java.io.OutputStream, byte[])</code></a> and |
| <a href="#decrypt(java.io.InputStream,java.io.OutputStream,byte%5B%5D)"><code>decrypt(java.io.InputStream, java.io.OutputStream, byte[])</code></a>).</div> |
| </td> |
| </tr> |
| <tr id="i13" 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> invocation when |
| creating a new <code>Cipher</code> instance.</div> |
| </td> |
| </tr> |
| <tr id="i14" class="altColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isGenerateInitializationVectors()">isGenerateInitializationVectors</a></span>()</code></th> |
| <td class="colLast"> </td> |
| </tr> |
| <tr id="i15" class="rowColor"> |
| <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"> </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="#setGenerateInitializationVectors(boolean)">setGenerateInitializationVectors</a></span>​(boolean generateInitializationVectors)</code></th> |
| <td class="colLast"> </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="#setInitializationVectorSize(int)">setInitializationVectorSize</a></span>​(int initializationVectorSize)</code></th> |
| <td class="colLast"> |
| <div class="block">Sets the algorithm-specific initialization vector size in bits (not bytes!) to be used when generating |
| initialization vectors.</div> |
| </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="#setKeySize(int)">setKeySize</a></span>​(int keySize)</code></th> |
| <td class="colLast"> |
| <div class="block">Sets the size in bits (not bytes) of generated cipher keys.</div> |
| </td> |
| </tr> |
| <tr id="i19" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setSecureRandom(java.security.SecureRandom)">setSecureRandom</a></span>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/security/SecureRandom.html?is-external=true" title="class or interface in java.security" class="externalLink">SecureRandom</a> secureRandom)</code></th> |
| <td class="colLast"> |
| <div class="block">Sets a source of randomness for encryption operations.</div> |
| </td> |
| </tr> |
| <tr id="i20" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setStreamingBufferSize(int)">setStreamingBufferSize</a></span>​(int streamingBufferSize)</code></th> |
| <td class="colLast"> |
| <div class="block">Sets the size in bytes of the internal buffer used to transfer data from one stream to another during stream |
| operations (<a href="#encrypt(java.io.InputStream,java.io.OutputStream,byte%5B%5D)"><code>encrypt(java.io.InputStream, java.io.OutputStream, byte[])</code></a> and |
| <a href="#decrypt(java.io.InputStream,java.io.OutputStream,byte%5B%5D)"><code>decrypt(java.io.InputStream, java.io.OutputStream, byte[])</code></a>).</div> |
| </td> |
| </tr> |
| </table> |
| <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 role="region"> |
| <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>JcaCipherService</h4> |
| <pre>protected <a href="../../../../src-html/org/apache/shiro/crypto/JcaCipherService.html#line.125">JcaCipherService</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 <code>JcaCipherService</code> instance which will use the specified cipher <code>algorithmName</code> |
| for all encryption, decryption, and key operations. Also, the following defaults are set: |
| <ul> |
| <li><a href="#setKeySize(int)"><code>keySize</code></a> = 128 bits</li> |
| <li><a href="#setInitializationVectorSize(int)"><code>initializationVectorSize</code></a> = 128 bits</li> |
| <li><a href="#setStreamingBufferSize(int)"><code>streamingBufferSize</code></a> = 512 bytes</li> |
| </ul></div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>algorithmName</code> - the name of the cipher algorithm to use for all encryption, decryption, and key operations</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </section> |
| <!-- ============ METHOD DETAIL ========== --> |
| <section role="region"> |
| <ul class="blockList"> |
| <li class="blockList"><a id="method.detail"> |
| <!-- --> |
| </a> |
| <h3>Method Detail</h3> |
| <a id="getAlgorithmName()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getAlgorithmName</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/JcaCipherService.html#line.142">getAlgorithmName</a>()</pre> |
| <div class="block">Returns the cipher algorithm name that will be used for all encryption, decryption, and key operations (for |
| example, 'AES', 'Blowfish', 'RSA', 'DSA', 'TripleDES', etc).</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the cipher algorithm name that will be used for all encryption, decryption, and key operations</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="getKeySize()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getKeySize</h4> |
| <pre class="methodSignature">public int <a href="../../../../src-html/org/apache/shiro/crypto/JcaCipherService.html#line.151">getKeySize</a>()</pre> |
| <div class="block">Returns the size in bits (not bytes) of generated cipher keys.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the size in bits (not bytes) of generated cipher keys.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="setKeySize(int)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setKeySize</h4> |
| <pre class="methodSignature">public void <a href="../../../../src-html/org/apache/shiro/crypto/JcaCipherService.html#line.160">setKeySize</a>​(int keySize)</pre> |
| <div class="block">Sets the size in bits (not bytes) of generated cipher keys.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>keySize</code> - the size in bits (not bytes) of generated cipher keys.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="isGenerateInitializationVectors()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>isGenerateInitializationVectors</h4> |
| <pre class="methodSignature">public boolean <a href="../../../../src-html/org/apache/shiro/crypto/JcaCipherService.html#line.164">isGenerateInitializationVectors</a>()</pre> |
| </li> |
| </ul> |
| <a id="setGenerateInitializationVectors(boolean)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setGenerateInitializationVectors</h4> |
| <pre class="methodSignature">public void <a href="../../../../src-html/org/apache/shiro/crypto/JcaCipherService.html#line.168">setGenerateInitializationVectors</a>​(boolean generateInitializationVectors)</pre> |
| </li> |
| </ul> |
| <a id="getInitializationVectorSize()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getInitializationVectorSize</h4> |
| <pre class="methodSignature">public int <a href="../../../../src-html/org/apache/shiro/crypto/JcaCipherService.html#line.177">getInitializationVectorSize</a>()</pre> |
| <div class="block">Returns the algorithm-specific size in bits of generated initialization vectors.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the algorithm-specific size in bits of generated initialization vectors.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="setInitializationVectorSize(int)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setInitializationVectorSize</h4> |
| <pre class="methodSignature">public void <a href="../../../../src-html/org/apache/shiro/crypto/JcaCipherService.html#line.189">setInitializationVectorSize</a>​(int initializationVectorSize) |
| throws <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang" class="externalLink">IllegalArgumentException</a></pre> |
| <div class="block">Sets the algorithm-specific initialization vector size in bits (not bytes!) to be used when generating |
| initialization vectors. The value must be a multiple of <code>8</code> to ensure that the IV can be represented |
| as a byte array.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>initializationVectorSize</code> - the size in bits (not bytes) of generated initialization vectors.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang" class="externalLink">IllegalArgumentException</a></code> - if the size is not a multiple of <code>8</code>.</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/JcaCipherService.html#line.198">isGenerateInitializationVectors</a>​(boolean streaming)</pre> |
| </li> |
| </ul> |
| <a id="getStreamingBufferSize()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getStreamingBufferSize</h4> |
| <pre class="methodSignature">public int <a href="../../../../src-html/org/apache/shiro/crypto/JcaCipherService.html#line.212">getStreamingBufferSize</a>()</pre> |
| <div class="block">Returns the size in bytes of the internal buffer used to transfer data from one stream to another during stream |
| operations (<a href="#encrypt(java.io.InputStream,java.io.OutputStream,byte%5B%5D)"><code>encrypt(java.io.InputStream, java.io.OutputStream, byte[])</code></a> and |
| <a href="#decrypt(java.io.InputStream,java.io.OutputStream,byte%5B%5D)"><code>decrypt(java.io.InputStream, java.io.OutputStream, byte[])</code></a>). |
| <p/> |
| Default size is <code>512</code> bytes.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the size of the internal buffer used to transfer data from one stream to another during stream |
| operations</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="setStreamingBufferSize(int)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setStreamingBufferSize</h4> |
| <pre class="methodSignature">public void <a href="../../../../src-html/org/apache/shiro/crypto/JcaCipherService.html#line.226">setStreamingBufferSize</a>​(int streamingBufferSize)</pre> |
| <div class="block">Sets the size in bytes of the internal buffer used to transfer data from one stream to another during stream |
| operations (<a href="#encrypt(java.io.InputStream,java.io.OutputStream,byte%5B%5D)"><code>encrypt(java.io.InputStream, java.io.OutputStream, byte[])</code></a> and |
| <a href="#decrypt(java.io.InputStream,java.io.OutputStream,byte%5B%5D)"><code>decrypt(java.io.InputStream, java.io.OutputStream, byte[])</code></a>). |
| <p/> |
| Default size is <code>512</code> bytes.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>streamingBufferSize</code> - the size of the internal buffer used to transfer data from one stream to another |
| during stream operations</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="getSecureRandom()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getSecureRandom</h4> |
| <pre class="methodSignature">public <a href="https://docs.oracle.com/javase/8/docs/api/java/security/SecureRandom.html?is-external=true" title="class or interface in java.security" class="externalLink">SecureRandom</a> <a href="../../../../src-html/org/apache/shiro/crypto/JcaCipherService.html#line.237">getSecureRandom</a>()</pre> |
| <div class="block">Returns a source of randomness for encryption operations. If one is not configured, and the underlying |
| algorithm needs one, the JDK <code>SHA1PRNG</code> instance will be used by default.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a source of randomness for encryption operations. If one is not configured, and the underlying |
| algorithm needs one, the JDK <code>SHA1PRNG</code> instance will be used by default.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="setSecureRandom(java.security.SecureRandom)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setSecureRandom</h4> |
| <pre class="methodSignature">public void <a href="../../../../src-html/org/apache/shiro/crypto/JcaCipherService.html#line.248">setSecureRandom</a>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/security/SecureRandom.html?is-external=true" title="class or interface in java.security" class="externalLink">SecureRandom</a> secureRandom)</pre> |
| <div class="block">Sets a source of randomness for encryption operations. If one is not configured, and the underlying |
| algorithm needs one, the JDK <code>SHA1PRNG</code> instance will be used by default.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>secureRandom</code> - a source of randomness for encryption operations. If one is not configured, and the |
| underlying algorithm needs one, the JDK <code>SHA1PRNG</code> instance will be used by default.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="getDefaultSecureRandom()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getDefaultSecureRandom</h4> |
| <pre class="methodSignature">protected static <a href="https://docs.oracle.com/javase/8/docs/api/java/security/SecureRandom.html?is-external=true" title="class or interface in java.security" class="externalLink">SecureRandom</a> <a href="../../../../src-html/org/apache/shiro/crypto/JcaCipherService.html#line.252">getDefaultSecureRandom</a>()</pre> |
| </li> |
| </ul> |
| <a id="ensureSecureRandom()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>ensureSecureRandom</h4> |
| <pre class="methodSignature">protected <a href="https://docs.oracle.com/javase/8/docs/api/java/security/SecureRandom.html?is-external=true" title="class or interface in java.security" class="externalLink">SecureRandom</a> <a href="../../../../src-html/org/apache/shiro/crypto/JcaCipherService.html#line.262">ensureSecureRandom</a>()</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/JcaCipherService.html#line.280">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> invocation when |
| creating a new <code>Cipher</code> instance. This default implementation always returns |
| <a href="#getAlgorithmName()"><code>getAlgorithmName()</code></a>. Block cipher implementations will want to override this method |
| to support appending cipher operation modes and padding schemes.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>streaming</code> - if the transformation string is going to be used for a Cipher for stream-based encryption or not.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>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> invocation when |
| creating a new <code>Cipher</code> instance.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="generateInitializationVector(boolean)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>generateInitializationVector</h4> |
| <pre class="methodSignature">protected byte[] <a href="../../../../src-html/org/apache/shiro/crypto/JcaCipherService.html#line.284">generateInitializationVector</a>​(boolean streaming)</pre> |
| </li> |
| </ul> |
| <a id="encrypt(byte[],byte[])"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>encrypt</h4> |
| <pre class="methodSignature">public <a href="../util/ByteSource.html" title="interface in org.apache.shiro.util">ByteSource</a> <a href="../../../../src-html/org/apache/shiro/crypto/JcaCipherService.html#line.303">encrypt</a>​(byte[] plaintext, |
| byte[] key)</pre> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="CipherService.html#encrypt(byte%5B%5D,byte%5B%5D)">CipherService</a></code></span></div> |
| <div class="block">Encrypts data via the specified cipher key. Note that the key must be in a format understood by |
| the <code>CipherService</code> implementation.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code><a href="CipherService.html#encrypt(byte%5B%5D,byte%5B%5D)">encrypt</a></code> in interface <code><a href="CipherService.html" title="interface in org.apache.shiro.crypto">CipherService</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>plaintext</code> - the data to encrypt</dd> |
| <dd><code>key</code> - the cipher key used during encryption.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a byte source with the encrypted representation of the specified raw data.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="decrypt(byte[],byte[])"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>decrypt</h4> |
| <pre class="methodSignature">public <a href="../util/ByteSource.html" title="interface in org.apache.shiro.util">ByteSource</a> <a href="../../../../src-html/org/apache/shiro/crypto/JcaCipherService.html#line.347">decrypt</a>​(byte[] ciphertext, |
| byte[] key) |
| throws <a href="CryptoException.html" title="class in org.apache.shiro.crypto">CryptoException</a></pre> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="CipherService.html#decrypt(byte%5B%5D,byte%5B%5D)">CipherService</a></code></span></div> |
| <div class="block">Decrypts encrypted data via the specified cipher key and returns the original (pre-encrypted) data. |
| Note that the key must be in a format understood by the CipherService implementation.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code><a href="CipherService.html#decrypt(byte%5B%5D,byte%5B%5D)">decrypt</a></code> in interface <code><a href="CipherService.html" title="interface in org.apache.shiro.crypto">CipherService</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>ciphertext</code> - the previously encrypted data to decrypt</dd> |
| <dd><code>key</code> - the cipher key used during decryption.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a byte source representing the original form of the specified encrypted data.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="CryptoException.html" title="class in org.apache.shiro.crypto">CryptoException</a></code> - if there is an error during decryption</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="encrypt(java.io.InputStream,java.io.OutputStream,byte[])"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>encrypt</h4> |
| <pre class="methodSignature">public void <a href="../../../../src-html/org/apache/shiro/crypto/JcaCipherService.html#line.500">encrypt</a>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io" class="externalLink">InputStream</a> in, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io" class="externalLink">OutputStream</a> out, |
| byte[] key) |
| throws <a href="CryptoException.html" title="class in org.apache.shiro.crypto">CryptoException</a></pre> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="CipherService.html#encrypt(java.io.InputStream,java.io.OutputStream,byte%5B%5D)">CipherService</a></code></span></div> |
| <div class="block">Receives the data from the given <code>InputStream</code>, encrypts it, and sends the resulting encrypted data to the |
| given <code>OutputStream</code>. |
| <p/> |
| <b>NOTE:</b> This method <em>does NOT</em> flush or close either stream prior to returning - the caller must |
| do so when they are finished with the streams. For example: |
| <pre> |
| try { |
| InputStream in = ... |
| OutputStream out = ... |
| cipherService.encrypt(in, out, encryptionKey); |
| } finally { |
| if (in != null) { |
| try { |
| in.close(); |
| } catch (IOException ioe1) { ... log, trigger event, etc } |
| } |
| if (out != null) { |
| try { |
| out.close(); |
| } catch (IOException ioe2) { ... log, trigger event, etc } |
| } |
| } |
| </pre></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code><a href="CipherService.html#encrypt(java.io.InputStream,java.io.OutputStream,byte%5B%5D)">encrypt</a></code> in interface <code><a href="CipherService.html" title="interface in org.apache.shiro.crypto">CipherService</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>in</code> - the stream supplying the data to encrypt</dd> |
| <dd><code>out</code> - the stream to send the encrypted data</dd> |
| <dd><code>key</code> - the cipher key to use for encryption</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="CryptoException.html" title="class in org.apache.shiro.crypto">CryptoException</a></code> - if there is any problem during encryption.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="decrypt(java.io.InputStream,java.io.OutputStream,byte[])"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>decrypt</h4> |
| <pre class="methodSignature">public void <a href="../../../../src-html/org/apache/shiro/crypto/JcaCipherService.html#line.526">decrypt</a>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io" class="externalLink">InputStream</a> in, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io" class="externalLink">OutputStream</a> out, |
| byte[] key) |
| throws <a href="CryptoException.html" title="class in org.apache.shiro.crypto">CryptoException</a></pre> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="CipherService.html#decrypt(java.io.InputStream,java.io.OutputStream,byte%5B%5D)">CipherService</a></code></span></div> |
| <div class="block">Receives encrypted data from the given <code>InputStream</code>, decrypts it, and sends the resulting decrypted data |
| to the given <code>OutputStream</code>. |
| <p/> |
| <b>NOTE:</b> This method <em>does NOT</em> flush or close either stream prior to returning - the caller must |
| do so when they are finished with the streams. For example: |
| <pre> |
| try { |
| InputStream in = ... |
| OutputStream out = ... |
| cipherService.decrypt(in, out, decryptionKey); |
| } finally { |
| if (in != null) { |
| try { |
| in.close(); |
| } catch (IOException ioe1) { ... log, trigger event, etc } |
| } |
| if (out != null) { |
| try { |
| out.close(); |
| } catch (IOException ioe2) { ... log, trigger event, etc } |
| } |
| } |
| </pre></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code><a href="CipherService.html#decrypt(java.io.InputStream,java.io.OutputStream,byte%5B%5D)">decrypt</a></code> in interface <code><a href="CipherService.html" title="interface in org.apache.shiro.crypto">CipherService</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>in</code> - the stream supplying the data to decrypt</dd> |
| <dd><code>out</code> - the stream to send the decrypted data</dd> |
| <dd><code>key</code> - the cipher key to use for decryption</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="CryptoException.html" title="class in org.apache.shiro.crypto">CryptoException</a></code> - if there is any problem during decryption.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="createParameterSpec(byte[],boolean)"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>createParameterSpec</h4> |
| <pre class="methodSignature">protected <a href="https://docs.oracle.com/javase/8/docs/api/java/security/spec/AlgorithmParameterSpec.html?is-external=true" title="class or interface in java.security.spec" class="externalLink">AlgorithmParameterSpec</a> <a href="../../../../src-html/org/apache/shiro/crypto/JcaCipherService.html#line.604">createParameterSpec</a>​(byte[] iv, |
| boolean streaming)</pre> |
| </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/JcaCipherService.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> |