1 Answer
- Newest
- Most votes
- Most comments
0
This issue resolve by overriding the JCE provider method for signature calculation
timeStampToken.getSignedData().setSecurityProvider(new SecurityProvider(authProvider1) {
@Override
public byte[] calculateSignatureFromSignedAttributes(AlgorithmID signatureAlgorithm,
AlgorithmID digestAlgorithm, PrivateKey privateKey, byte[] signedAttributes)
throws NoSuchAlgorithmException, InvalidKeyException, SignatureException {
byte[] sigValue = null;
try {
java.security.Signature signature = Signature.getInstance("SHA256withRSA", CloudHsmProvider.PROVIDER_NAME);
signature.initSign(privateKey);
signature.update(signedAttributes);
sigValue = signature.sign();
} catch (NoSuchProviderException ex) {
throw new SignatureException(ex);
}
}
answered a year ago
Relevant content
- asked a year ago
- asked 3 years ago
- Accepted Answerasked 4 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 4 months ago
- AWS OFFICIALUpdated 11 days ago
I have tested two use cases, creating a self-signed certificate using AWS CloudHsm RSA key it works on EC2 Linux and EC2 Windows Server 2019 both instances. Creating CMS signature failed on EC2 Windows instance and same code working on EC2 Linux instance. Possibly this can be the issue with windows native dll.