388 lines
16 KiB
HTML

<!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_33) on Fri Aug 22 06:48:06 CEST 2014 -->
<TITLE>
PBKDF2
</TITLE>
<META NAME="date" CONTENT="2014-08-22">
<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="PBKDF2";
}
}
</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/PBKDF2.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-files/index-1.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="../../../../../fr/xephi/authme/security/pbkdf2/MacBasedPRF.html" title="class in fr.xephi.authme.security.pbkdf2"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../../../fr/xephi/authme/security/pbkdf2/PBKDF2Engine.html" title="class in fr.xephi.authme.security.pbkdf2"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../index.html?fr/xephi/authme/security/pbkdf2/PBKDF2.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="PBKDF2.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;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&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">
fr.xephi.authme.security.pbkdf2</FONT>
<BR>
Interface PBKDF2</H2>
<DL>
<DT><B>All Known Implementing Classes:</B> <DD><A HREF="../../../../../fr/xephi/authme/security/pbkdf2/PBKDF2Engine.html" title="class in fr.xephi.authme.security.pbkdf2">PBKDF2Engine</A></DD>
</DL>
<HR>
<DL>
<DT><PRE>public interface <B>PBKDF2</B></DL>
</PRE>
<P>
<p>
A free Java implementation of Password Based Key Derivation Function 2 as
defined by RFC 2898. Copyright (c) 2007 Matthias G&auml;rtner
</p>
<p>
This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free
Software Foundation; either version 2.1 of the License, or (at your option)
any later version.
</p>
<p>
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
details.
</p>
<p>
You should have received a copy of the GNU Lesser General Public License
along with this library; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
</p>
<p>
For Details, see <a
href="http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html"
>http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html</a>.
</p>
<P>
<P>
<DL>
<DT><B>Version:</B></DT>
<DD>1.0</DD>
<DT><B>Author:</B></DT>
<DD>Matthias G&auml;rtner</DD>
</DL>
<HR>
<P>
<!-- ========== 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;byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../fr/xephi/authme/security/pbkdf2/PBKDF2.html#deriveKey(java.lang.String)">deriveKey</A></B>(java.lang.String&nbsp;inputPassword)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Convert String-based input to internal byte array, then invoke PBKDF2.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../fr/xephi/authme/security/pbkdf2/PBKDF2.html#deriveKey(java.lang.String, int)">deriveKey</A></B>(java.lang.String&nbsp;inputPassword,
int&nbsp;dkLen)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Convert String-based input to internal byte array, then invoke PBKDF2.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../../../fr/xephi/authme/security/pbkdf2/PBKDF2Parameters.html" title="class in fr.xephi.authme.security.pbkdf2">PBKDF2Parameters</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../fr/xephi/authme/security/pbkdf2/PBKDF2.html#getParameters()">getParameters</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Allow reading of configured parameters.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../../../fr/xephi/authme/security/pbkdf2/PRF.html" title="interface in fr.xephi.authme.security.pbkdf2">PRF</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../fr/xephi/authme/security/pbkdf2/PBKDF2.html#getPseudoRandomFunction()">getPseudoRandomFunction</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get currently set Pseudo Random Function.</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="../../../../../fr/xephi/authme/security/pbkdf2/PBKDF2.html#setParameters(fr.xephi.authme.security.pbkdf2.PBKDF2Parameters)">setParameters</A></B>(<A HREF="../../../../../fr/xephi/authme/security/pbkdf2/PBKDF2Parameters.html" title="class in fr.xephi.authme.security.pbkdf2">PBKDF2Parameters</A>&nbsp;parameters)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Allow setting of configured parameters.</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="../../../../../fr/xephi/authme/security/pbkdf2/PBKDF2.html#setPseudoRandomFunction(fr.xephi.authme.security.pbkdf2.PRF)">setPseudoRandomFunction</A></B>(<A HREF="../../../../../fr/xephi/authme/security/pbkdf2/PRF.html" title="interface in fr.xephi.authme.security.pbkdf2">PRF</A>&nbsp;prf)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set the Pseudo Random Function to use.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../fr/xephi/authme/security/pbkdf2/PBKDF2.html#verifyKey(java.lang.String)">verifyKey</A></B>(java.lang.String&nbsp;inputPassword)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Convert String-based input to internal byte arrays, then invoke PBKDF2
and verify result against the reference data that is supplied in the
PBKDF2Parameters.</TD>
</TR>
</TABLE>
&nbsp;
<P>
<!-- ============ 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="deriveKey(java.lang.String)"><!-- --></A><H3>
deriveKey</H3>
<PRE>
byte[] <B>deriveKey</B>(java.lang.String&nbsp;inputPassword)</PRE>
<DL>
<DD>Convert String-based input to internal byte array, then invoke PBKDF2.
Desired key length defaults to Pseudo Random Function block size.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>inputPassword</CODE> - Candidate password to compute the derived key for.
<DT><B>Returns:</B><DD>internal byte array</DL>
</DD>
</DL>
<HR>
<A NAME="deriveKey(java.lang.String, int)"><!-- --></A><H3>
deriveKey</H3>
<PRE>
byte[] <B>deriveKey</B>(java.lang.String&nbsp;inputPassword,
int&nbsp;dkLen)</PRE>
<DL>
<DD>Convert String-based input to internal byte array, then invoke PBKDF2.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>inputPassword</CODE> - Candidate password to compute the derived key for.<DD><CODE>dkLen</CODE> - Specify desired key length
<DT><B>Returns:</B><DD>internal byte array</DL>
</DD>
</DL>
<HR>
<A NAME="verifyKey(java.lang.String)"><!-- --></A><H3>
verifyKey</H3>
<PRE>
boolean <B>verifyKey</B>(java.lang.String&nbsp;inputPassword)</PRE>
<DL>
<DD>Convert String-based input to internal byte arrays, then invoke PBKDF2
and verify result against the reference data that is supplied in the
PBKDF2Parameters.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>inputPassword</CODE> - Candidate password to compute the derived key for.
<DT><B>Returns:</B><DD><code>true</code> password match; <code>false</code> incorrect
password</DL>
</DD>
</DL>
<HR>
<A NAME="getParameters()"><!-- --></A><H3>
getParameters</H3>
<PRE>
<A HREF="../../../../../fr/xephi/authme/security/pbkdf2/PBKDF2Parameters.html" title="class in fr.xephi.authme.security.pbkdf2">PBKDF2Parameters</A> <B>getParameters</B>()</PRE>
<DL>
<DD>Allow reading of configured parameters.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>Currently set parameters.</DL>
</DD>
</DL>
<HR>
<A NAME="setParameters(fr.xephi.authme.security.pbkdf2.PBKDF2Parameters)"><!-- --></A><H3>
setParameters</H3>
<PRE>
void <B>setParameters</B>(<A HREF="../../../../../fr/xephi/authme/security/pbkdf2/PBKDF2Parameters.html" title="class in fr.xephi.authme.security.pbkdf2">PBKDF2Parameters</A>&nbsp;parameters)</PRE>
<DL>
<DD>Allow setting of configured parameters.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>parameters</CODE> - </DL>
</DD>
</DL>
<HR>
<A NAME="getPseudoRandomFunction()"><!-- --></A><H3>
getPseudoRandomFunction</H3>
<PRE>
<A HREF="../../../../../fr/xephi/authme/security/pbkdf2/PRF.html" title="interface in fr.xephi.authme.security.pbkdf2">PRF</A> <B>getPseudoRandomFunction</B>()</PRE>
<DL>
<DD>Get currently set Pseudo Random Function.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>Currently set Pseudo Random Function</DL>
</DD>
</DL>
<HR>
<A NAME="setPseudoRandomFunction(fr.xephi.authme.security.pbkdf2.PRF)"><!-- --></A><H3>
setPseudoRandomFunction</H3>
<PRE>
void <B>setPseudoRandomFunction</B>(<A HREF="../../../../../fr/xephi/authme/security/pbkdf2/PRF.html" title="interface in fr.xephi.authme.security.pbkdf2">PRF</A>&nbsp;prf)</PRE>
<DL>
<DD>Set the Pseudo Random Function to use. Note that deriveKeys/getPRF does
init this object using the supplied candidate password. If this is
undesired, one has to override getPRF.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>prf</CODE> - Pseudo Random Function to set.</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/PBKDF2.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-files/index-1.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="../../../../../fr/xephi/authme/security/pbkdf2/MacBasedPRF.html" title="class in fr.xephi.authme.security.pbkdf2"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../../../fr/xephi/authme/security/pbkdf2/PBKDF2Engine.html" title="class in fr.xephi.authme.security.pbkdf2"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../index.html?fr/xephi/authme/security/pbkdf2/PBKDF2.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="PBKDF2.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;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
</BODY>
</HTML>