use of org.openecard.crypto.common.sal.did.DidInfo in project open-ecard by ecsec.
the class SmartCardCredentialFactory method removeUnsupportedAlgs.
private List<DidInfo> removeUnsupportedAlgs(List<DidInfo> infos) {
ArrayList<DidInfo> result = new ArrayList<>();
for (DidInfo next : infos) {
try {
AlgorithmInfoType algInfo = next.getGenericCryptoMarker().getAlgorithmInfo();
String algStr = algInfo.getAlgorithmIdentifier().getAlgorithm();
SignatureAlgorithms alg = SignatureAlgorithms.fromAlgId(algStr);
switch(alg) {
case CKM_ECDSA:
// case CKM_ECDSA_SHA1: // too weak
case CKM_ECDSA_SHA256:
case CKM_ECDSA_SHA384:
case CKM_ECDSA_SHA512:
case CKM_RSA_PKCS:
// case CKM_SHA1_RSA_PKCS: // too weak
case CKM_SHA256_RSA_PKCS:
case CKM_SHA384_RSA_PKCS:
case CKM_SHA512_RSA_PKCS:
result.add(next);
}
} catch (UnsupportedAlgorithmException ex) {
LOG.error("Unsupported algorithm used in CIF. Skipping DID " + next.getDidName() + ".", ex);
} catch (WSHelper.WSException ex) {
LOG.error("Unknown error accessing DID " + next.getDidName() + ".", ex);
}
}
return result;
}
Aggregations