Skip to content

Commit

Permalink
Merge pull request #98 from wultra/develop
Browse files Browse the repository at this point in the history
Merge develop to master
  • Loading branch information
banterCZ authored Feb 29, 2024
2 parents 773df1f + f3c9452 commit 0eab1fc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
7 changes: 3 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@

<groupId>com.wultra</groupId>
<artifactId>ssl-pinning-tool</artifactId>
<version>1.6.0</version>
<version>1.7.0</version>
<packaging>jar</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.1.6</version>
<version>3.2.3</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

Expand All @@ -26,7 +26,6 @@
<url>https://wultra.com/</url>
</organization>


<licenses>
<license>
<name>Apache 2.0</name>
Expand Down Expand Up @@ -57,7 +56,7 @@

<properties>
<bcprov-jdk18on.version>1.77</bcprov-jdk18on.version>
<powerauth-crypto.version>1.6.0</powerauth-crypto.version>
<powerauth-crypto.version>1.7.0</powerauth-crypto.version>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.wultra.security.ssl.pinning;

import com.google.common.io.BaseEncoding;
import com.wultra.security.ssl.pinning.errorhandling.SSLPinningException;
import com.wultra.security.ssl.pinning.model.CertificateInfo;
import io.getlime.security.powerauth.crypto.lib.util.SignatureUtils;
Expand All @@ -12,6 +11,7 @@
import java.io.FileWriter;
import java.security.PublicKey;
import java.security.Security;
import java.util.Base64;
import java.util.Scanner;

import static org.junit.jupiter.api.Assertions.*;
Expand Down Expand Up @@ -55,7 +55,7 @@ void testGenerateKeyPairInvalidPassword() {
void testSignatureWithDetails() throws Exception {
CertificateInfo certInfo = app.sign(keyPairFile.getAbsolutePath(), PRIVATE_KEY_PASSWORD,
"www.google.com", "9eed43381cf7d58e4563a951364255fc776707a043542a7b997d27c646ee6fb6", 1540280280L);
byte[] signature = BaseEncoding.base64().decode(certInfo.getSignature());
byte[] signature = Base64.getDecoder().decode(certInfo.getSignature());
PublicKey publicKey = app.exportPublicKey(keyPairFile.getAbsolutePath(), PRIVATE_KEY_PASSWORD);
String payload = "www.google.com&nu1DOBz31Y5FY6lRNkJV/HdnB6BDVCp7mX0nxkbub7Y=&1540280280";
final SignatureUtils utils = new SignatureUtils();
Expand All @@ -69,7 +69,7 @@ void testSignatureWithCertInfo() throws Exception {
certInfoIn.setExpires(1540280280L);
certInfoIn.setFingerprint("9eed43381cf7d58e4563a951364255fc776707a043542a7b997d27c646ee6fb6");
CertificateInfo certInfo = app.sign(keyPairFile.getAbsolutePath(), PRIVATE_KEY_PASSWORD, certInfoIn);
byte[] signature = BaseEncoding.base64().decode(certInfo.getSignature());
byte[] signature = Base64.getDecoder().decode(certInfo.getSignature());
PublicKey publicKey = app.exportPublicKey(keyPairFile.getAbsolutePath(), PRIVATE_KEY_PASSWORD);
String payload = "www.google.com&nu1DOBz31Y5FY6lRNkJV/HdnB6BDVCp7mX0nxkbub7Y=&1540280280";
final SignatureUtils utils = new SignatureUtils();
Expand All @@ -80,7 +80,7 @@ void testSignatureWithCertInfo() throws Exception {
void testReadCertificate() throws Exception {
File cerFile = File.createTempFile("ssl_pinning", ".cer");
FileWriter fw = new FileWriter(cerFile.getAbsolutePath());
fw.write(new String(BaseEncoding.base64().decode(TEST_CERTIFICATE_BASE64)));
fw.write(new String(Base64.getDecoder().decode(TEST_CERTIFICATE_BASE64)));
fw.close();
CertificateInfo certInfo = app.readCertificateInfo(cerFile.getAbsolutePath());
assertEquals("www.google.com", certInfo.getName());
Expand All @@ -94,7 +94,7 @@ void testGenerateJsonFile() throws Exception {
File jsonFile = File.createTempFile("ssl_pinning", ".json");
File cerFile = File.createTempFile("ssl_pinning", ".cer");
FileWriter fw = new FileWriter(cerFile.getAbsolutePath());
fw.write(new String(BaseEncoding.base64().decode(TEST_CERTIFICATE_BASE64)));
fw.write(new String(Base64.getDecoder().decode(TEST_CERTIFICATE_BASE64)));
fw.close();
CertificateInfo certInfoIn = app.readCertificateInfo(cerFile.getAbsolutePath());
CertificateInfo certInfo = app.sign(keyPairFile.getAbsolutePath(), PRIVATE_KEY_PASSWORD, certInfoIn);
Expand Down

0 comments on commit 0eab1fc

Please sign in to comment.