Skip to content

Commit

Permalink
Edited method comments
Browse files Browse the repository at this point in the history
  • Loading branch information
tkyc committed Nov 17, 2022
1 parent 8ac0645 commit 80095e6
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/main/java/com/microsoft/sqlserver/jdbc/SecureStringUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,14 @@ private SecureStringUtil() throws SQLServerException {
* @return encrypted string
*
* @throws SQLServerException
* if error
* Throws an exception if the method fails to encrypt the character array
*/
byte[] getEncryptedBytes(char[] chars) throws SQLServerException {
ENCRYPT_LOCK.lock();
try {
if (chars == null)
if (chars == null) {
return null;
}

byte[] iv = new byte[IV_LENGTH];
SecureRandom random = new SecureRandom();
Expand All @@ -135,17 +136,20 @@ byte[] getEncryptedBytes(char[] chars) throws SQLServerException {
* Get decrypted value of an encrypted string
*
* @param bytes
* The byte array to decrypt into a character array
*
* @return decrypted string
*
* @throws SQLServerException
* Throws an exception if the method fails to decrypt the byte array
*/
char[] getDecryptedChars(byte[] bytes) throws SQLServerException {
DECRYPT_LOCK.lock();
byte[] plainText = null;
try {
if (bytes == null)
if (bytes == null) {
return null;
}

byte[] iv = new byte[IV_LENGTH];
System.arraycopy(bytes, 0, iv, 0, IV_LENGTH);
Expand Down

0 comments on commit 80095e6

Please sign in to comment.