724 // prepare a list of supported algorithms
725 List<String> algorithms = new ArrayList<>();
726 Set<Provider.Service> services = p.getServices();
727 for (Provider.Service service : services) {
728 if (service.getType().equals(type)
729 && service.getAlgorithm().startsWith(alg)) {
730 algorithms.add(service.getAlgorithm());
731 }
732 }
733 return algorithms;
734 }
735
736 /**
737 * Get the identifier for the operating system distribution
738 */
739 static String getDistro() {
740 return distro;
741 }
742
743 private static String distro() {
744 try (BufferedReader in =
745 new BufferedReader(new InputStreamReader(
746 Runtime.getRuntime().exec("uname -v").getInputStream()))) {
747
748 return in.readLine();
749 } catch (Exception e) {
750 throw new RuntimeException("Failed to determine distro.", e);
751 }
752 }
753
754 static byte[] generateData(int length) {
755 byte data[] = new byte[length];
756 for (int i=0; i<data.length; i++) {
757 data[i] = (byte) (i % 256);
758 }
759 return data;
760 }
761 }
|
724 // prepare a list of supported algorithms
725 List<String> algorithms = new ArrayList<>();
726 Set<Provider.Service> services = p.getServices();
727 for (Provider.Service service : services) {
728 if (service.getType().equals(type)
729 && service.getAlgorithm().startsWith(alg)) {
730 algorithms.add(service.getAlgorithm());
731 }
732 }
733 return algorithms;
734 }
735
736 /**
737 * Get the identifier for the operating system distribution
738 */
739 static String getDistro() {
740 return distro;
741 }
742
743 private static String distro() {
744 if (props.getProperty("os.name").equals("SunOS")) {
745 try (BufferedReader in =
746 new BufferedReader(new InputStreamReader(
747 Runtime.getRuntime().exec("uname -v").getInputStream()))) {
748
749 return in.readLine();
750 } catch (Exception e) {
751 throw new RuntimeException("Failed to determine distro.", e);
752 }
753 } else {
754 // Not used outside Solaris
755 return null;
756 }
757 }
758
759 static byte[] generateData(int length) {
760 byte data[] = new byte[length];
761 for (int i=0; i<data.length; i++) {
762 data[i] = (byte) (i % 256);
763 }
764 return data;
765 }
766 }
|