It happens that there are many standards for storing cryptography materials (key, certificate, ...) and it isn't always obvious to know which standard is used by just looking at file name extension or file content. There are bunch of questions on stackoverflow asking about how to convert from PEM to PKCS#8 or PKCS#12, while many tried to answer the questions, those answers may not help because the correct answer depends on the content inside the PEM file. That is, a PEM file can contain many different things, such as an X509 certificate, a PKCS#1 or PKCS#8 private key. The worst-case scenario is that someone just store a non-PEM content in "something.pem" file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
adb help // List all comands | |
== Adb Server | |
adb kill-server | |
adb start-server | |
== Adb Reboot | |
adb reboot | |
adb reboot recovery | |
adb reboot-bootloader |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void main(String[] args) throws IOException { | |
File file = new File( "D:\\test images\\8.png" ); | |
long start = System.nanoTime(); | |
ImageCrypto.applyXor(file); | |
long end = System.nanoTime() - start; | |
System.out.printf("Took: %d nanoseconds or %d milliseconds\n", end, (end/1000000)); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
public class ImageCrypto { | |
private static final int XOR_KEY = 345; | |
private static final int BYTE_LENGTH = 512; | |
public static void applyXor( File file ) throws IOException { | |
RandomAccessFile rac = new RandomAccessFile(file, "rw"); | |
byte[] data = new byte[BYTE_LENGTH]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package blog.boydeploy.mimetype; | |
import java.io.File; | |
import java.io.FileNotFoundException; | |
public class Main { | |
public static void main(String... args) throws Exception { | |
printMIME(new File("D:\\CS-KEYBOARD SHORTCUTS.pdf")); | |
printMIME(new File("D:\\1.jpg")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package blog.boydeploy.mimetype; | |
import java.io.File; | |
import java.io.FileNotFoundException; | |
import java.net.FileNameMap; | |
import java.net.URLConnection; | |
import java.util.Objects; | |
public class MimeUtility { |