< prev index next >
src/java.base/share/classes/javax/crypto/Mac.java
Print this page
@@ -52,15 +52,15 @@
* referred to as HMAC. HMAC can be used with any cryptographic hash function,
* e.g., MD5 or SHA-1, in combination with a secret shared key. HMAC is
* specified in RFC 2104.
*
* <p> Every implementation of the Java platform is required to support
- * the following standard <code>Mac</code> algorithms:
+ * the following standard {@code Mac} algorithms:
* <ul>
- * <li><tt>HmacMD5</tt></li>
- * <li><tt>HmacSHA1</tt></li>
- * <li><tt>HmacSHA256</tt></li>
+ * <li>{@code HmacMD5}</li>
+ * <li>{@code HmacSHA1}</li>
+ * <li>{@code HmacSHA256}</li>
* </ul>
* These algorithms are described in the
* <a href="{@docRoot}/../technotes/guides/security/StandardNames.html#Mac">
* Mac section</a> of the
* Java Cryptography Architecture Standard Algorithm Name Documentation.
@@ -125,24 +125,24 @@
this.algorithm = algorithm;
lock = new Object();
}
/**
- * Returns the algorithm name of this <code>Mac</code> object.
+ * Returns the algorithm name of this {@code Mac} object.
*
* <p>This is the same name that was specified in one of the
- * <code>getInstance</code> calls that created this
- * <code>Mac</code> object.
+ * {@code getInstance} calls that created this
+ * {@code Mac} object.
*
- * @return the algorithm name of this <code>Mac</code> object.
+ * @return the algorithm name of this {@code Mac} object.
*/
public final String getAlgorithm() {
return this.algorithm;
}
/**
- * Returns a <code>Mac</code> object that implements the
+ * Returns a {@code Mac} object that implements the
* specified MAC algorithm.
*
* <p> This method traverses the list of registered security Providers,
* starting with the most preferred Provider.
* A new Mac object encapsulating the
@@ -156,11 +156,11 @@
* See the Mac section in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#Mac">
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
* for information about standard algorithm names.
*
- * @return the new <code>Mac</code> object.
+ * @return the new {@code Mac} object.
*
* @exception NoSuchAlgorithmException if no Provider supports a
* MacSpi implementation for the
* specified algorithm.
*
@@ -181,11 +181,11 @@
throw new NoSuchAlgorithmException
("Algorithm " + algorithm + " not available");
}
/**
- * Returns a <code>Mac</code> object that implements the
+ * Returns a {@code Mac} object that implements the
* specified MAC algorithm.
*
* <p> A new Mac object encapsulating the
* MacSpi implementation from the specified provider
* is returned. The specified provider must be registered
@@ -200,20 +200,20 @@
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
* for information about standard algorithm names.
*
* @param provider the name of the provider.
*
- * @return the new <code>Mac</code> object.
+ * @return the new {@code Mac} object.
*
* @exception NoSuchAlgorithmException if a MacSpi
* implementation for the specified algorithm is not
* available from the specified provider.
*
* @exception NoSuchProviderException if the specified provider is not
* registered in the security provider list.
*
- * @exception IllegalArgumentException if the <code>provider</code>
+ * @exception IllegalArgumentException if the {@code provider}
* is null or empty.
*
* @see java.security.Provider
*/
public static final Mac getInstance(String algorithm, String provider)
@@ -222,11 +222,11 @@
("Mac", MacSpi.class, algorithm, provider);
return new Mac((MacSpi)instance.impl, instance.provider, algorithm);
}
/**
- * Returns a <code>Mac</code> object that implements the
+ * Returns a {@code Mac} object that implements the
* specified MAC algorithm.
*
* <p> A new Mac object encapsulating the
* MacSpi implementation from the specified Provider
* object is returned. Note that the specified Provider object
@@ -238,17 +238,17 @@
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
* for information about standard algorithm names.
*
* @param provider the provider.
*
- * @return the new <code>Mac</code> object.
+ * @return the new {@code Mac} object.
*
* @exception NoSuchAlgorithmException if a MacSpi
* implementation for the specified algorithm is not available
* from the specified Provider object.
*
- * @exception IllegalArgumentException if the <code>provider</code>
+ * @exception IllegalArgumentException if the {@code provider}
* is null.
*
* @see java.security.Provider
*/
public static final Mac getInstance(String algorithm, Provider provider)
@@ -378,13 +378,13 @@
+ kName, lastException);
}
}
/**
- * Returns the provider of this <code>Mac</code> object.
+ * Returns the provider of this {@code Mac} object.
*
- * @return the provider of this <code>Mac</code> object.
+ * @return the provider of this {@code Mac} object.
*/
public final Provider getProvider() {
chooseFirstProvider();
return this.provider;
}
@@ -398,11 +398,11 @@
chooseFirstProvider();
return spi.engineGetMacLength();
}
/**
- * Initializes this <code>Mac</code> object with the given key.
+ * Initializes this {@code Mac} object with the given key.
*
* @param key the key.
*
* @exception InvalidKeyException if the given key is inappropriate for
* initializing this MAC.
@@ -424,11 +424,11 @@
this.provider.getName());
}
}
/**
- * Initializes this <code>Mac</code> object with the given key and
+ * Initializes this {@code Mac} object with the given key and
* algorithm parameters.
*
* @param key the key.
* @param params the algorithm parameters.
*
@@ -455,11 +455,11 @@
/**
* Processes the given byte.
*
* @param input the input byte to be processed.
*
- * @exception IllegalStateException if this <code>Mac</code> has not been
+ * @exception IllegalStateException if this {@code Mac} has not been
* initialized.
*/
public final void update(byte input) throws IllegalStateException {
chooseFirstProvider();
if (initialized == false) {
@@ -471,11 +471,11 @@
/**
* Processes the given array of bytes.
*
* @param input the array of bytes to be processed.
*
- * @exception IllegalStateException if this <code>Mac</code> has not been
+ * @exception IllegalStateException if this {@code Mac} has not been
* initialized.
*/
public final void update(byte[] input) throws IllegalStateException {
chooseFirstProvider();
if (initialized == false) {
@@ -485,18 +485,18 @@
spi.engineUpdate(input, 0, input.length);
}
}
/**
- * Processes the first <code>len</code> bytes in <code>input</code>,
- * starting at <code>offset</code> inclusive.
+ * Processes the first {@code len} bytes in {@code input},
+ * starting at {@code offset} inclusive.
*
* @param input the input buffer.
- * @param offset the offset in <code>input</code> where the input starts.
+ * @param offset the offset in {@code input} where the input starts.
* @param len the number of bytes to process.
*
- * @exception IllegalStateException if this <code>Mac</code> has not been
+ * @exception IllegalStateException if this {@code Mac} has not been
* initialized.
*/
public final void update(byte[] input, int offset, int len)
throws IllegalStateException {
chooseFirstProvider();
@@ -510,18 +510,18 @@
spi.engineUpdate(input, offset, len);
}
}
/**
- * Processes <code>input.remaining()</code> bytes in the ByteBuffer
- * <code>input</code>, starting at <code>input.position()</code>.
+ * Processes {@code input.remaining()} bytes in the ByteBuffer
+ * {@code input}, starting at {@code input.position()}.
* Upon return, the buffer's position will be equal to its limit;
* its limit will not have changed.
*
* @param input the ByteBuffer
*
- * @exception IllegalStateException if this <code>Mac</code> has not been
+ * @exception IllegalStateException if this {@code Mac} has not been
* initialized.
* @since 1.5
*/
public final void update(ByteBuffer input) {
chooseFirstProvider();
@@ -535,24 +535,24 @@
}
/**
* Finishes the MAC operation.
*
- * <p>A call to this method resets this <code>Mac</code> object to the
+ * <p>A call to this method resets this {@code Mac} object to the
* state it was in when previously initialized via a call to
- * <code>init(Key)</code> or
- * <code>init(Key, AlgorithmParameterSpec)</code>.
+ * {@code init(Key)} or
+ * {@code init(Key, AlgorithmParameterSpec)}.
* That is, the object is reset and available to generate another MAC from
- * the same key, if desired, via new calls to <code>update</code> and
- * <code>doFinal</code>.
- * (In order to reuse this <code>Mac</code> object with a different key,
- * it must be reinitialized via a call to <code>init(Key)</code> or
- * <code>init(Key, AlgorithmParameterSpec)</code>.
+ * the same key, if desired, via new calls to {@code update} and
+ * {@code doFinal}.
+ * (In order to reuse this {@code Mac} object with a different key,
+ * it must be reinitialized via a call to {@code init(Key)} or
+ * {@code init(Key, AlgorithmParameterSpec)}.
*
* @return the MAC result.
*
- * @exception IllegalStateException if this <code>Mac</code> has not been
+ * @exception IllegalStateException if this {@code Mac} has not been
* initialized.
*/
public final byte[] doFinal() throws IllegalStateException {
chooseFirstProvider();
if (initialized == false) {
@@ -564,31 +564,31 @@
}
/**
* Finishes the MAC operation.
*
- * <p>A call to this method resets this <code>Mac</code> object to the
+ * <p>A call to this method resets this {@code Mac} object to the
* state it was in when previously initialized via a call to
- * <code>init(Key)</code> or
- * <code>init(Key, AlgorithmParameterSpec)</code>.
+ * {@code init(Key)} or
+ * {@code init(Key, AlgorithmParameterSpec)}.
* That is, the object is reset and available to generate another MAC from
- * the same key, if desired, via new calls to <code>update</code> and
- * <code>doFinal</code>.
- * (In order to reuse this <code>Mac</code> object with a different key,
- * it must be reinitialized via a call to <code>init(Key)</code> or
- * <code>init(Key, AlgorithmParameterSpec)</code>.
+ * the same key, if desired, via new calls to {@code update} and
+ * {@code doFinal}.
+ * (In order to reuse this {@code Mac} object with a different key,
+ * it must be reinitialized via a call to {@code init(Key)} or
+ * {@code init(Key, AlgorithmParameterSpec)}.
*
- * <p>The MAC result is stored in <code>output</code>, starting at
- * <code>outOffset</code> inclusive.
+ * <p>The MAC result is stored in {@code output}, starting at
+ * {@code outOffset} inclusive.
*
* @param output the buffer where the MAC result is stored
- * @param outOffset the offset in <code>output</code> where the MAC is
+ * @param outOffset the offset in {@code output} where the MAC is
* stored
*
* @exception ShortBufferException if the given output buffer is too small
* to hold the result
- * @exception IllegalStateException if this <code>Mac</code> has not been
+ * @exception IllegalStateException if this {@code Mac} has not been
* initialized.
*/
public final void doFinal(byte[] output, int outOffset)
throws ShortBufferException, IllegalStateException
{
@@ -607,25 +607,25 @@
}
/**
* Processes the given array of bytes and finishes the MAC operation.
*
- * <p>A call to this method resets this <code>Mac</code> object to the
+ * <p>A call to this method resets this {@code Mac} object to the
* state it was in when previously initialized via a call to
- * <code>init(Key)</code> or
- * <code>init(Key, AlgorithmParameterSpec)</code>.
+ * {@code init(Key)} or
+ * {@code init(Key, AlgorithmParameterSpec)}.
* That is, the object is reset and available to generate another MAC from
- * the same key, if desired, via new calls to <code>update</code> and
- * <code>doFinal</code>.
- * (In order to reuse this <code>Mac</code> object with a different key,
- * it must be reinitialized via a call to <code>init(Key)</code> or
- * <code>init(Key, AlgorithmParameterSpec)</code>.
+ * the same key, if desired, via new calls to {@code update} and
+ * {@code doFinal}.
+ * (In order to reuse this {@code Mac} object with a different key,
+ * it must be reinitialized via a call to {@code init(Key)} or
+ * {@code init(Key, AlgorithmParameterSpec)}.
*
* @param input data in bytes
* @return the MAC result.
*
- * @exception IllegalStateException if this <code>Mac</code> has not been
+ * @exception IllegalStateException if this {@code Mac} has not been
* initialized.
*/
public final byte[] doFinal(byte[] input) throws IllegalStateException
{
chooseFirstProvider();
@@ -635,22 +635,22 @@
update(input);
return doFinal();
}
/**
- * Resets this <code>Mac</code> object.
+ * Resets this {@code Mac} object.
*
- * <p>A call to this method resets this <code>Mac</code> object to the
+ * <p>A call to this method resets this {@code Mac} object to the
* state it was in when previously initialized via a call to
- * <code>init(Key)</code> or
- * <code>init(Key, AlgorithmParameterSpec)</code>.
+ * {@code init(Key)} or
+ * {@code init(Key, AlgorithmParameterSpec)}.
* That is, the object is reset and available to generate another MAC from
- * the same key, if desired, via new calls to <code>update</code> and
- * <code>doFinal</code>.
- * (In order to reuse this <code>Mac</code> object with a different key,
- * it must be reinitialized via a call to <code>init(Key)</code> or
- * <code>init(Key, AlgorithmParameterSpec)</code>.
+ * the same key, if desired, via new calls to {@code update} and
+ * {@code doFinal}.
+ * (In order to reuse this {@code Mac} object with a different key,
+ * it must be reinitialized via a call to {@code init(Key)} or
+ * {@code init(Key, AlgorithmParameterSpec)}.
*/
public final void reset() {
chooseFirstProvider();
spi.engineReset();
}
@@ -659,11 +659,11 @@
* Returns a clone if the provider implementation is cloneable.
*
* @return a clone if the provider implementation is cloneable.
*
* @exception CloneNotSupportedException if this is called on a
- * delegate that does not support <code>Cloneable</code>.
+ * delegate that does not support {@code Cloneable}.
*/
public final Object clone() throws CloneNotSupportedException {
chooseFirstProvider();
Mac that = (Mac)super.clone();
that.spi = (MacSpi)this.spi.clone();
< prev index next >