Skip to content

Instantly share code, notes, and snippets.

@typelogic

typelogic/base64decode.java Secret

Created Oct 23, 2020
Embed
What would you like to do?
base64decode.java
import java.nio.file.Paths;
import java.nio.file.Files;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
public class base64decode {
public static void main(String args[]) throws IOException {
if (args.length == 0) {
System.exit(1);
}
String strBase64 = new String(Files.readAllBytes(Paths.get(args[0])),
StandardCharsets.UTF_8);
byte[] buf = org.apache.commons.codec.binary.Base64.decodeBase64(strBase64);
String str = new String(buf);
System.out.print(str);
}
}
@typelogic

This comment has been minimized.

Copy link
Owner Author

@typelogic typelogic commented Oct 23, 2020

Run by: java -cp /path/to/commons-codec-1.12.jar:. base64decode /path/to/testfile.b64 > /tmp/output.bin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment