Skip to content

Commit

Permalink
Copy non-PEM extension test file in test code instead of shell script
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexTMjugador committed Dec 7, 2024
1 parent 227e617 commit b0c1696
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 29 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ target/
/jsign-gradle-plugin/.gradle
/jsign-gradle-plugin/build
dependency-reduced-pom.xml
/jsign-core/src/test/resources/keystores/privatekey.pkcs1.pem.key

# IntelliJ files
*.iml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ openssl genrsa -aes128 -traditional -passout pass:password -out privatekey-encry
openssl pkcs8 -topk8 -in privatekey-encrypted.pkcs1.pem -out privatekey-encrypted.pkcs8.pem -passin pass:password -passout pass:password -v2 aes128
openssl pkcs8 -topk8 -in privatekey-encrypted.pkcs1.pem -out privatekey.pkcs8.pem -passin pass:password -nocrypt
openssl pkcs8 -traditional -in privatekey.pkcs8.pem -out privatekey.pkcs1.pem -nocrypt
cp privatekey.pkcs1.pem privatekey.pkcs1.pem.key

# Generate the PVK files
# This requires an OpenSSL version with RC4 enabled (works on Debian Stretch)
Expand Down
27 changes: 0 additions & 27 deletions jsign-core/src/test/resources/keystores/privatekey.pkcs1.pem.key

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import java.io.File;
import java.io.FileWriter;
import java.math.BigInteger;
import java.nio.file.Files;
import java.nio.file.Path;
import java.security.KeyException;
import java.security.PrivateKey;
import java.security.interfaces.ECPrivateKey;
Expand Down Expand Up @@ -56,7 +58,10 @@ public void testLoadPKCS1PEM() throws Exception {

@Test
public void testLoadPKCS1PEMNonPEMExtension() throws Exception {
testLoadPEM(new File("target/test-classes/keystores/privatekey.pkcs1.pem.key"), null);
File targetFile = new File("target/test-classes/keystores/privatekey.pkcs1.pem.key");
Files.copy(new File("target/test-classes/keystores/privatekey.pkcs1.pem").toPath(), targetFile.toPath());

testLoadPEM(targetFile, null);
}

@Test
Expand Down

0 comments on commit b0c1696

Please sign in to comment.