Skip to content

Commit

Permalink
doc: add missing throw javadoc in the SRP util classes
Browse files Browse the repository at this point in the history
Signed-off-by: Diego Escalona <[email protected]>
  • Loading branch information
diescalo committed Jul 8, 2019
1 parent c5f2270 commit 38d684b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ private SrpUser(String username, String password, byte[] byte_N, byte[] byte_g)
* Computes and returns A, which is needed to start authentication.
*
* @return Public ephemeral value A.
*
* @throws IOException If there is a problem generating 'byte k' value.
* @throws NoSuchAlgorithmException If the hash algorithm to use does not
* exist.
*/
public byte[] startAuthentication() throws NoSuchAlgorithmException, IOException {
// Reset variables.
Expand Down Expand Up @@ -113,6 +117,10 @@ public byte[] startAuthentication() throws NoSuchAlgorithmException, IOException
*
* @return Proof of session key M1, or {@code null} if the challenge could
* not be processed.
*
* @throws IOException If there is a problem generating any value.
* @throws NoSuchAlgorithmException If the hash algorithm to use does not
* exist.
*/
public byte[] processChallenge(byte[] byte_s, byte[] byte_B) throws NoSuchAlgorithmException, IOException {
BigInteger B = SrpUtils.bigIntegerFromBytes(byte_B);
Expand Down
15 changes: 15 additions & 0 deletions library/src/main/java/com/digi/xbee/api/utils/srp/SrpUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ public static byte[] generateSalt() {
* @param password The user password.
*
* @return A new SRP verifier.
*
* @throws IOException If there is a problem generating the X value.
* @throws NoSuchAlgorithmException If the hash algorithm to use does not
* exist.
*/
public static byte[] generateVerifier(byte[] salt, String password) throws IOException, NoSuchAlgorithmException {
BigInteger x = bigIntegerFromBytes(generateX(salt, SrpConstants.API_USERNAME.getBytes(), password.getBytes()));
Expand All @@ -73,6 +77,10 @@ public static byte[] generateVerifier(byte[] salt, String password) throws IOExc
* @param byte_p Password.
*
* @return The X value.
*
* @throws IOException If there is a problem generating the X value.
* @throws NoSuchAlgorithmException If the hash algorithm to use does not
* exist.
*/
static byte[] generateX(byte[] byte_s, byte[] byte_I, byte[] byte_p) throws NoSuchAlgorithmException, IOException {
byte[] byte_x;
Expand Down Expand Up @@ -107,6 +115,10 @@ static byte[] generateX(byte[] byte_s, byte[] byte_I, byte[] byte_p) throws NoSu
* @param byte_K K as per the SRP spec.
*
* @return The M value.
*
* @throws IOException If there is a problem generating the M value.
* @throws NoSuchAlgorithmException If the hash algorithm to use does not
* exist.
*/
static byte[] generateM(byte[] byte_N, byte[] byte_g, byte[] byte_I, byte[] byte_s,
byte[] byte_A, byte[] byte_B, byte[] byte_K) throws NoSuchAlgorithmException, IOException {
Expand Down Expand Up @@ -136,6 +148,9 @@ static byte[] generateM(byte[] byte_N, byte[] byte_g, byte[] byte_I, byte[] byte
* @param byte_2 Byte array 2.
*
* @return Hashed and xor of the given arrays.
*
* @throws NoSuchAlgorithmException If the hash algorithm to use does not
* exist.
*/
private static byte[] hashXor(byte[] byte_1, byte[] byte_2) throws NoSuchAlgorithmException {
byte[] ret;
Expand Down

0 comments on commit 38d684b

Please sign in to comment.