I'm trying to translate the follow Java into its Python equivalent.
// certificate is contents of https://fps.sandbox.amazonaws.com/certs/090909/PKICert.pem
// signature is a string that I need to verify.
CertificateFactory factory = CertificateFactory.getInstance("X.509");
X509Certificate x509Certificate =
(X509Certificate) factory.generateCertificate(new ByteArrayInputStream(certificate.getBytes()));
Signature signatureInstance = Signature.getInstance(signatureAlgorithm);
signatureInstance.initVerify(x509Certificate.getPublicKey());
signatureInstance.update(stringToSign.getBytes(UTF_8_Encoding));
return signatureInstance.verify(Base64.decodeBase64(signature.getBytes()));
This is for the PKI signature verification used by AWS FPS. http://docs.amazonwebservices.com/AmazonFPS/latest/FPSAccountManagementGuide/VerifyingSignature.html
Thanks for your help!