Skip to content

Commit 38d684b

Browse files
committed
doc: add missing throw javadoc in the SRP util classes
Signed-off-by: Diego Escalona <diego.escalona@digi.com>
1 parent c5f2270 commit 38d684b

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

library/src/main/java/com/digi/xbee/api/utils/srp/SrpUser.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ private SrpUser(String username, String password, byte[] byte_N, byte[] byte_g)
7777
* Computes and returns A, which is needed to start authentication.
7878
*
7979
* @return Public ephemeral value A.
80+
*
81+
* @throws IOException If there is a problem generating 'byte k' value.
82+
* @throws NoSuchAlgorithmException If the hash algorithm to use does not
83+
* exist.
8084
*/
8185
public byte[] startAuthentication() throws NoSuchAlgorithmException, IOException {
8286
// Reset variables.
@@ -113,6 +117,10 @@ public byte[] startAuthentication() throws NoSuchAlgorithmException, IOException
113117
*
114118
* @return Proof of session key M1, or {@code null} if the challenge could
115119
* not be processed.
120+
*
121+
* @throws IOException If there is a problem generating any value.
122+
* @throws NoSuchAlgorithmException If the hash algorithm to use does not
123+
* exist.
116124
*/
117125
public byte[] processChallenge(byte[] byte_s, byte[] byte_B) throws NoSuchAlgorithmException, IOException {
118126
BigInteger B = SrpUtils.bigIntegerFromBytes(byte_B);

library/src/main/java/com/digi/xbee/api/utils/srp/SrpUtils.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ public static byte[] generateSalt() {
5555
* @param password The user password.
5656
*
5757
* @return A new SRP verifier.
58+
*
59+
* @throws IOException If there is a problem generating the X value.
60+
* @throws NoSuchAlgorithmException If the hash algorithm to use does not
61+
* exist.
5862
*/
5963
public static byte[] generateVerifier(byte[] salt, String password) throws IOException, NoSuchAlgorithmException {
6064
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
7377
* @param byte_p Password.
7478
*
7579
* @return The X value.
80+
*
81+
* @throws IOException If there is a problem generating the X value.
82+
* @throws NoSuchAlgorithmException If the hash algorithm to use does not
83+
* exist.
7684
*/
7785
static byte[] generateX(byte[] byte_s, byte[] byte_I, byte[] byte_p) throws NoSuchAlgorithmException, IOException {
7886
byte[] byte_x;
@@ -107,6 +115,10 @@ static byte[] generateX(byte[] byte_s, byte[] byte_I, byte[] byte_p) throws NoSu
107115
* @param byte_K K as per the SRP spec.
108116
*
109117
* @return The M value.
118+
*
119+
* @throws IOException If there is a problem generating the M value.
120+
* @throws NoSuchAlgorithmException If the hash algorithm to use does not
121+
* exist.
110122
*/
111123
static byte[] generateM(byte[] byte_N, byte[] byte_g, byte[] byte_I, byte[] byte_s,
112124
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
136148
* @param byte_2 Byte array 2.
137149
*
138150
* @return Hashed and xor of the given arrays.
151+
*
152+
* @throws NoSuchAlgorithmException If the hash algorithm to use does not
153+
* exist.
139154
*/
140155
private static byte[] hashXor(byte[] byte_1, byte[] byte_2) throws NoSuchAlgorithmException {
141156
byte[] ret;

0 commit comments

Comments
 (0)