< prev index next >
src/java.base/share/classes/javax/crypto/KeyAgreement.java
Print this page
@@ -38,28 +38,28 @@
/**
* This class provides the functionality of a key agreement (or key
* exchange) protocol.
* <p>
* The keys involved in establishing a shared secret are created by one of the
- * key generators (<code>KeyPairGenerator</code> or
- * <code>KeyGenerator</code>), a <code>KeyFactory</code>, or as a result from
+ * key generators ({@code KeyPairGenerator} or
+ * {@code KeyGenerator}), a {@code KeyFactory}, or as a result from
* an intermediate phase of the key agreement protocol.
*
- * <p> For each of the correspondents in the key exchange, <code>doPhase</code>
+ * <p> For each of the correspondents in the key exchange, {@code doPhase}
* needs to be called. For example, if this key exchange is with one other
- * party, <code>doPhase</code> needs to be called once, with the
- * <code>lastPhase</code> flag set to <code>true</code>.
+ * party, {@code doPhase} needs to be called once, with the
+ * {@code lastPhase} flag set to {@code true}.
* If this key exchange is
- * with two other parties, <code>doPhase</code> needs to be called twice,
- * the first time setting the <code>lastPhase</code> flag to
- * <code>false</code>, and the second time setting it to <code>true</code>.
+ * with two other parties, {@code doPhase} needs to be called twice,
+ * the first time setting the {@code lastPhase} flag to
+ * {@code false}, and the second time setting it to {@code true}.
* There may be any number of parties involved in a key exchange.
*
* <p> Every implementation of the Java platform is required to support the
- * following standard <code>KeyAgreement</code> algorithm:
+ * following standard {@code KeyAgreement} algorithm:
* <ul>
- * <li><tt>DiffieHellman</tt></li>
+ * <li>{@code DiffieHellman}</li>
* </ul>
* This algorithm is described in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#KeyAgreement">
* KeyAgreement section</a> of the
* Java Cryptography Architecture Standard Algorithm Name Documentation.
@@ -123,24 +123,24 @@
this.algorithm = algorithm;
lock = new Object();
}
/**
- * Returns the algorithm name of this <code>KeyAgreement</code> object.
+ * Returns the algorithm name of this {@code KeyAgreement} object.
*
* <p>This is the same name that was specified in one of the
- * <code>getInstance</code> calls that created this
- * <code>KeyAgreement</code> object.
+ * {@code getInstance} calls that created this
+ * {@code KeyAgreement} object.
*
- * @return the algorithm name of this <code>KeyAgreement</code> object.
+ * @return the algorithm name of this {@code KeyAgreement} object.
*/
public final String getAlgorithm() {
return this.algorithm;
}
/**
- * Returns a <code>KeyAgreement</code> object that implements the
+ * Returns a {@code KeyAgreement} object that implements the
* specified key agreement algorithm.
*
* <p> This method traverses the list of registered security Providers,
* starting with the most preferred Provider.
* A new KeyAgreement object encapsulating the
@@ -155,11 +155,11 @@
* See the KeyAgreement section in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#KeyAgreement">
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
* for information about standard algorithm names.
*
- * @return the new <code>KeyAgreement</code> object.
+ * @return the new {@code KeyAgreement} object.
*
* @exception NullPointerException if the specified algorithm
* is null.
*
* @exception NoSuchAlgorithmException if no Provider supports a
@@ -184,11 +184,11 @@
throw new NoSuchAlgorithmException
("Algorithm " + algorithm + " not available");
}
/**
- * Returns a <code>KeyAgreement</code> object that implements the
+ * Returns a {@code KeyAgreement} object that implements the
* specified key agreement algorithm.
*
* <p> A new KeyAgreement object encapsulating the
* KeyAgreementSpi implementation from the specified provider
* is returned. The specified provider must be registered
@@ -204,11 +204,11 @@
* 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>KeyAgreement</code> object.
+ * @return the new {@code KeyAgreement} object.
*
* @exception NullPointerException if the specified algorithm
* is null.
*
* @exception NoSuchAlgorithmException if a KeyAgreementSpi
@@ -216,11 +216,11 @@
* 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 KeyAgreement getInstance(String algorithm,
@@ -231,11 +231,11 @@
return new KeyAgreement((KeyAgreementSpi)instance.impl,
instance.provider, algorithm);
}
/**
- * Returns a <code>KeyAgreement</code> object that implements the
+ * Returns a {@code KeyAgreement} object that implements the
* specified key agreement algorithm.
*
* <p> A new KeyAgreement object encapsulating the
* KeyAgreementSpi implementation from the specified Provider
* object is returned. Note that the specified Provider object
@@ -248,20 +248,20 @@
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
* for information about standard algorithm names.
*
* @param provider the provider.
*
- * @return the new <code>KeyAgreement</code> object.
+ * @return the new {@code KeyAgreement} object.
*
* @exception NullPointerException if the specified algorithm
* is null.
*
* @exception NoSuchAlgorithmException if a KeyAgreementSpi
* 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 KeyAgreement getInstance(String algorithm,
@@ -406,13 +406,13 @@
+ kName, lastException);
}
}
/**
- * Returns the provider of this <code>KeyAgreement</code> object.
+ * Returns the provider of this {@code KeyAgreement} object.
*
- * @return the provider of this <code>KeyAgreement</code> object
+ * @return the provider of this {@code KeyAgreement} object
*/
public final Provider getProvider() {
chooseFirstProvider();
return this.provider;
}
@@ -445,14 +445,14 @@
* Initializes this key agreement with the given key and source of
* randomness. The given key is required to contain all the algorithm
* parameters required for this key agreement.
*
* <p> If the key agreement algorithm requires random bytes, it gets them
- * from the given source of randomness, <code>random</code>.
+ * from the given source of randomness, {@code random}.
* However, if the underlying
* algorithm implementation does not require any random bytes,
- * <code>random</code> is ignored.
+ * {@code random} is ignored.
*
* @param key the party's private information. For example, in the case
* of the Diffie-Hellman key agreement, this would be the party's own
* Diffie-Hellman private key.
* @param random the source of randomness
@@ -568,13 +568,13 @@
}
/**
* Generates the shared secret and returns it in a new buffer.
*
- * <p>This method resets this <code>KeyAgreement</code> object, so that it
+ * <p>This method resets this {@code KeyAgreement} object, so that it
* can be reused for further key agreements. Unless this key agreement is
- * reinitialized with one of the <code>init</code> methods, the same
+ * reinitialized with one of the {@code init} methods, the same
* private information and algorithm parameters will be used for
* subsequent key agreements.
*
* @return the new buffer with the shared secret
*
@@ -586,27 +586,27 @@
return spi.engineGenerateSecret();
}
/**
* Generates the shared secret, and places it into the buffer
- * <code>sharedSecret</code>, beginning at <code>offset</code> inclusive.
+ * {@code sharedSecret}, beginning at {@code offset} inclusive.
*
- * <p>If the <code>sharedSecret</code> buffer is too small to hold the
- * result, a <code>ShortBufferException</code> is thrown.
+ * <p>If the {@code sharedSecret} buffer is too small to hold the
+ * result, a {@code ShortBufferException} is thrown.
* In this case, this call should be repeated with a larger output buffer.
*
- * <p>This method resets this <code>KeyAgreement</code> object, so that it
+ * <p>This method resets this {@code KeyAgreement} object, so that it
* can be reused for further key agreements. Unless this key agreement is
- * reinitialized with one of the <code>init</code> methods, the same
+ * reinitialized with one of the {@code init} methods, the same
* private information and algorithm parameters will be used for
* subsequent key agreements.
*
* @param sharedSecret the buffer for the shared secret
- * @param offset the offset in <code>sharedSecret</code> where the
+ * @param offset the offset in {@code sharedSecret} where the
* shared secret will be stored
*
- * @return the number of bytes placed into <code>sharedSecret</code>
+ * @return the number of bytes placed into {@code sharedSecret}
*
* @exception IllegalStateException if this key agreement has not been
* completed yet
* @exception ShortBufferException if the given output buffer is too small
* to hold the secret
@@ -617,16 +617,16 @@
chooseFirstProvider();
return spi.engineGenerateSecret(sharedSecret, offset);
}
/**
- * Creates the shared secret and returns it as a <code>SecretKey</code>
+ * Creates the shared secret and returns it as a {@code SecretKey}
* object of the specified algorithm.
*
- * <p>This method resets this <code>KeyAgreement</code> object, so that it
+ * <p>This method resets this {@code KeyAgreement} object, so that it
* can be reused for further key agreements. Unless this key agreement is
- * reinitialized with one of the <code>init</code> methods, the same
+ * reinitialized with one of the {@code init} methods, the same
* private information and algorithm parameters will be used for
* subsequent key agreements.
*
* @param algorithm the requested secret-key algorithm
*
< prev index next >