use of org.bouncycastle.crypto.signers.SM2Signer in project xipki by xipki.
the class XiECContentVerifierProviderBuilder method createSigner.
protected Signer createSigner(AlgorithmIdentifier sigAlgId) throws OperatorCreationException {
boolean plainDsa = AlgorithmUtil.isPlainECDSASigAlg(sigAlgId);
if (plainDsa) {
AlgorithmIdentifier digAlg = digestAlgorithmFinder.find(sigAlgId);
Digest dig = digestProvider.get(digAlg);
return new DSAPlainDigestSigner(new ECDSASigner(), dig);
}
boolean sm2 = AlgorithmUtil.isSM2SigAlg(sigAlgId);
if (sm2) {
AlgorithmIdentifier digAlg = digestAlgorithmFinder.find(sigAlgId);
if (GMObjectIdentifiers.sm3.equals(digAlg.getAlgorithm())) {
return new SM2Signer();
} else {
throw new OperatorCreationException("cannot create SM2 signer for hash algorithm " + digAlg.getAlgorithm().getId());
}
}
return super.createSigner(sigAlgId);
}
Aggregations