summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/uic/barcode/utils
diff options
context:
space:
mode:
authorCGantert345 <57003061+CGantert345@users.noreply.github.com>2022-01-24 16:51:04 +0100
committerCGantert345 <57003061+CGantert345@users.noreply.github.com>2022-01-24 16:51:04 +0100
commit09f0f9449a10b713207126348105fafec4781bed (patch)
tree3e68c5dd9253443baf73de9895e8a57b4dcc52cc /src/main/java/org/uic/barcode/utils
parentnew dynamic header version 2.0.0 (diff)
downloadUIC-barcode-09f0f9449a10b713207126348105fafec4781bed.tar
UIC-barcode-09f0f9449a10b713207126348105fafec4781bed.tar.gz
UIC-barcode-09f0f9449a10b713207126348105fafec4781bed.tar.bz2
UIC-barcode-09f0f9449a10b713207126348105fafec4781bed.tar.lz
UIC-barcode-09f0f9449a10b713207126348105fafec4781bed.tar.xz
UIC-barcode-09f0f9449a10b713207126348105fafec4781bed.tar.zst
UIC-barcode-09f0f9449a10b713207126348105fafec4781bed.zip
Diffstat (limited to 'src/main/java/org/uic/barcode/utils')
-rw-r--r--src/main/java/org/uic/barcode/utils/AlgorithmNameResolver.java37
1 files changed, 35 insertions, 2 deletions
diff --git a/src/main/java/org/uic/barcode/utils/AlgorithmNameResolver.java b/src/main/java/org/uic/barcode/utils/AlgorithmNameResolver.java
index 4491358..a3154f3 100644
--- a/src/main/java/org/uic/barcode/utils/AlgorithmNameResolver.java
+++ b/src/main/java/org/uic/barcode/utils/AlgorithmNameResolver.java
@@ -24,6 +24,26 @@ public class AlgorithmNameResolver {
}
+ public static String getSignatureAlgorithmName (String oid, Provider provider) throws Exception {
+
+ if (provider != null) {
+ Service service = provider.getService(AlgorithmNameResolver.TYPE_SIGNATURE_ALG,oid);
+ return service.getAlgorithm();
+ }
+
+
+ Provider[] provs = Security.getProviders();
+ for (Provider prov : provs) {
+ Service service = prov.getService(AlgorithmNameResolver.TYPE_SIGNATURE_ALG,oid);
+ if (service != null) {
+ return service.getAlgorithm();
+ }
+ }
+ return null;
+
+ }
+
+
public static String getName (String type, String oid) throws Exception {
Provider[] provs = Security.getProviders();
@@ -45,9 +65,22 @@ public class AlgorithmNameResolver {
}
- public static String getName(String type, String oid, Provider prov) throws Exception {
+ public static String getName(String type, String oid, Provider provider) throws Exception {
+
+ Service service = null;
+ if (provider == null) {
+
+ Provider[] provs = Security.getProviders();
+ for (Provider prov : provs) {
+ service = prov.getService(type,oid);
+ }
+
+ } else {
+ service = provider.getService(type,oid);
+ }
+
- Service service = prov.getService(type,oid);
+
if (service != null) {
return service.getAlgorithm();
}