blob: 936d096b9c8bb2b70c77af7b9fbd988744aa6e07 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_65) on Tue Feb 25 18:15:47 EST 2014 -->
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
SecureRandomNumberGenerator (Apache Shiro 1.2.3 API)
</TITLE>
<META NAME="date" CONTENT="2014-02-25">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="SecureRandomNumberGenerator (Apache Shiro 1.2.3 API)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/SecureRandomNumberGenerator.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../org/apache/shiro/crypto/RandomNumberGenerator.html" title="interface in org.apache.shiro.crypto"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../../org/apache/shiro/crypto/UnknownAlgorithmException.html" title="class in org.apache.shiro.crypto"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?org/apache/shiro/crypto/SecureRandomNumberGenerator.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="SecureRandomNumberGenerator.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
&nbsp;<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
org.apache.shiro.crypto</FONT>
<BR>
Class SecureRandomNumberGenerator</H2>
<PRE>
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</A>
<IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>org.apache.shiro.crypto.SecureRandomNumberGenerator</B>
</PRE>
<DL>
<DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../../../org/apache/shiro/crypto/RandomNumberGenerator.html" title="interface in org.apache.shiro.crypto">RandomNumberGenerator</A></DD>
</DL>
<HR>
<DL>
<DT><PRE>public class <A HREF="../../../../src-html/org/apache/shiro/crypto/SecureRandomNumberGenerator.html#line.35"><B>SecureRandomNumberGenerator</B></A><DT>extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A><DT>implements <A HREF="../../../../org/apache/shiro/crypto/RandomNumberGenerator.html" title="interface in org.apache.shiro.crypto">RandomNumberGenerator</A></DL>
</PRE>
<P>
Default implementation of the <A HREF="../../../../org/apache/shiro/crypto/RandomNumberGenerator.html" title="interface in org.apache.shiro.crypto"><CODE>RandomNumberGenerator</CODE></A> interface, backed by a
<A HREF="http://java.sun.com/javase/6/docs/api/java/security/SecureRandom.html?is-external=true" title="class or interface in java.security"><CODE>SecureRandom</CODE></A> instance.
<p/>
This class is a little easier to use than using the JDK's <code>SecureRandom</code> class directly. It also
allows for JavaBeans-style of customization, convenient for Shiro's INI configuration or other IoC configuration
mechanism.
<P>
<P>
<DL>
<DT><B>Since:</B></DT>
<DD>1.1</DD>
</DL>
<HR>
<P>
<!-- =========== FIELD SUMMARY =========== -->
<A NAME="field_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Field Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/shiro/crypto/SecureRandomNumberGenerator.html#DEFAULT_NEXT_BYTES_SIZE">DEFAULT_NEXT_BYTES_SIZE</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
</TABLE>
&nbsp;
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../org/apache/shiro/crypto/SecureRandomNumberGenerator.html#SecureRandomNumberGenerator()">SecureRandomNumberGenerator</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a new instance with a default backing <A HREF="http://java.sun.com/javase/6/docs/api/java/security/SecureRandom.html?is-external=true" title="class or interface in java.security"><CODE>SecureRandom</CODE></A> and a
<A HREF="../../../../org/apache/shiro/crypto/SecureRandomNumberGenerator.html#getDefaultNextBytesSize()"><CODE>defaultNextBytesSize</CODE></A> of <code>16</code>, which equals 128 bits, a size commonly
used in cryptographic algorithms.</TD>
</TR>
</TABLE>
&nbsp;
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/shiro/crypto/SecureRandomNumberGenerator.html#getDefaultNextBytesSize()">getDefaultNextBytesSize</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the size of the generated byte array for calls to <A HREF="../../../../org/apache/shiro/crypto/SecureRandomNumberGenerator.html#nextBytes()"><CODE>nextBytes()</CODE></A>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/security/SecureRandom.html?is-external=true" title="class or interface in java.security">SecureRandom</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/shiro/crypto/SecureRandomNumberGenerator.html#getSecureRandom()">getSecureRandom</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the <A HREF="http://java.sun.com/javase/6/docs/api/java/security/SecureRandom.html?is-external=true" title="class or interface in java.security"><CODE>SecureRandom</CODE></A> backing this instance.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../../org/apache/shiro/util/ByteSource.html" title="interface in org.apache.shiro.util">ByteSource</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/shiro/crypto/SecureRandomNumberGenerator.html#nextBytes()">nextBytes</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Generates a byte array of fixed length filled with random data, often useful for generating salts,
initialization vectors or other seed data.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../../org/apache/shiro/util/ByteSource.html" title="interface in org.apache.shiro.util">ByteSource</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/shiro/crypto/SecureRandomNumberGenerator.html#nextBytes(int)">nextBytes</A></B>(int&nbsp;numBytes)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Generates a byte array of the specified length filled with random data.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/shiro/crypto/SecureRandomNumberGenerator.html#setDefaultNextBytesSize(int)">setDefaultNextBytesSize</A></B>(int&nbsp;defaultNextBytesSize)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the size of the generated byte array for calls to <A HREF="../../../../org/apache/shiro/crypto/SecureRandomNumberGenerator.html#nextBytes()"><CODE>nextBytes()</CODE></A>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/shiro/crypto/SecureRandomNumberGenerator.html#setSecureRandom(java.security.SecureRandom)">setSecureRandom</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/security/SecureRandom.html?is-external=true" title="class or interface in java.security">SecureRandom</A>&nbsp;random)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the <A HREF="http://java.sun.com/javase/6/docs/api/java/security/SecureRandom.html?is-external=true" title="class or interface in java.security"><CODE>SecureRandom</CODE></A> to back this instance.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/shiro/crypto/SecureRandomNumberGenerator.html#setSeed(byte[])">setSeed</A></B>(byte[]&nbsp;bytes)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Seeds the backing <A HREF="http://java.sun.com/javase/6/docs/api/java/security/SecureRandom.html?is-external=true" title="class or interface in java.security"><CODE>SecureRandom</CODE></A> instance with additional seed data.</TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>
<!-- ============ FIELD DETAIL =========== -->
<A NAME="field_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Field Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="DEFAULT_NEXT_BYTES_SIZE"><!-- --></A><H3>
DEFAULT_NEXT_BYTES_SIZE</H3>
<PRE>
protected static final int <A HREF="../../../../src-html/org/apache/shiro/crypto/SecureRandomNumberGenerator.html#line.37"><B>DEFAULT_NEXT_BYTES_SIZE</B></A></PRE>
<DL>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../../constant-values.html#org.apache.shiro.crypto.SecureRandomNumberGenerator.DEFAULT_NEXT_BYTES_SIZE">Constant Field Values</A></DL>
</DL>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="SecureRandomNumberGenerator()"><!-- --></A><H3>
SecureRandomNumberGenerator</H3>
<PRE>
public <A HREF="../../../../src-html/org/apache/shiro/crypto/SecureRandomNumberGenerator.html#line.47"><B>SecureRandomNumberGenerator</B></A>()</PRE>
<DL>
<DD>Creates a new instance with a default backing <A HREF="http://java.sun.com/javase/6/docs/api/java/security/SecureRandom.html?is-external=true" title="class or interface in java.security"><CODE>SecureRandom</CODE></A> and a
<A HREF="../../../../org/apache/shiro/crypto/SecureRandomNumberGenerator.html#getDefaultNextBytesSize()"><CODE>defaultNextBytesSize</CODE></A> of <code>16</code>, which equals 128 bits, a size commonly
used in cryptographic algorithms.
<P>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="setSeed(byte[])"><!-- --></A><H3>
setSeed</H3>
<PRE>
public void <A HREF="../../../../src-html/org/apache/shiro/crypto/SecureRandomNumberGenerator.html#line.58"><B>setSeed</B></A>(byte[]&nbsp;bytes)</PRE>
<DL>
<DD>Seeds the backing <A HREF="http://java.sun.com/javase/6/docs/api/java/security/SecureRandom.html?is-external=true" title="class or interface in java.security"><CODE>SecureRandom</CODE></A> instance with additional seed data.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>bytes</CODE> - the seed bytes<DT><B>See Also:</B><DD><A HREF="http://java.sun.com/javase/6/docs/api/java/security/SecureRandom.html?is-external=true#setSeed(byte[])" title="class or interface in java.security"><CODE>SecureRandom.setSeed(byte[])</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getSecureRandom()"><!-- --></A><H3>
getSecureRandom</H3>
<PRE>
public <A HREF="http://java.sun.com/javase/6/docs/api/java/security/SecureRandom.html?is-external=true" title="class or interface in java.security">SecureRandom</A> <A HREF="../../../../src-html/org/apache/shiro/crypto/SecureRandomNumberGenerator.html#line.67"><B>getSecureRandom</B></A>()</PRE>
<DL>
<DD>Returns the <A HREF="http://java.sun.com/javase/6/docs/api/java/security/SecureRandom.html?is-external=true" title="class or interface in java.security"><CODE>SecureRandom</CODE></A> backing this instance.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>the <A HREF="http://java.sun.com/javase/6/docs/api/java/security/SecureRandom.html?is-external=true" title="class or interface in java.security"><CODE>SecureRandom</CODE></A> backing this instance.</DL>
</DD>
</DL>
<HR>
<A NAME="setSecureRandom(java.security.SecureRandom)"><!-- --></A><H3>
setSecureRandom</H3>
<PRE>
public void <A HREF="../../../../src-html/org/apache/shiro/crypto/SecureRandomNumberGenerator.html#line.77"><B>setSecureRandom</B></A>(<A HREF="http://java.sun.com/javase/6/docs/api/java/security/SecureRandom.html?is-external=true" title="class or interface in java.security">SecureRandom</A>&nbsp;random)
throws <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</A></PRE>
<DL>
<DD>Sets the <A HREF="http://java.sun.com/javase/6/docs/api/java/security/SecureRandom.html?is-external=true" title="class or interface in java.security"><CODE>SecureRandom</CODE></A> to back this instance.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>random</CODE> - the <A HREF="http://java.sun.com/javase/6/docs/api/java/security/SecureRandom.html?is-external=true" title="class or interface in java.security"><CODE>SecureRandom</CODE></A> to back this instance.
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</A></CODE> - if the method argument is null</DL>
</DD>
</DL>
<HR>
<A NAME="getDefaultNextBytesSize()"><!-- --></A><H3>
getDefaultNextBytesSize</H3>
<PRE>
public int <A HREF="../../../../src-html/org/apache/shiro/crypto/SecureRandomNumberGenerator.html#line.90"><B>getDefaultNextBytesSize</B></A>()</PRE>
<DL>
<DD>Returns the size of the generated byte array for calls to <A HREF="../../../../org/apache/shiro/crypto/SecureRandomNumberGenerator.html#nextBytes()"><CODE>nextBytes()</CODE></A>. Defaults to
<code>16</code>, which equals 128 bits, a size commonly used in cryptographic algorithms.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>the size of the generated byte array for calls to <A HREF="../../../../org/apache/shiro/crypto/SecureRandomNumberGenerator.html#nextBytes()"><CODE>nextBytes()</CODE></A>.</DL>
</DD>
</DL>
<HR>
<A NAME="setDefaultNextBytesSize(int)"><!-- --></A><H3>
setDefaultNextBytesSize</H3>
<PRE>
public void <A HREF="../../../../src-html/org/apache/shiro/crypto/SecureRandomNumberGenerator.html#line.101"><B>setDefaultNextBytesSize</B></A>(int&nbsp;defaultNextBytesSize)
throws <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</A></PRE>
<DL>
<DD>Sets the size of the generated byte array for calls to <A HREF="../../../../org/apache/shiro/crypto/SecureRandomNumberGenerator.html#nextBytes()"><CODE>nextBytes()</CODE></A>. Defaults to
<code>16</code>, which equals 128 bits, a size commonly used in cryptographic algorithms.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>defaultNextBytesSize</CODE> - the size of the generated byte array for calls to <A HREF="../../../../org/apache/shiro/crypto/SecureRandomNumberGenerator.html#nextBytes()"><CODE>nextBytes()</CODE></A>.
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</A></CODE> - if the argument is 0 or negative</DL>
</DD>
</DL>
<HR>
<A NAME="nextBytes()"><!-- --></A><H3>
nextBytes</H3>
<PRE>
public <A HREF="../../../../org/apache/shiro/util/ByteSource.html" title="interface in org.apache.shiro.util">ByteSource</A> <A HREF="../../../../src-html/org/apache/shiro/crypto/SecureRandomNumberGenerator.html#line.108"><B>nextBytes</B></A>()</PRE>
<DL>
<DD><B>Description copied from interface: <CODE><A HREF="../../../../org/apache/shiro/crypto/RandomNumberGenerator.html#nextBytes()">RandomNumberGenerator</A></CODE></B></DD>
<DD>Generates a byte array of fixed length filled with random data, often useful for generating salts,
initialization vectors or other seed data. The length is specified as a configuration
value on the underlying implementation.
<p/>
If you'd like per-invocation control the number of bytes generated, use the
<A HREF="../../../../org/apache/shiro/crypto/RandomNumberGenerator.html#nextBytes(int)"><CODE>nextBytes(int)</CODE></A> method instead.
<P>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE><A HREF="../../../../org/apache/shiro/crypto/RandomNumberGenerator.html#nextBytes()">nextBytes</A></CODE> in interface <CODE><A HREF="../../../../org/apache/shiro/crypto/RandomNumberGenerator.html" title="interface in org.apache.shiro.crypto">RandomNumberGenerator</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>a byte array of fixed length filled with random data.<DT><B>See Also:</B><DD><A HREF="../../../../org/apache/shiro/crypto/RandomNumberGenerator.html#nextBytes(int)"><CODE>RandomNumberGenerator.nextBytes(int)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="nextBytes(int)"><!-- --></A><H3>
nextBytes</H3>
<PRE>
public <A HREF="../../../../org/apache/shiro/util/ByteSource.html" title="interface in org.apache.shiro.util">ByteSource</A> <A HREF="../../../../src-html/org/apache/shiro/crypto/SecureRandomNumberGenerator.html#line.112"><B>nextBytes</B></A>(int&nbsp;numBytes)</PRE>
<DL>
<DD><B>Description copied from interface: <CODE><A HREF="../../../../org/apache/shiro/crypto/RandomNumberGenerator.html#nextBytes(int)">RandomNumberGenerator</A></CODE></B></DD>
<DD>Generates a byte array of the specified length filled with random data.
<P>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE><A HREF="../../../../org/apache/shiro/crypto/RandomNumberGenerator.html#nextBytes(int)">nextBytes</A></CODE> in interface <CODE><A HREF="../../../../org/apache/shiro/crypto/RandomNumberGenerator.html" title="interface in org.apache.shiro.crypto">RandomNumberGenerator</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>numBytes</CODE> - the number of bytes to be populated with random data.
<DT><B>Returns:</B><DD>a byte array of the specified length filled with random data.<DT><B>See Also:</B><DD><A HREF="../../../../org/apache/shiro/crypto/RandomNumberGenerator.html#nextBytes()"><CODE>RandomNumberGenerator.nextBytes()</CODE></A></DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/SecureRandomNumberGenerator.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../org/apache/shiro/crypto/RandomNumberGenerator.html" title="interface in org.apache.shiro.crypto"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../../org/apache/shiro/crypto/UnknownAlgorithmException.html" title="class in org.apache.shiro.crypto"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?org/apache/shiro/crypto/SecureRandomNumberGenerator.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="SecureRandomNumberGenerator.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
&nbsp;<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
Copyright &#169; 2004-2014 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All Rights Reserved.
</BODY>
</HTML>