FreePastry/docs/javadoc/rice/p2p/util/SecurityUtils.html
ChronosX88 aaa73fe8b3 Pew
2019-05-13 16:45:05 +04:00

1139 lines
43 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_07) on Fri Mar 13 20:01:31 CET 2009 -->
<TITLE>
SecurityUtils (Rice Pastry - API Specifications)
</TITLE>
<META NAME="date" CONTENT="2009-03-13">
<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="SecurityUtils (Rice Pastry - API Specifications)";
}
}
</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/SecurityUtils.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>
Rice Pastry API</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../rice/p2p/util/ReverseTreeMap.html" title="class in rice.p2p.util"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../rice/p2p/util/SoftHashMap.html" title="class in rice.p2p.util"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../index.html?rice/p2p/util/SecurityUtils.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="SecurityUtils.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;CONSTR&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;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">
rice.p2p.util</FONT>
<BR>
Class SecurityUtils</H2>
<PRE>
java.lang.Object
<IMG SRC="../../../resources/inherit.gif" ALT="extended by "><B>rice.p2p.util.SecurityUtils</B>
</PRE>
<HR>
<DL>
<DT><PRE>public class <B>SecurityUtils</B><DT>extends java.lang.Object</DL>
</PRE>
<P>
This class contains a large number of static methods for performing
security-related primitives, such as encrypt, decrypt, etc...
<P>
<P>
<DL>
<DT><B>Version:</B></DT>
<DD>$Id: SecurityUtils.java 4167 2008-03-28 15:26:37Z jstewart $</DD>
<DT><B>Author:</B></DT>
<DD>amislove</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>static&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rice/p2p/util/SecurityUtils.html#APOP_ALGORITHM">APOP_ALGORITHM</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The name of the apop function.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rice/p2p/util/SecurityUtils.html#ASYMMETRIC_ALGORITHM">ASYMMETRIC_ALGORITHM</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The name of the asymmetric cipher to use.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rice/p2p/util/SecurityUtils.html#ASYMMETRIC_GENERATOR">ASYMMETRIC_GENERATOR</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The name of the asymmetric generator to use.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rice/p2p/util/SecurityUtils.html#DEPRECATED_ASYMMETRIC_ALGORITHM">DEPRECATED_ASYMMETRIC_ALGORITHM</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rice/p2p/util/SecurityUtils.html#HASH_ALGORITHM">HASH_ALGORITHM</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The name of the hash function.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rice/p2p/util/SecurityUtils.html#HMAC_ALGORITHM">HMAC_ALGORITHM</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The name of the hmac function.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rice/p2p/util/SecurityUtils.html#HMAC_IPAD">HMAC_IPAD</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The ipad byte array for use in hmac</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;byte</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rice/p2p/util/SecurityUtils.html#HMAC_IPAD_BYTE">HMAC_IPAD_BYTE</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The ipad of hmac keys, as defined in RFC 2195</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rice/p2p/util/SecurityUtils.html#HMAC_KEY_LENGTH">HMAC_KEY_LENGTH</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The length of hmac keys</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rice/p2p/util/SecurityUtils.html#HMAC_OPAD">HMAC_OPAD</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The opad byte array for use in hmac</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;byte</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rice/p2p/util/SecurityUtils.html#HMAC_OPAD_BYTE">HMAC_OPAD_BYTE</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The opad of hmac keys, as defined in RFC 2195</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rice/p2p/util/SecurityUtils.html#SIGNATURE_ALGORITHM">SIGNATURE_ALGORITHM</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The name of the signature algorithm to use.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rice/p2p/util/SecurityUtils.html#SYMMETRIC_ALGORITHM">SYMMETRIC_ALGORITHM</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The name of the symmetric cipher to use.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rice/p2p/util/SecurityUtils.html#SYMMETRIC_GENERATOR">SYMMETRIC_GENERATOR</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The name of the symmetric cipher to use.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rice/p2p/util/SecurityUtils.html#SYMMETRIC_IV_LENGTH">SYMMETRIC_IV_LENGTH</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The length of the symmetric keys</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rice/p2p/util/SecurityUtils.html#SYMMETRIC_KEY_LENGTH">SYMMETRIC_KEY_LENGTH</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The length of the symmetric keys</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>static&nbsp;byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rice/p2p/util/SecurityUtils.html#apop(byte[], byte[])">apop</A></B>(byte[]&nbsp;challenge,
byte[]&nbsp;password)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Utility method for determining the apop of a challenge and password using a secure hashing
algorithm.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.security.PrivateKey</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rice/p2p/util/SecurityUtils.html#decodePrivateKey(byte[])">decodePrivateKey</A></B>(byte[]&nbsp;data)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Utility method which will decode a previously encoded private key</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.security.PublicKey</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rice/p2p/util/SecurityUtils.html#decodePublicKey(byte[])">decodePublicKey</A></B>(byte[]&nbsp;data)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Utility method which will decode a previously encoded public key</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rice/p2p/util/SecurityUtils.html#decryptAsymmetric(byte[], java.security.PrivateKey)">decryptAsymmetric</A></B>(byte[]&nbsp;data,
java.security.PrivateKey&nbsp;key)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Decrypts the given byte[] using the provided private key.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rice/p2p/util/SecurityUtils.html#decryptSymmetric(byte[], byte[])">decryptSymmetric</A></B>(byte[]&nbsp;data,
byte[]&nbsp;key)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Utility method for decrypting some data with symmetric encryption.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rice/p2p/util/SecurityUtils.html#decryptSymmetric(byte[], byte[], byte[])">decryptSymmetric</A></B>(byte[]&nbsp;data,
byte[]&nbsp;key,
byte[]&nbsp;iv)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Utility method for decrypting some data with symmetric encryption.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.lang.Object</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rice/p2p/util/SecurityUtils.html#deserialize(byte[])">deserialize</A></B>(byte[]&nbsp;data)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Utility method for deserializing an object from a byte[]</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rice/p2p/util/SecurityUtils.html#encodePrivateKey(java.security.PrivateKey)">encodePrivateKey</A></B>(java.security.PrivateKey&nbsp;key)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Utility method which will encode a private key</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rice/p2p/util/SecurityUtils.html#encodePublicKey(java.security.PublicKey)">encodePublicKey</A></B>(java.security.PublicKey&nbsp;key)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Utility method which will encode a public key</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rice/p2p/util/SecurityUtils.html#encryptAsymmetric(byte[], java.security.PublicKey)">encryptAsymmetric</A></B>(byte[]&nbsp;data,
java.security.PublicKey&nbsp;key)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Encrypts the given byte[] using the provided public key.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rice/p2p/util/SecurityUtils.html#encryptSymmetric(byte[], byte[])">encryptSymmetric</A></B>(byte[]&nbsp;data,
byte[]&nbsp;key)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Utility method for encrypting a block of data with symmetric encryption.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rice/p2p/util/SecurityUtils.html#encryptSymmetric(byte[], byte[], byte[])">encryptSymmetric</A></B>(byte[]&nbsp;data,
byte[]&nbsp;key,
byte[]&nbsp;iv)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Utility method for encrypting a block of data with symmetric encryption.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rice/p2p/util/SecurityUtils.html#encryptSymmetric(byte[], byte[], int, int)">encryptSymmetric</A></B>(byte[]&nbsp;data,
byte[]&nbsp;key,
int&nbsp;offset,
int&nbsp;length)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Utility method for encrypting a block of data with symmetric encryption.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rice/p2p/util/SecurityUtils.html#encryptSymmetric(byte[], byte[], int, int, byte[])">encryptSymmetric</A></B>(byte[]&nbsp;data,
byte[]&nbsp;key,
int&nbsp;offset,
int&nbsp;length,
byte[]&nbsp;iv)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Utility method for encrypting a block of data with symmetric encryption.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rice/p2p/util/SecurityUtils.html#generateIVSymmetric()">generateIVSymmetric</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Utility method which will generate a random intialization vector for
applications to use.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.security.KeyPair</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rice/p2p/util/SecurityUtils.html#generateKeyAsymmetric()">generateKeyAsymmetric</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Utility method which will generate a non-weak DES key for applications to
use.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rice/p2p/util/SecurityUtils.html#generateKeySymmetric()">generateKeySymmetric</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Utility method which will generate a non-weak DES key for applications to
use.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rice/p2p/util/SecurityUtils.html#hash(byte[])">hash</A></B>(byte[]&nbsp;input)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Utility method for determining the hash of a byte[] using a secure hashing
algorithm.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rice/p2p/util/SecurityUtils.html#hmac(byte[], byte[])">hmac</A></B>(byte[]&nbsp;key,
byte[]&nbsp;text)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Utility method for determining the hmac of a byte[] and key using a secure hashing
algorithm.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rice/p2p/util/SecurityUtils.html#serialize(java.lang.Object)">serialize</A></B>(java.lang.Object&nbsp;o)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Utility method for serializing an object to a byte[].</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rice/p2p/util/SecurityUtils.html#sign(byte[], java.security.PrivateKey)">sign</A></B>(byte[]&nbsp;data,
java.security.PrivateKey&nbsp;key)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Utility method for signing a block of data with the a private key</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../rice/p2p/util/SecurityUtils.html#verify(byte[], byte[], java.security.PublicKey)">verify</A></B>(byte[]&nbsp;data,
byte[]&nbsp;sig,
java.security.PublicKey&nbsp;key)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Utility method for verifying a signature</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.Object</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</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="ASYMMETRIC_ALGORITHM"><!-- --></A><H3>
ASYMMETRIC_ALGORITHM</H3>
<PRE>
public static final java.lang.String <B>ASYMMETRIC_ALGORITHM</B></PRE>
<DL>
<DD>The name of the asymmetric cipher to use.
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#rice.p2p.util.SecurityUtils.ASYMMETRIC_ALGORITHM">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="DEPRECATED_ASYMMETRIC_ALGORITHM"><!-- --></A><H3>
DEPRECATED_ASYMMETRIC_ALGORITHM</H3>
<PRE>
public static final java.lang.String <B>DEPRECATED_ASYMMETRIC_ALGORITHM</B></PRE>
<DL>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#rice.p2p.util.SecurityUtils.DEPRECATED_ASYMMETRIC_ALGORITHM">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="SYMMETRIC_ALGORITHM"><!-- --></A><H3>
SYMMETRIC_ALGORITHM</H3>
<PRE>
public static final java.lang.String <B>SYMMETRIC_ALGORITHM</B></PRE>
<DL>
<DD>The name of the symmetric cipher to use.
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#rice.p2p.util.SecurityUtils.SYMMETRIC_ALGORITHM">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="ASYMMETRIC_GENERATOR"><!-- --></A><H3>
ASYMMETRIC_GENERATOR</H3>
<PRE>
public static final java.lang.String <B>ASYMMETRIC_GENERATOR</B></PRE>
<DL>
<DD>The name of the asymmetric generator to use.
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#rice.p2p.util.SecurityUtils.ASYMMETRIC_GENERATOR">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="SYMMETRIC_GENERATOR"><!-- --></A><H3>
SYMMETRIC_GENERATOR</H3>
<PRE>
public static final java.lang.String <B>SYMMETRIC_GENERATOR</B></PRE>
<DL>
<DD>The name of the symmetric cipher to use.
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#rice.p2p.util.SecurityUtils.SYMMETRIC_GENERATOR">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="SIGNATURE_ALGORITHM"><!-- --></A><H3>
SIGNATURE_ALGORITHM</H3>
<PRE>
public static final java.lang.String <B>SIGNATURE_ALGORITHM</B></PRE>
<DL>
<DD>The name of the signature algorithm to use.
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#rice.p2p.util.SecurityUtils.SIGNATURE_ALGORITHM">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="SYMMETRIC_KEY_LENGTH"><!-- --></A><H3>
SYMMETRIC_KEY_LENGTH</H3>
<PRE>
public static final int <B>SYMMETRIC_KEY_LENGTH</B></PRE>
<DL>
<DD>The length of the symmetric keys
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#rice.p2p.util.SecurityUtils.SYMMETRIC_KEY_LENGTH">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="SYMMETRIC_IV_LENGTH"><!-- --></A><H3>
SYMMETRIC_IV_LENGTH</H3>
<PRE>
public static final int <B>SYMMETRIC_IV_LENGTH</B></PRE>
<DL>
<DD>The length of the symmetric keys
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#rice.p2p.util.SecurityUtils.SYMMETRIC_IV_LENGTH">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="HASH_ALGORITHM"><!-- --></A><H3>
HASH_ALGORITHM</H3>
<PRE>
public static final java.lang.String <B>HASH_ALGORITHM</B></PRE>
<DL>
<DD>The name of the hash function.
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#rice.p2p.util.SecurityUtils.HASH_ALGORITHM">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="HMAC_ALGORITHM"><!-- --></A><H3>
HMAC_ALGORITHM</H3>
<PRE>
public static final java.lang.String <B>HMAC_ALGORITHM</B></PRE>
<DL>
<DD>The name of the hmac function.
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#rice.p2p.util.SecurityUtils.HMAC_ALGORITHM">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="APOP_ALGORITHM"><!-- --></A><H3>
APOP_ALGORITHM</H3>
<PRE>
public static final java.lang.String <B>APOP_ALGORITHM</B></PRE>
<DL>
<DD>The name of the apop function.
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#rice.p2p.util.SecurityUtils.APOP_ALGORITHM">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="HMAC_KEY_LENGTH"><!-- --></A><H3>
HMAC_KEY_LENGTH</H3>
<PRE>
public static final int <B>HMAC_KEY_LENGTH</B></PRE>
<DL>
<DD>The length of hmac keys
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#rice.p2p.util.SecurityUtils.HMAC_KEY_LENGTH">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="HMAC_IPAD_BYTE"><!-- --></A><H3>
HMAC_IPAD_BYTE</H3>
<PRE>
public static final byte <B>HMAC_IPAD_BYTE</B></PRE>
<DL>
<DD>The ipad of hmac keys, as defined in RFC 2195
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#rice.p2p.util.SecurityUtils.HMAC_IPAD_BYTE">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="HMAC_OPAD_BYTE"><!-- --></A><H3>
HMAC_OPAD_BYTE</H3>
<PRE>
public static final byte <B>HMAC_OPAD_BYTE</B></PRE>
<DL>
<DD>The opad of hmac keys, as defined in RFC 2195
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#rice.p2p.util.SecurityUtils.HMAC_OPAD_BYTE">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="HMAC_IPAD"><!-- --></A><H3>
HMAC_IPAD</H3>
<PRE>
public static final byte[] <B>HMAC_IPAD</B></PRE>
<DL>
<DD>The ipad byte array for use in hmac
<P>
<DL>
</DL>
</DL>
<HR>
<A NAME="HMAC_OPAD"><!-- --></A><H3>
HMAC_OPAD</H3>
<PRE>
public static final byte[] <B>HMAC_OPAD</B></PRE>
<DL>
<DD>The opad byte array for use in hmac
<P>
<DL>
</DL>
</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="serialize(java.lang.Object)"><!-- --></A><H3>
serialize</H3>
<PRE>
public static byte[] <B>serialize</B>(java.lang.Object&nbsp;o)
throws java.io.IOException</PRE>
<DL>
<DD>Utility method for serializing an object to a byte[].
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>o</CODE> - The object to serialize
<DT><B>Returns:</B><DD>The byte[] of the object
<DT><B>Throws:</B>
<DD><CODE>java.io.IOException</CODE> - If serialization does not happen properly</DL>
</DD>
</DL>
<HR>
<A NAME="deserialize(byte[])"><!-- --></A><H3>
deserialize</H3>
<PRE>
public static java.lang.Object <B>deserialize</B>(byte[]&nbsp;data)
throws java.io.IOException,
java.lang.ClassNotFoundException</PRE>
<DL>
<DD>Utility method for deserializing an object from a byte[]
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>data</CODE> - The data to deserialize
<DT><B>Returns:</B><DD>The object
<DT><B>Throws:</B>
<DD><CODE>java.io.IOException</CODE> - If deserialization does not happen properly
<DD><CODE>java.lang.ClassNotFoundException</CODE> - If the deserialized class is not found</DL>
</DD>
</DL>
<HR>
<A NAME="hash(byte[])"><!-- --></A><H3>
hash</H3>
<PRE>
public static byte[] <B>hash</B>(byte[]&nbsp;input)
throws java.lang.SecurityException</PRE>
<DL>
<DD>Utility method for determining the hash of a byte[] using a secure hashing
algorithm.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>input</CODE> - The input
<DT><B>Returns:</B><DD>The hash value
<DT><B>Throws:</B>
<DD><CODE>java.lang.SecurityException</CODE> - If the hashing does not happen properly</DL>
</DD>
</DL>
<HR>
<A NAME="apop(byte[], byte[])"><!-- --></A><H3>
apop</H3>
<PRE>
public static byte[] <B>apop</B>(byte[]&nbsp;challenge,
byte[]&nbsp;password)
throws java.lang.SecurityException</PRE>
<DL>
<DD>Utility method for determining the apop of a challenge and password using a secure hashing
algorithm.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>password</CODE> - The password<DD><CODE>challenge</CODE> - The challengr
<DT><B>Returns:</B><DD>The hash value
<DT><B>Throws:</B>
<DD><CODE>java.lang.SecurityException</CODE> - If the hashing does not happen properly</DL>
</DD>
</DL>
<HR>
<A NAME="hmac(byte[], byte[])"><!-- --></A><H3>
hmac</H3>
<PRE>
public static byte[] <B>hmac</B>(byte[]&nbsp;key,
byte[]&nbsp;text)
throws java.lang.SecurityException</PRE>
<DL>
<DD>Utility method for determining the hmac of a byte[] and key using a secure hashing
algorithm.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>text</CODE> - The text<DD><CODE>key</CODE> - The key
<DT><B>Returns:</B><DD>The hmac value
<DT><B>Throws:</B>
<DD><CODE>java.lang.SecurityException</CODE> - If the hmacing does not happen properly</DL>
</DD>
</DL>
<HR>
<A NAME="encryptSymmetric(byte[], byte[])"><!-- --></A><H3>
encryptSymmetric</H3>
<PRE>
public static byte[] <B>encryptSymmetric</B>(byte[]&nbsp;data,
byte[]&nbsp;key)
throws java.lang.SecurityException</PRE>
<DL>
<DD>Utility method for encrypting a block of data with symmetric encryption.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>data</CODE> - The data<DD><CODE>key</CODE> - The key
<DT><B>Returns:</B><DD>The ciphertext
<DT><B>Throws:</B>
<DD><CODE>java.lang.SecurityException</CODE> - If the encryption does not happen properly</DL>
</DD>
</DL>
<HR>
<A NAME="encryptSymmetric(byte[], byte[], byte[])"><!-- --></A><H3>
encryptSymmetric</H3>
<PRE>
public static byte[] <B>encryptSymmetric</B>(byte[]&nbsp;data,
byte[]&nbsp;key,
byte[]&nbsp;iv)
throws java.lang.SecurityException</PRE>
<DL>
<DD>Utility method for encrypting a block of data with symmetric encryption.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>data</CODE> - The data<DD><CODE>key</CODE> - The key<DD><CODE>iv</CODE> - The initialization vector
<DT><B>Returns:</B><DD>The ciphertext
<DT><B>Throws:</B>
<DD><CODE>java.lang.SecurityException</CODE> - If the encryption does not happen properly</DL>
</DD>
</DL>
<HR>
<A NAME="encryptSymmetric(byte[], byte[], int, int)"><!-- --></A><H3>
encryptSymmetric</H3>
<PRE>
public static byte[] <B>encryptSymmetric</B>(byte[]&nbsp;data,
byte[]&nbsp;key,
int&nbsp;offset,
int&nbsp;length)
throws java.lang.SecurityException</PRE>
<DL>
<DD>Utility method for encrypting a block of data with symmetric encryption.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>data</CODE> - The data<DD><CODE>key</CODE> - The key<DD><CODE>offset</CODE> - The offset into the data<DD><CODE>length</CODE> - The length of data to write<DD><CODE>iv</CODE> - The initialization vector
<DT><B>Returns:</B><DD>The ciphertext
<DT><B>Throws:</B>
<DD><CODE>java.lang.SecurityException</CODE> - If the encryption does not happen properly</DL>
</DD>
</DL>
<HR>
<A NAME="encryptSymmetric(byte[], byte[], int, int, byte[])"><!-- --></A><H3>
encryptSymmetric</H3>
<PRE>
public static byte[] <B>encryptSymmetric</B>(byte[]&nbsp;data,
byte[]&nbsp;key,
int&nbsp;offset,
int&nbsp;length,
byte[]&nbsp;iv)
throws java.lang.SecurityException</PRE>
<DL>
<DD>Utility method for encrypting a block of data with symmetric encryption.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>data</CODE> - The data<DD><CODE>key</CODE> - The key<DD><CODE>offset</CODE> - The offset into the data<DD><CODE>length</CODE> - The length of data to write<DD><CODE>iv</CODE> - The initialization vector
<DT><B>Returns:</B><DD>The ciphertext
<DT><B>Throws:</B>
<DD><CODE>java.lang.SecurityException</CODE> - If the encryption does not happen properly</DL>
</DD>
</DL>
<HR>
<A NAME="decryptSymmetric(byte[], byte[])"><!-- --></A><H3>
decryptSymmetric</H3>
<PRE>
public static byte[] <B>decryptSymmetric</B>(byte[]&nbsp;data,
byte[]&nbsp;key)
throws java.lang.SecurityException</PRE>
<DL>
<DD>Utility method for decrypting some data with symmetric encryption.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>data</CODE> - The data to decrypt<DD><CODE>key</CODE> - The key
<DT><B>Returns:</B><DD>The decrypted data
<DT><B>Throws:</B>
<DD><CODE>java.lang.SecurityException</CODE> - If the decryption does not happen properly</DL>
</DD>
</DL>
<HR>
<A NAME="decryptSymmetric(byte[], byte[], byte[])"><!-- --></A><H3>
decryptSymmetric</H3>
<PRE>
public static byte[] <B>decryptSymmetric</B>(byte[]&nbsp;data,
byte[]&nbsp;key,
byte[]&nbsp;iv)
throws java.lang.SecurityException</PRE>
<DL>
<DD>Utility method for decrypting some data with symmetric encryption.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>data</CODE> - The data to decrypt<DD><CODE>key</CODE> - The key<DD><CODE>iv</CODE> - The initialization vector
<DT><B>Returns:</B><DD>The decrypted data
<DT><B>Throws:</B>
<DD><CODE>java.lang.SecurityException</CODE> - If the decryption does not happen properly</DL>
</DD>
</DL>
<HR>
<A NAME="sign(byte[], java.security.PrivateKey)"><!-- --></A><H3>
sign</H3>
<PRE>
public static byte[] <B>sign</B>(byte[]&nbsp;data,
java.security.PrivateKey&nbsp;key)
throws java.lang.SecurityException</PRE>
<DL>
<DD>Utility method for signing a block of data with the a private key
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>data</CODE> - The data<DD><CODE>key</CODE> - The key to use to sign
<DT><B>Returns:</B><DD>The signature
<DT><B>Throws:</B>
<DD><CODE>java.lang.SecurityException</CODE> - If the signing does not happen properly</DL>
</DD>
</DL>
<HR>
<A NAME="verify(byte[], byte[], java.security.PublicKey)"><!-- --></A><H3>
verify</H3>
<PRE>
public static boolean <B>verify</B>(byte[]&nbsp;data,
byte[]&nbsp;sig,
java.security.PublicKey&nbsp;key)
throws java.lang.SecurityException</PRE>
<DL>
<DD>Utility method for verifying a signature
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>data</CODE> - The data to verify<DD><CODE>sig</CODE> - The proposed signature<DD><CODE>key</CODE> - The key to verify against
<DT><B>Returns:</B><DD>Whether or not the sig matches.
<DT><B>Throws:</B>
<DD><CODE>java.lang.SecurityException</CODE> - If the verification does not happen properly</DL>
</DD>
</DL>
<HR>
<A NAME="encryptAsymmetric(byte[], java.security.PublicKey)"><!-- --></A><H3>
encryptAsymmetric</H3>
<PRE>
public static byte[] <B>encryptAsymmetric</B>(byte[]&nbsp;data,
java.security.PublicKey&nbsp;key)
throws java.lang.SecurityException</PRE>
<DL>
<DD>Encrypts the given byte[] using the provided public key. TO DO: Check
length of input
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>data</CODE> - The data to encrypt<DD><CODE>key</CODE> - The key to encrypt with
<DT><B>Returns:</B><DD>The encrypted data
<DT><B>Throws:</B>
<DD><CODE>java.lang.SecurityException</CODE> - If the encryption does not happen properly</DL>
</DD>
</DL>
<HR>
<A NAME="decryptAsymmetric(byte[], java.security.PrivateKey)"><!-- --></A><H3>
decryptAsymmetric</H3>
<PRE>
public static byte[] <B>decryptAsymmetric</B>(byte[]&nbsp;data,
java.security.PrivateKey&nbsp;key)
throws java.lang.SecurityException</PRE>
<DL>
<DD>Decrypts the given byte[] using the provided private key. TO DO: Check
length of input
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>data</CODE> - The data to decrypt<DD><CODE>key</CODE> - The private key to use
<DT><B>Returns:</B><DD>The decrypted data
<DT><B>Throws:</B>
<DD><CODE>java.lang.SecurityException</CODE> - If the decryption does not happen properly</DL>
</DD>
</DL>
<HR>
<A NAME="generateKeySymmetric()"><!-- --></A><H3>
generateKeySymmetric</H3>
<PRE>
public static byte[] <B>generateKeySymmetric</B>()</PRE>
<DL>
<DD>Utility method which will generate a non-weak DES key for applications to
use.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>A new, random DES key</DL>
</DD>
</DL>
<HR>
<A NAME="encodePublicKey(java.security.PublicKey)"><!-- --></A><H3>
encodePublicKey</H3>
<PRE>
public static byte[] <B>encodePublicKey</B>(java.security.PublicKey&nbsp;key)</PRE>
<DL>
<DD>Utility method which will encode a public key
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>key</CODE> - The key to encode
<DT><B>Returns:</B><DD>An encoded public key</DL>
</DD>
</DL>
<HR>
<A NAME="decodePublicKey(byte[])"><!-- --></A><H3>
decodePublicKey</H3>
<PRE>
public static java.security.PublicKey <B>decodePublicKey</B>(byte[]&nbsp;data)
throws java.lang.SecurityException</PRE>
<DL>
<DD>Utility method which will decode a previously encoded public key
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>data</CODE> - The previously encoded key
<DT><B>Returns:</B><DD>The key
<DT><B>Throws:</B>
<DD><CODE>java.lang.SecurityException</CODE></DL>
</DD>
</DL>
<HR>
<A NAME="encodePrivateKey(java.security.PrivateKey)"><!-- --></A><H3>
encodePrivateKey</H3>
<PRE>
public static byte[] <B>encodePrivateKey</B>(java.security.PrivateKey&nbsp;key)</PRE>
<DL>
<DD>Utility method which will encode a private key
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>key</CODE> - The key to encode
<DT><B>Returns:</B><DD>An encoded public key</DL>
</DD>
</DL>
<HR>
<A NAME="decodePrivateKey(byte[])"><!-- --></A><H3>
decodePrivateKey</H3>
<PRE>
public static java.security.PrivateKey <B>decodePrivateKey</B>(byte[]&nbsp;data)
throws java.lang.SecurityException</PRE>
<DL>
<DD>Utility method which will decode a previously encoded private key
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>data</CODE> - The previously encoded key
<DT><B>Returns:</B><DD>The key
<DT><B>Throws:</B>
<DD><CODE>java.lang.SecurityException</CODE></DL>
</DD>
</DL>
<HR>
<A NAME="generateIVSymmetric()"><!-- --></A><H3>
generateIVSymmetric</H3>
<PRE>
public static byte[] <B>generateIVSymmetric</B>()</PRE>
<DL>
<DD>Utility method which will generate a random intialization vector for
applications to use.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>A new, random DES initialization vector</DL>
</DD>
</DL>
<HR>
<A NAME="generateKeyAsymmetric()"><!-- --></A><H3>
generateKeyAsymmetric</H3>
<PRE>
public static java.security.KeyPair <B>generateKeyAsymmetric</B>()</PRE>
<DL>
<DD>Utility method which will generate a non-weak DES key for applications to
use.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>A new, random DES key</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/SecurityUtils.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>
Rice Pastry API</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../rice/p2p/util/ReverseTreeMap.html" title="class in rice.p2p.util"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../rice/p2p/util/SoftHashMap.html" title="class in rice.p2p.util"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../index.html?rice/p2p/util/SecurityUtils.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="SecurityUtils.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;CONSTR&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;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
<i>Copyright &#169; 2001-2005 - Rice Pastry.</i>
</BODY>
</HTML>