【发布时间】:2020-08-06 12:17:44
【问题描述】:
我正在尝试签署 (ITfoxtec Identity SAML2) SAMLRequests 并使用 Auth0 进行测试,但在 Auth0 端出现以下错误:
invalid_request:PEM_read_bio_PUBKEY 失败
我在他们的配置中填写了公钥。
{
"signatureAlgorithm": "rsa-sha256",
"digestAlgorithm": "sha256",
"signingCert": "-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAqt7eddg/N9MgaivTEWif\n...\nnmEbAFKJtjieiwu1JjsMsdUCAwEAAQ==\n-----END PUBLIC KEY-----\n"
}
这是我生成密钥的方式:
openssl req -x509 -sha256 -newkey rsa:4096 -keyout auth0samlprivate.key -out auth0samlpublic.pem -days 3650 -nodes -subj "/CN=mydomain.com"
# then i generate the public key to fill in the configuration of Auth0
openssl x509 -pubkey -noout -in auth0samlpublic.pem > auth0samlpublickey.pem
# then I generate the .pfx file to use server side for the private key
openssl pkcs12 -export -out auth0saml.pfx -inkey auth0samlprivate.key -in auth0samlpublic.cer
然后在代码中:
config.SignAuthnRequest = true;
config.SigningCertificate = CertificateUtil.Load("Path/To/auth0saml.pfx", "myPassword");
在浏览器中,我被重定向到包含签名查询参数的正确 URL,因此它似乎被正确处理但 Auth0 似乎无法读取它。
我错过了什么?我是证书部分的新手。
【问题讨论】:
标签: .net-core certificate auth0 itfoxtec-identity-saml2