milleruntime commented on code in PR #2935:
URL: https://github.com/apache/accumulo/pull/2935#discussion_r975546130


##########
server/tserver/src/main/java/org/apache/accumulo/tserver/logger/LogReader.java:
##########
@@ -172,6 +187,45 @@ public void execute(String[] args) throws Exception {
     }
   }
 
+  private void printCryptoParams(FSDataInputStream input, Path path) {
+    byte[] magic4 = DfsLogger.LOG_FILE_HEADER_V4.getBytes(UTF_8);
+    byte[] magic3 = DfsLogger.LOG_FILE_HEADER_V3.getBytes(UTF_8);
+    byte[] noCryptoBytes = new NoFileEncrypter().getDecryptionParameters();
+
+    if (magic4.length != magic3.length)
+      throw new AssertionError("Always expect log file headers to be same 
length : " + magic4.length
+          + " != " + magic3.length);
+
+    byte[] magicBuffer = new byte[magic4.length];
+    try {
+      input.readFully(magicBuffer);
+      if (Arrays.equals(magicBuffer, magic4)) {
+        byte[] cryptoParams = CryptoUtils.readParams(input);

Review Comment:
   It would be nice to throw a CryptoException when we are expecting a file to 
be encrypted and get an IOException. I am not sure if this is the best place 
though.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to