diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerAeadAes256CbcHmac256Algorithm.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerAeadAes256CbcHmac256Algorithm.java index d32d3806f..becf72a0f 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerAeadAes256CbcHmac256Algorithm.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerAeadAes256CbcHmac256Algorithm.java @@ -99,8 +99,7 @@ byte[] encryptData(byte[] plainText) throws SQLServerException { * @throws SQLServerException */ protected byte[] encryptData(byte[] plainText, boolean hasAuthenticationTag) throws SQLServerException { - aeLogger.entering(SQLServerAeadAes256CbcHmac256Algorithm.class.getName(), - Thread.currentThread().getStackTrace()[1].getMethodName(), "Encrypting data."); + aeLogger.entering(SQLServerAeadAes256CbcHmac256Algorithm.class.getName(), "encryptData", "Encrypting data."); // we will generate this initialization vector based whether // this encryption type is deterministic assert (plainText != null); @@ -181,8 +180,7 @@ protected byte[] encryptData(byte[] plainText, boolean hasAuthenticationTag) thr throw new SQLServerException(this, form.format(msgArgs), null, 0, false); } - aeLogger.exiting(SQLServerAeadAes256CbcHmac256Algorithm.class.getName(), - Thread.currentThread().getStackTrace()[1].getMethodName(), "Data encrypted."); + aeLogger.exiting(SQLServerAeadAes256CbcHmac256Algorithm.class.getName(), "encryptData", "Data encrypted."); return outBuffer; } @@ -190,7 +188,6 @@ protected byte[] encryptData(byte[] plainText, boolean hasAuthenticationTag) thr @Override byte[] decryptData(byte[] cipherText) throws SQLServerException { return decryptData(cipherText, true); - } /** @@ -289,8 +286,7 @@ private byte[] decryptData(byte[] cipherText, boolean hasAuthenticationTag) thro * @throws SQLServerException */ private byte[] decryptData(byte[] iv, byte[] cipherText, int offset, int count) throws SQLServerException { - aeLogger.entering(SQLServerAeadAes256CbcHmac256Algorithm.class.getName(), - Thread.currentThread().getStackTrace()[1].getMethodName(), "Decrypting data."); + aeLogger.entering(SQLServerAeadAes256CbcHmac256Algorithm.class.getName(), "decryptData", "Decrypting data."); assert (cipherText != null); assert (iv != null); byte[] plainText = null; @@ -299,7 +295,6 @@ private byte[] decryptData(byte[] iv, byte[] cipherText, int offset, int count) IvParameterSpec ivector = new IvParameterSpec(iv); Cipher decryptCipher; try { - // AES encryption CBC mode and PKCS5 padding decryptCipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); decryptCipher.init(Cipher.DECRYPT_MODE, skeySpec, ivector); plainText = decryptCipher.doFinal(cipherText, offset, count); @@ -311,8 +306,7 @@ private byte[] decryptData(byte[] iv, byte[] cipherText, int offset, int count) throw new SQLServerException(this, form.format(msgArgs), null, 0, false); } - aeLogger.exiting(SQLServerAeadAes256CbcHmac256Algorithm.class.getName(), - Thread.currentThread().getStackTrace()[1].getMethodName(), "Data decrypted."); + aeLogger.exiting(SQLServerAeadAes256CbcHmac256Algorithm.class.getName(), "decryptData", "Data decrypted."); return plainText; } diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerColumnEncryptionJavaKeyStoreProvider.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerColumnEncryptionJavaKeyStoreProvider.java index b4ee6be76..0b72c58f9 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerColumnEncryptionJavaKeyStoreProvider.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerColumnEncryptionJavaKeyStoreProvider.java @@ -191,7 +191,7 @@ private CertificateDetails getCertificateDetailsByAlias(KeyStore keyStore, Strin public byte[] encryptColumnEncryptionKey(String masterKeyPath, String encryptionAlgorithm, byte[] plainTextColumnEncryptionKey) throws SQLServerException { javaKeyStoreLogger.entering(SQLServerColumnEncryptionJavaKeyStoreProvider.class.getName(), - Thread.currentThread().getStackTrace()[1].getMethodName(), "Encrypting Column Encryption Key."); + "encryptColumnEncryptionKey", "Encrypting Column Encryption Key."); byte[] version = KeyStoreProviderCommon.version; KeyStoreProviderCommon.validateNonEmptyMasterKeyPath(masterKeyPath); @@ -257,7 +257,7 @@ public byte[] encryptColumnEncryptionKey(String masterKeyPath, String encryption System.arraycopy(signedHash, 0, encryptedColumnEncryptionKey, currentIndex, signedHash.length); javaKeyStoreLogger.exiting(SQLServerColumnEncryptionJavaKeyStoreProvider.class.getName(), - Thread.currentThread().getStackTrace()[1].getMethodName(), + "encryptColumnEncryptionKey", "Finished encrypting Column Encryption Key."); return encryptedColumnEncryptionKey;