Skip to content

Commit

Permalink
Merge pull request os-autoinst#20940 from ilmanzo/poo175150_javacrypt…
Browse files Browse the repository at this point in the history
…o_no_github

Get java test source from data_url instead of github
  • Loading branch information
ilmanzo authored Jan 13, 2025
2 parents db2d9d3 + ce19395 commit b86f20c
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 4 deletions.
45 changes: 45 additions & 0 deletions data/security/openjdk/JCEProviderInfo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// from https://github.com/ecki/JavaCryptoTest/blob/main/src/main/java/net/eckenfels/test/jce/JCEProviderInfo.java
// package net.eckenfels.test.jce;

import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.Provider;
import java.security.Provider.Service;
import java.security.Security;

public class JCEProviderInfo
{
public static void main(String[] args) throws NoSuchAlgorithmException, NoSuchProviderException
{
System.out.printf("JCE Provider Info: %s %s/%s on %s %s%n", System.getProperty("java.vm.name"),
System.getProperty("java.runtime.version"),
System.getProperty("java.vm.version"),
System.getProperty("os.name"),
System.getProperty("os.version"));

Provider[] ps;
if (args.length > 0)
{
System.out.printf("Searching for JCA Security Providers with filter=\"%s\"%n", args[0]);
ps = Security.getProviders(args[0]);

} else {
System.out.printf("Listing all JCA Security Providers.%n");
ps = (args.length>0)?Security.getProviders(args[0]):Security.getProviders();
}
if (ps == null || ps.length == 0)
{
System.out.printf("No Results.%n");
return;
}
for(Provider p : ps)
{
System.out.printf("--- Provider %s %s%n info %s%n", p.getName(), p.getVersion(), p.getInfo());
for(Service s : p.getServices())
{
System.out.printf(" + %s.%s : %s (%s)%n tostring=%s%n", s.getType(), s.getAlgorithm(), s.getClassName(), s.getProvider().getName(), s.toString());
}
}
}

}
7 changes: 3 additions & 4 deletions lib/openjdktest.pm
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,9 @@ sub configure_java_version {
sub run_crypto_test {
my ($version) = @_;

assert_script_run("cd ~; test -d JavaCryptoTest || git clone -q https://github.com/ecki/JavaCryptoTest");
script_run("cd ~/JavaCryptoTest/src/main/java/");
script_run("javac net/eckenfels/test/jce/JCEProviderInfo.java");
my $crypto = script_output("java -cp ~/JavaCryptoTest/src/main/java/ net.eckenfels.test.jce.JCEProviderInfo");
assert_script_run 'curl -O ' . data_url('security/openjdk/JCEProviderInfo.java');
script_run("javac JCEProviderInfo.java");
my $crypto = script_output("java JCEProviderInfo");
record_info("FAIL", "Cannot list all crypto providers", result => 'fail') if ($crypto !~ /Listing all JCA Security Providers/);

my $JDK_TCHECK = get_var("JDK_TCHECK", "https://gitlab.suse.de/qe-security/testing/-/raw/main/data/openjdk/Tcheck.java");
Expand Down

0 comments on commit b86f20c

Please sign in to comment.