blob: 49cde5445c732ad1d7d39d186e8338cdfdc4bdb2 [file] [log] [blame]
<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (11.0.11) on Thu Oct 21 16:15:39 EDT 2021 -->
<title>BlowfishCipherService (Apache Shiro 1.8.0 API)</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="dc.created" content="2021-10-21">
<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="BlowfishCipherService (Apache Shiro 1.8.0 API)";
}
}
catch(err) {
}
//-->
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">
<!-- ========= 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/BlowfishCipherService.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&nbsp;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:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li>Method</li>
</ul>
</div>
<a id="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
</div>
<div class="navPadding">&nbsp;</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>&nbsp;<a href="package-summary.html">org.apache.shiro.crypto</a></div>
<h2 title="Class BlowfishCipherService" class="title">Class BlowfishCipherService</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><a href="DefaultBlockCipherService.html" title="class in org.apache.shiro.crypto">org.apache.shiro.crypto.DefaultBlockCipherService</a></li>
<li>
<ul class="inheritance">
<li>org.apache.shiro.crypto.BlowfishCipherService</li>
</ul>
</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>
<hr>
<pre>public class <a href="../../../../src-html/org/apache/shiro/crypto/BlowfishCipherService.html#line.41">BlowfishCipherService</a>
extends <a href="DefaultBlockCipherService.html" title="class in org.apache.shiro.crypto">DefaultBlockCipherService</a></pre>
<div class="block"><code>CipherService</code> using the <code>Blowfish</code> cipher algorithm for all encryption, decryption, and key operations.
<p/>
The Blowfish algorithm can support key sizes between <code>32</code> and <code>448</code> bits<b>*</b>, inclusive. However,
modern cryptanalysis techniques render keys of 80 bits or less mostly worthless - use <code>128</code> or more whenever
possible.
<p/>
Note that this class retains the parent class's default <a href="OperationMode.html#CBC"><code>CBC</code></a> mode of operation
instead of the typical JDK default of <a href="OperationMode.html#ECB"><code>ECB</code></a>. <code>ECB</code> should not be used in
security-sensitive environments because <code>ECB</code> does not allow for initialization vectors, which are
considered necessary for strong encryption. See the <a href="DefaultBlockCipherService.html" title="class in org.apache.shiro.crypto"><code>parent class</code></a>'s JavaDoc and the
<a href="JcaCipherService.html" title="class in org.apache.shiro.crypto"><code>JcaCipherService</code></a> JavaDoc for more on why the JDK default should not be used and is not
used in this implementation.
<p/>
<b>*</b> Generating and using Blowfish key sizes greater than 128 require installation of the
<a href="http://java.sun.com/javase/downloads/index.jsp">Java Cryptography Extension (JCE) Unlimited Strength
Jurisdiction Policy files</a>.</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">&nbsp;</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()">BlowfishCipherService</a></span>()</code></th>
<td class="colLast">
<div class="block">Creates a new <a href="CipherService.html" title="interface in org.apache.shiro.crypto"><code>CipherService</code></a> instance using the <code>Blowfish</code> cipher algorithm with the following
important cipher default attributes:
Attribute
Value
<a href="JcaCipherService.html#setKeySize(int)"><code>keySize</code></a>
<code>128</code> bits
<a href="DefaultBlockCipherService.html#setBlockSize(int)"><code>blockSize</code></a>
<code>64</code> bits (required for <code>Blowfish</code>)
<a href="DefaultBlockCipherService.html#setMode(org.apache.shiro.crypto.OperationMode)"><code>mode</code></a>
<a href="OperationMode.html#CBC"><code>CBC</code></a><b>*</b>
<a href="DefaultBlockCipherService.html#setPaddingScheme(org.apache.shiro.crypto.PaddingScheme)"><code>paddingScheme</code></a>
<a href="PaddingScheme.html#PKCS5"><code>PKCS5</code></a>
<a href="JcaCipherService.html#setInitializationVectorSize(int)"><code>initializationVectorSize</code></a>
<code>64</code> bits
<a href="JcaCipherService.html#setGenerateInitializationVectors(boolean)"><code>generateInitializationVectors</code></a>
<code>true</code><b>**</b>
</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>
<ul class="blockList">
<li class="blockList"><a id="methods.inherited.from.class.org.apache.shiro.crypto.DefaultBlockCipherService">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;org.apache.shiro.crypto.<a href="DefaultBlockCipherService.html" title="class in org.apache.shiro.crypto">DefaultBlockCipherService</a></h3>
<code><a href="DefaultBlockCipherService.html#generateInitializationVector(boolean)">generateInitializationVector</a>, <a href="DefaultBlockCipherService.html#getBlockSize()">getBlockSize</a>, <a href="DefaultBlockCipherService.html#getModeName()">getModeName</a>, <a href="DefaultBlockCipherService.html#getPaddingSchemeName()">getPaddingSchemeName</a>, <a href="DefaultBlockCipherService.html#getStreamingBlockSize()">getStreamingBlockSize</a>, <a href="DefaultBlockCipherService.html#getStreamingModeName()">getStreamingModeName</a>, <a href="DefaultBlockCipherService.html#getStreamingPaddingSchemeName()">getStreamingPaddingSchemeName</a>, <a href="DefaultBlockCipherService.html#getTransformationString(boolean)">getTransformationString</a>, <a href="DefaultBlockCipherService.html#isGenerateInitializationVectors(boolean)">isGenerateInitializationVectors</a>, <a href="DefaultBlockCipherService.html#setBlockSize(int)">setBlockSize</a>, <a href="DefaultBlockCipherService.html#setMode(org.apache.shiro.crypto.OperationMode)">setMode</a>, <a href="DefaultBlockCipherService.html#setModeName(java.lang.String)">setModeName</a>, <a href="DefaultBlockCipherService.html#setPaddingScheme(org.apache.shiro.crypto.PaddingScheme)">setPaddingScheme</a>, <a href="DefaultBlockCipherService.html#setPaddingSchemeName(java.lang.String)">setPaddingSchemeName</a>, <a href="DefaultBlockCipherService.html#setStreamingBlockSize(int)">setStreamingBlockSize</a>, <a href="DefaultBlockCipherService.html#setStreamingMode(org.apache.shiro.crypto.OperationMode)">setStreamingMode</a>, <a href="DefaultBlockCipherService.html#setStreamingModeName(java.lang.String)">setStreamingModeName</a>, <a href="DefaultBlockCipherService.html#setStreamingPaddingScheme(org.apache.shiro.crypto.PaddingScheme)">setStreamingPaddingScheme</a>, <a href="DefaultBlockCipherService.html#setStreamingPaddingSchemeName(java.lang.String)">setStreamingPaddingSchemeName</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a id="methods.inherited.from.class.org.apache.shiro.crypto.AbstractSymmetricCipherService">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;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&nbsp;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&nbsp;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="&lt;init&gt;()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>BlowfishCipherService</h4>
<pre>public&nbsp;<a href="../../../../src-html/org/apache/shiro/crypto/BlowfishCipherService.html#line.88">BlowfishCipherService</a>()</pre>
<div class="block">Creates a new <a href="CipherService.html" title="interface in org.apache.shiro.crypto"><code>CipherService</code></a> instance using the <code>Blowfish</code> cipher algorithm with the following
important cipher default attributes:
<table>
<tr>
<th>Attribute</th>
<th>Value</th>
</tr>
<tr>
<td><a href="JcaCipherService.html#setKeySize(int)"><code>keySize</code></a></td>
<td><code>128</code> bits</td>
</tr>
<tr>
<td><a href="DefaultBlockCipherService.html#setBlockSize(int)"><code>blockSize</code></a></td>
<td><code>64</code> bits (required for <code>Blowfish</code>)</td>
</tr>
<tr>
<td><a href="DefaultBlockCipherService.html#setMode(org.apache.shiro.crypto.OperationMode)"><code>mode</code></a></td>
<td><a href="OperationMode.html#CBC"><code>CBC</code></a><b>*</b></td>
</tr>
<tr>
<td><a href="DefaultBlockCipherService.html#setPaddingScheme(org.apache.shiro.crypto.PaddingScheme)"><code>paddingScheme</code></a></td>
<td><a href="PaddingScheme.html#PKCS5"><code>PKCS5</code></a></td>
</tr>
<tr>
<td><a href="JcaCipherService.html#setInitializationVectorSize(int)"><code>initializationVectorSize</code></a></td>
<td><code>64</code> bits</td>
</tr>
<tr>
<td><a href="JcaCipherService.html#setGenerateInitializationVectors(boolean)"><code>generateInitializationVectors</code></a></td>
<td><code>true</code><b>**</b></td>
</tr>
</table>
<p/>
<b>*</b> The <a href="OperationMode.html#CBC"><code>CBC</code></a> operation mode is used instead of the JDK default <code>ECB</code> to
ensure strong encryption. <code>ECB</code> should not be used in security-sensitive environments - see the
<a href="DefaultBlockCipherService.html" title="class in org.apache.shiro.crypto"><code>DefaultBlockCipherService</code></a> class JavaDoc's &quot;Operation Mode&quot; section
for more.
<p/>
<b>**</b>In conjunction with the default <code>CBC</code> operation mode, initialization vectors are generated by
default to ensure strong encryption. See the <a href="JcaCipherService.html" title="class in org.apache.shiro.crypto"><code>JcaCipherService</code></a> class JavaDoc for more.</div>
</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/BlowfishCipherService.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&nbsp;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:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li>Method</li>
</ul>
</div>
<a id="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</nav>
<p class="legalCopy"><small>Copyright &#169; 2004&#x2013;2021 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</footer>
</body>
</html>