For excessively paranoid client authentication.
Organization & Common Name: Some human identifier for this server CA.
openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt
| public static boolean available(int port) { | |
| if (port < MIN_PORT_NUMBER || port > MAX_PORT_NUMBER) { | |
| throw new IllegalArgumentException("Invalid start port: " + port); | |
| } | |
| ServerSocket ss = null; | |
| DatagramSocket ds = null; | |
| try { | |
| ss = new ServerSocket(port); | |
| ss.setReuseAddress(true); |
| /** | |
| * Read PEM certificate into javax.security.x509Certificate. | |
| * @param certText | |
| * @return | |
| */ | |
| private X509Certificate readPemCert(String certText) { | |
| CertificateFactory certificateFactory = null; | |
| try { | |
| certificateFactory = CertificateFactory.getInstance("X.509"); |
| RandomAccessFile raf = new RandomAccessFile("certs/client/client.cer.pem", "r"); | |
| byte[] buf = new byte[(int) raf.length()]; | |
| raf.readFully(buf); | |
| raf.close(); |
| /** | |
| * Extract the issuer cert's URI from cert. | |
| * @param var0 | |
| * @return | |
| */ | |
| private URI getIssuerCertURL(X509CertImpl var0) { | |
| AuthorityInfoAccessExtension var1 = var0.getAuthorityInfoAccessExtension(); | |
| if(var1 == null) { | |
| return null; | |
| } else { |
For excessively paranoid client authentication.
Organization & Common Name: Some human identifier for this server CA.
openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt
| //Get file from resources folder | |
| ClassLoader classLoader = getClass().getClassLoader(); | |
| File file = new File(classLoader.getResource("certs/root/ca-key.pkcs8").getFile()); | |
| return readPrivateKey(file.getPath()); |
| # Created by .ignore support plugin (hsz.mobi) | |
| ### JetBrains template | |
| # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm | |
| # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 | |
| ## All items under idea folder | |
| .idea/ | |
| # User-specific stuff: | |
| .idea/workspace.xml | |
| .idea/tasks.xml | |
| .idea/dictionaries |
| <build> | |
| <plugins> | |
| <plugin> | |
| <groupId>org.apache.maven.plugins</groupId> | |
| <artifactId>maven-compiler-plugin</artifactId> | |
| <configuration> | |
| <source>1.6</source> | |
| <target>1.6</target> | |
| </configuration> | |
| </plugin> |
| /** | |
| * Check if valid BASE64 String. | |
| * @param value | |
| * @return | |
| */ | |
| public static boolean checkIfValidBase64(String value){ | |
| return value.matches("^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$"); | |
| } |
| driver.manage().window().setSize(new Dimension(1920,1080)); | |
| driver.get("http://adultimages.org"); | |
| File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE); | |
| // Now you can do whatever you need to do with it, for example copy somewhere | |
| FileUtils.copyFile(scrFile, new File("./screenshot.png")); | |
| driver.close(); |