1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
5
<!-- Generated by javadoc (build 1.7.0) on Thu Jan 24 21:19:04 GMT-08:00 2008 -->
7
HMAC (dnsjava documentation)
10
<META NAME="date" CONTENT="2008-01-24">
12
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
14
<SCRIPT type="text/javascript">
15
function windowTitle()
17
if (location.href.indexOf('is-external=true') == -1) {
18
parent.document.title="HMAC (dnsjava documentation)";
27
<BODY BGCOLOR="white" onload="windowTitle();">
31
<!-- ========= START OF TOP NAVBAR ======= -->
32
<A NAME="navbar_top"><!-- --></A>
33
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
34
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
36
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
37
<A NAME="navbar_top_firstrow"><!-- --></A>
38
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
39
<TR ALIGN="center" VALIGN="top">
40
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
41
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
42
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
43
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
44
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
45
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
46
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
50
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
56
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
57
<A HREF="../../../../org/xbill/DNS/utils/hexdump.html" title="class in org.xbill.DNS.utils"><B>PREV CLASS</B></A>
58
NEXT CLASS</FONT></TD>
59
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
60
<A HREF="../../../../index.html?org/xbill/DNS/utils/HMAC.html" target="_top"><B>FRAMES</B></A>
61
<A HREF="HMAC.html" target="_top"><B>NO FRAMES</B></A>
62
<SCRIPT type="text/javascript">
65
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
70
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
77
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
78
SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
79
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
80
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
83
<A NAME="skip-navbar_top"></A>
84
<!-- ========= END OF TOP NAVBAR ========= -->
87
<!-- ======== START OF CLASS DATA ======== -->
90
org.xbill.DNS.utils</FONT>
94
<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</A>
95
<IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>org.xbill.DNS.utils.HMAC</B>
99
<DT><PRE>public class <B>HMAC</B><DT>extends <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></DL>
103
A pure java implementation of the HMAC-MD5 secure hash algorithm
108
<DT><B>Author:</B></DT>
109
<DD>Brian Wellington</DD>
115
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
117
<A NAME="constructor_summary"><!-- --></A>
118
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
119
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
120
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
121
<B>Constructor Summary</B></FONT></TH>
123
<TR BGCOLOR="white" CLASS="TableRowColor">
124
<TD><CODE><B><A HREF="../../../../org/xbill/DNS/utils/HMAC.html#HMAC(java.security.MessageDigest, byte[])">HMAC</A></B>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/security/MessageDigest.html?is-external=true" title="class or interface in java.security">MessageDigest</A> digest,
125
byte[] key)</CODE>
128
Creates a new HMAC instance</TD>
130
<TR BGCOLOR="white" CLASS="TableRowColor">
131
<TD><CODE><B><A HREF="../../../../org/xbill/DNS/utils/HMAC.html#HMAC(java.lang.String, byte[])">HMAC</A></B>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> digestName,
132
byte[] key)</CODE>
135
Creates a new HMAC instance</TD>
139
<!-- ========== METHOD SUMMARY =========== -->
141
<A NAME="method_summary"><!-- --></A>
142
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
143
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
144
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
145
<B>Method Summary</B></FONT></TH>
147
<TR BGCOLOR="white" CLASS="TableRowColor">
148
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
149
<CODE> void</CODE></FONT></TD>
150
<TD><CODE><B><A HREF="../../../../org/xbill/DNS/utils/HMAC.html#clear()">clear</A></B>()</CODE>
153
Resets the HMAC object for further use</TD>
155
<TR BGCOLOR="white" CLASS="TableRowColor">
156
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
157
<CODE> byte[]</CODE></FONT></TD>
158
<TD><CODE><B><A HREF="../../../../org/xbill/DNS/utils/HMAC.html#sign()">sign</A></B>()</CODE>
161
Signs the data (computes the secure hash)</TD>
163
<TR BGCOLOR="white" CLASS="TableRowColor">
164
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
165
<CODE> void</CODE></FONT></TD>
166
<TD><CODE><B><A HREF="../../../../org/xbill/DNS/utils/HMAC.html#update(byte[])">update</A></B>(byte[] b)</CODE>
169
Adds data to the current hash</TD>
171
<TR BGCOLOR="white" CLASS="TableRowColor">
172
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
173
<CODE> void</CODE></FONT></TD>
174
<TD><CODE><B><A HREF="../../../../org/xbill/DNS/utils/HMAC.html#update(byte[], int, int)">update</A></B>(byte[] b,
176
int length)</CODE>
179
Adds data to the current hash</TD>
181
<TR BGCOLOR="white" CLASS="TableRowColor">
182
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
183
<CODE> boolean</CODE></FONT></TD>
184
<TD><CODE><B><A HREF="../../../../org/xbill/DNS/utils/HMAC.html#verify(byte[])">verify</A></B>(byte[] signature)</CODE>
187
Verifies the data (computes the secure hash and compares it to the input)</TD>
190
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
191
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
192
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
193
<TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></B></TH>
195
<TR BGCOLOR="white" CLASS="TableRowColor">
196
<TD><CODE><A HREF="http://java.sun.com/j2se/1.4/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/j2se/1.4/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/j2se/1.4/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/j2se/1.4/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/j2se/1.4/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/j2se/1.4/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/j2se/1.4/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/j2se/1.4/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/j2se/1.4/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/j2se/1.4/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/j2se/1.4/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD>
202
<!-- ========= CONSTRUCTOR DETAIL ======== -->
204
<A NAME="constructor_detail"><!-- --></A>
205
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
206
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
207
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
208
<B>Constructor Detail</B></FONT></TH>
212
<A NAME="HMAC(java.security.MessageDigest, byte[])"><!-- --></A><H3>
215
public <B>HMAC</B>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/security/MessageDigest.html?is-external=true" title="class or interface in java.security">MessageDigest</A> digest,
216
byte[] key)</PRE>
218
<DD>Creates a new HMAC instance
221
<DT><B>Parameters:</B><DD><CODE>digest</CODE> - The message digest object.<DD><CODE>key</CODE> - The secret key</DL>
225
<A NAME="HMAC(java.lang.String, byte[])"><!-- --></A><H3>
228
public <B>HMAC</B>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> digestName,
229
byte[] key)</PRE>
231
<DD>Creates a new HMAC instance
234
<DT><B>Parameters:</B><DD><CODE>digestName</CODE> - The name of the message digest function.<DD><CODE>key</CODE> - The secret key.</DL>
237
<!-- ============ METHOD DETAIL ========== -->
239
<A NAME="method_detail"><!-- --></A>
240
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
241
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
242
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
243
<B>Method Detail</B></FONT></TH>
247
<A NAME="update(byte[], int, int)"><!-- --></A><H3>
250
public void <B>update</B>(byte[] b,
252
int length)</PRE>
254
<DD>Adds data to the current hash
257
<DT><B>Parameters:</B><DD><CODE>b</CODE> - The data<DD><CODE>offset</CODE> - The index at which to start adding to the hash<DD><CODE>length</CODE> - The number of bytes to hash</DL>
262
<A NAME="update(byte[])"><!-- --></A><H3>
265
public void <B>update</B>(byte[] b)</PRE>
267
<DD>Adds data to the current hash
270
<DT><B>Parameters:</B><DD><CODE>b</CODE> - The data</DL>
275
<A NAME="sign()"><!-- --></A><H3>
278
public byte[] <B>sign</B>()</PRE>
280
<DD>Signs the data (computes the secure hash)
284
<DT><B>Returns:</B><DD>An array with the signature</DL>
289
<A NAME="verify(byte[])"><!-- --></A><H3>
292
public boolean <B>verify</B>(byte[] signature)</PRE>
294
<DD>Verifies the data (computes the secure hash and compares it to the input)
297
<DT><B>Parameters:</B><DD><CODE>signature</CODE> - The signature to compare against
298
<DT><B>Returns:</B><DD>true if the signature matched, false otherwise</DL>
303
<A NAME="clear()"><!-- --></A><H3>
306
public void <B>clear</B>()</PRE>
308
<DD>Resets the HMAC object for further use
314
<!-- ========= END OF CLASS DATA ========= -->
318
<!-- ======= START OF BOTTOM NAVBAR ====== -->
319
<A NAME="navbar_bottom"><!-- --></A>
320
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
321
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
323
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
324
<A NAME="navbar_bottom_firstrow"><!-- --></A>
325
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
326
<TR ALIGN="center" VALIGN="top">
327
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
328
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
329
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
330
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
331
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
332
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
333
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
337
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
343
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
344
<A HREF="../../../../org/xbill/DNS/utils/hexdump.html" title="class in org.xbill.DNS.utils"><B>PREV CLASS</B></A>
345
NEXT CLASS</FONT></TD>
346
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
347
<A HREF="../../../../index.html?org/xbill/DNS/utils/HMAC.html" target="_top"><B>FRAMES</B></A>
348
<A HREF="HMAC.html" target="_top"><B>NO FRAMES</B></A>
349
<SCRIPT type="text/javascript">
352
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
357
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
364
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
365
SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
366
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
367
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
370
<A NAME="skip-navbar_bottom"></A>
371
<!-- ======== END OF BOTTOM NAVBAR ======= -->