diff --git a/library/src/main/java/com/digi/xbee/api/utils/srp/SrpUser.java b/library/src/main/java/com/digi/xbee/api/utils/srp/SrpUser.java index eb1d7e35..589329a7 100644 --- a/library/src/main/java/com/digi/xbee/api/utils/srp/SrpUser.java +++ b/library/src/main/java/com/digi/xbee/api/utils/srp/SrpUser.java @@ -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. @@ -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); diff --git a/library/src/main/java/com/digi/xbee/api/utils/srp/SrpUtils.java b/library/src/main/java/com/digi/xbee/api/utils/srp/SrpUtils.java index be37bb35..97638ee7 100644 --- a/library/src/main/java/com/digi/xbee/api/utils/srp/SrpUtils.java +++ b/library/src/main/java/com/digi/xbee/api/utils/srp/SrpUtils.java @@ -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())); @@ -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; @@ -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 { @@ -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;