-
Notifications
You must be signed in to change notification settings - Fork 475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: error:0D0680A8:asn1 encoding routines:asn1_check_tlen:wrong tag #808
Comments
Care to share your earlier passport-saml version? |
tl;dr; at the moment it seems that this issue is caused by user error in configurations. Lets try some guessing what might be wrong but first lets check whether
All tests passed including e.g.
Now guessing part: You mentioned that your old node.js version was In the context of your issue report this means that maybe you had previously used So during the passport-saml update debugging (after you got some error due privateCert not working anymore) you might have copy pasted certs & keys all over the place and it could be possible that content of After few trials of obvious typos it turned out that with this change to test material diff --git a/test/static/testshib encryption pvk.pem b/test/static/testshib encryption pvk.pem
index eebdaa1..add5b49 100644
--- a/test/static/testshib encryption pvk.pem
+++ b/test/static/testshib encryption pvk.pem
@@ -1,4 +1,4 @@
------BEGIN RSA PRIVATE KEY-----
+-----BEGIN PRIVATE KEY-----
MIIJKgIBAAKCAgEA5hqjaroJpB+aR8FME7hQ9nMV0h7MpKtmgFLcK3vwP67feAK+
xdt17i8RyUhxil9FCFR5K08Wjwo3NiHZqHqEKitw+IJSndjLSsoNgKEIaiFSug2e
V1oYElz06DBXTxc8iq/LazndqTUom51Ode9yI9AGa88cDM5iOqq9mhuGuvwuLtoy
@@ -48,4 +48,4 @@ d8HD6ARQhav0TorWKo3IjpWjIqbGJGmEKy5Vq/CFGHbNv6SNi/MUkY81/SkyhkwZ
Dw54gyjiNALCKYfbzUf6L4Ptm05aCK+iZPBKgOwh+bbTrDjkHJB5Ln4I2NdSoThZ
KotlP13Scdq0vxFHqCTKwEJgJJ1Jgh66NwaoXsATOP3WrupwXp8CDob0ECc+RZMb
S/KF7YZXCQa+ggtrMuEV3I0q6S84RD9d3N9j0j9JaMVjA+F1BmoROinAec08Uw==
------END RSA PRIVATE KEY-----
+-----END PRIVATE KEY----- all of the aforementioned tests started to fail with:
Another way to get exactly same error code is to copy paste e.g. base64 encoded public certificate between E.g. with base64 content of
error code. I.e. error code was replicated with this change: diff --git a/test/static/testshib encryption pvk.pem b/test/static/testshib encryption pvk.pem
index eebdaa1..54c5153 100644
--- a/test/static/testshib encryption pvk.pem
+++ b/test/static/testshib encryption pvk.pem
@@ -1,51 +1,14 @@
-----BEGIN RSA PRIVATE KEY-----
-MIIJKgIBAAKCAgEA5hqjaroJpB+aR8FME7hQ9nMV0h7MpKtmgFLcK3vwP67feAK+
-xdt17i8RyUhxil9FCFR5K08Wjwo3NiHZqHqEKitw+IJSndjLSsoNgKEIaiFSug2e
-V1oYElz06DBXTxc8iq/LazndqTUom51Ode9yI9AGa88cDM5iOqq9mhuGuvwuLtoy
-U78Ld+s1Ea6Mgf7L8M7fZVO7Ncu+FgIzI6Gt035ohYCLBmOoM7o0uj7DcMEvKOMF
-ziwF40wYmyp3hCLlq3qwkM9pTVJltuz0Bt1vqDdrq3kTheA9JHMayRz3I/BZxAV3
-iRd4hzLKTkegD8ToTGU10Gme+ZAr1w/erc5hVrM0/XBmHQlnI5d31GU/mfIkm0XP
-TGRSpPy7E+dUvj9djvm/VqDdojf3uuwirGeLMRlO9P/lCerTktW3g27SV8gn3ETm
-2Mm7rkNqf24KJpDv0tKDosgbdaHr2IEYD4RpqySp8kd25BhzushqKRkS8Xu5t7HA
-lVSHwiFhuLqrr4dUfkB8kZeM/ycfZLCn7oNUDFdgjGYSVMpakL97sC9slAW4/8Ut
-XXZxLqcyq/YxdpCysPYP1hsAp+VgPC7GI6CyiNojKPOptMqLZRYnViKxlOiWBJBz
-UBRUVuac8LXrMiDw8btWGa1Gh5vThuFUKsvmRoeuk7eyXEN9J7j6+fTYjnsCAwEA
-AQKCAgBiGVE6Gv4pPl/j34Czl4zMxNu0rPTJ71jPtIOw9jHCtKcI3wK+D4YDeYW3
-rm7ZcyxXFMxjrmALs2s+ZMgKj9DwuXx8NfNK4DYrOGDxSbXwqSw/rbanvv0sNv0i
-UBmo2ls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GHbNv6SNi/MUkY81/SkyhkwZ
-Dw54gyjiNALCKYfbzUf6L4Ptm05aCK+iZPBKgOwh+bbTrDjkHJB5Ln4I2NdSoThZ
-KotlP13Scdq0vxFHqCTKwEJgJJ1Jgh66NwaoXsATOP3WrupwXp8CDob0ECc+RZMb
-S/KF7YZXCQa+ggtrMuEV3I0q6S84RD9d3N9j0j9JaMVjA+F1BmoROinAec08Uw==
+MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA5hqjaroJpB+aR8FME7hQ
+9nMV0h7MpKtmgFLcK3vwP67feAK+xdt17i8RyUhxil9FCFR5K08Wjwo3NiHZqHqE
+Kitw+IJSndjLSsoNgKEIaiFSug2eV1oYElz06DBXTxc8iq/LazndqTUom51Ode9y
+I9AGa88cDM5iOqq9mhuGuvwuLtoyU78Ld+s1Ea6Mgf7L8M7fZVO7Ncu+FgIzI6Gt
+035ohYCLBmOoM7o0uj7DcMEvKOMFziwF40wYmyp3hCLlq3qwkM9pTVJltuz0Bt1v
+qDdrq3kTheA9JHMayRz3I/BZxAV3iRd4hzLKTkegD8ToTGU10Gme+ZAr1w/erc5h
+VrM0/XBmHQlnI5d31GU/mfIkm0XPTGRSpPy7E+dUvj9djvm/VqDdojf3uuwirGeL
+MRlO9P/lCerTktW3g27SV8gn3ETm2Mm7rkNqf24KJpDv0tKDosgbdaHr2IEYD4Rp
+qySp8kd25BhzushqKRkS8Xu5t7HAlVSHwiFhuLqrr4dUfkB8kZeM/ycfZLCn7oNU
+DFdgjGYSVMpakL97sC9slAW4/8UtXXZxLqcyq/YxdpCysPYP1hsAp+VgPC7GI6Cy
+iNojKPOptMqLZRYnViKxlOiWBJBzUBRUVuac8LXrMiDw8btWGa1Gh5vThuFUKsvm
+Roeuk7eyXEN9J7j6+fTYjnsCAwEAAQ==
-----END RSA PRIVATE KEY----- So at the moment it seems that this issue is caused by user error in configurations. |
@srd90, that is some good detective work, thanks. I'll close this pending more information from the end user. |
Receiving error on encrypted SAML Response.
Error: error:0D0680A8:asn1 encoding routines:asn1_check_tlen:wrong tag
at Object.privateDecrypt (node:internal/crypto/cipher:79:12)
at decryptKeyInfoWithScheme (/home/myloft/app/node_modules/xml-encryption/lib/xmlenc.js:258:26)
at decryptKeyInfo (/home/myloft/app/node_modules/xml-encryption/lib/xmlenc.js:246:14)
at Object.decrypt (/home/myloft/app/node_modules/xml-encryption/lib/xmlenc.js:187:24)
at node:internal/util:361:7
at new Promise ()
at Object.decrypt (node:internal/util:347:12)
at decryptXml (/home/myloft/app/node_modules/passport-saml/lib/node-saml/xml.js:39:93)
at SAML.validatePostResponseAsync (/home/myloft/app/node_modules/passport-saml/lib/node-saml/saml.js:591:65)
at runMicrotasks ()
at processTicksAndRejections (node:internal/process/task_queues:96:5)
after upgrading node version from
12.20.0
to16.13.2
and passport-saml to3.2.4
I have decryptionPvk is the same as the previous version with the format start line and end line
-----BEGIN RSA PRIVATE KEY-----
and-----END RSA PRIVATE KEY-----
earlier this was working fine after upgrading to the latest version it stopped working.
To Reproduce
Expected behaviour
Environment
passport-saml
version:The text was updated successfully, but these errors were encountered: