Comments (2)
CERT_create
returns (cert,key)
and this is also documented.
If you use in in scalar context you will end up with the last entry of the return list, i.e. key
- this is how Perl works. Trying to use the key
within PEM_cert2file
will result in a segmentation fault, because the key is in effect a OpenSSL EV_PKEY*
and using it as an OpenSSL X509*
will crash OpenSSL. While this is not the optimal behavior there is not much I can do about it, since IO::Socket::SSL::Utils just wraps around Net::SSLeay which simply wraps objects around pointers to OpenSSL structures and you have to make sure yourself that you use the right kind of handle at the right place or OpenSSL will crash.
When using it directly inside PEM_cert2file
it will be called in array context, so that the first argument will be the certificate. But the second argument will not be the file name but instead the key, and thus you will end up with the certificate written to a file name with some number (i.e. the value of EV_PKEY*
) and not the name you've intended.
from p5-io-socket-ssl.
Well, it looks like I'm an idiot then! I shouldn't write code and report issues after being awake for 19 hours... The segmentation fault really had me thinking about a problem in the library.
One suggestion I could give is to use wantarray
to return an arrayref in scalar context (and maybe automatically dereference - if necessary - in the subroutines using certificates), to make the errors more explicit. But really, that shouldn't be necessary with someone who carefully reads the documentation.
Sorry for wasting your time, and keep up the good work. Have a good day!
from p5-io-socket-ssl.
Related Issues (20)
- SSL Handshake fails with smtp.office365.com HOT 2
- make test fails HOT 2
- && 'unknown' ? HOT 1
- non-existent function Net::SSLeay::SSL_alert_desc_string_long called in ossl_trace HOT 1
- Prompt user to re-install Net::SSLeay HOT 3
- IO::Socket::SSL issue with https connect and https proxy HOT 1
- Add GitHub Actions HOT 1
- get_fingerprint segfaults HOT 2
- OpenSSL runtime check is too strict for >=openssl-3
- Request for support for Net::SSLeay::get_finished() support HOT 2
- Outdated document about the default SSL_version HOT 2
- Wrong duplicate SSL_WANT_READ check in stop_SSL for sockets in blocking mode
- The ossl_trace debug function may corrupt the value of $! (heisenbug)
- Errors occurring during SSL shutdown in stop_SSL are ignored for blocking sockets
- The SSL error queue isn't cleared when unexpected EOF is encountered during read operation
- Failed test 'Client non-SSL connection' HOT 13
- t/external/ocsp.t fails HOT 1
- Failed test 'Client non-SSL connection' HOT 3
- Using SSL_verify_callback in server mode HOT 2
- Remove README.Win32 file ? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from p5-io-socket-ssl.