cottonbeckfield / python-csr Goto Github PK
View Code? Open in Web Editor NEWGenerate a CSR/Key via Python
Generate a CSR/Key via Python
python ./csrgen35.py host.domain.com -s host2.domain.com
Enter your Country Name (2 letter code) [US]: US
Enter your State or Province []:California: Maryland
Enter your (Locality Name (eg, city) []:San Francisco: Rockville
Enter your Organization Name (eg, company) []:FTW Enterprise: TestCompany
Enter your Organizational Unit (eg, section) []:IT: IT
Traceback (most recent call last):
File "./csrgen35.py", line 142, in
generateCSR(hostname,sans)
File "./csrgen35.py", line 82, in generateCSR
san_constraint = crypto.X509Extension(b"subjectAltName", False, ss)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/OpenSSL/crypto.py", line 775, in init
extension = _lib.X509V3_EXT_nconf(_ffi.NULL, ctx, type_name, value)
TypeError: initializer for ctype 'char *' must be a bytes or list or tuple, not str
Hello! I needed a script for this and bumped into your code.
I just ported csrgen to Python 3, and added the option to add IP Address SANS to the CSR.
I'd like to create a pull request, but could not create a new branch and push my changes. Can you help me with that?
Thanks!
Diego
When I tried to run for the first time I got
ImportError: No module named OpenSSL
pip install pyOpenSSL
resolved it on Mac OS X,
Perhaps update the README to show python dependencies?
Could you please explain how we could add custom OID extension in this code ?
[root@ip-10-0-0-225 python-csr]# ./csr_tools/csrgen.py -f sample.yaml -u csr.yaml
Enter your Common Name (eg, DNS name) [ip-10-0-0-225]:
Traceback (most recent call last):
File "./csr_tools/csrgen.py", line 406, in
main(sys.argv)
File "./csr_tools/csrgen.py", line 395, in main
cert.generateFromFile(args.file)
AttributeError: Certificate instance has no attribute 'generateFromFile'
I think it would be good if the prompts showed example input, similar to the openssl
Enter your country (2 letter code) [US]:
also, if you don't enter something when prompted current the script errors,
OU = raw_input("Enter your organizational unit: ")
...
req.get_subject().organizationalUnitName = OU
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.