Comments (4)
Hi @iosdevninja,
I checked one of my generated certificates and I don't run into this issue. I have attached a screenshot for reference.
My thinking is this is not an issue with this framework but an issue with your code. My reasoning for this is I quickly looked through your code (I don't have much time this week) and see a problem which could be causing your issue. Line 101 of your code you have:
let csrString = csrBuild.base64EncodedString(options: Data.Base64EncodingOptions(rawValue: 0))
This will not work. In iOSCSRSwiftTests.swift, I state this should be:
let csrString = csrBuild.base64EncodedString(options: Data.Base64EncodingOptions(rawValue: 0)).addingPercentEncoding(withAllowedCharacters: CharacterSet.alphanumerics)
The line below should work as well (depending on your swift version):
let csrString = csrBuild.base64EncodedString(options: Data.Base64EncodingOptions(rawValue: 0)).stringByAddingPercentEncodingForFormUrlencoded()!
Encoding incorrectly will definitely cause your CSR to fail.
CSR Decoder and Certificate Decoder.pdf
If there is still an issue, I won't be able to look at it until next week.
Let me know if this solves your problem.
from certificatesigningrequest.
Hello Corey,
Thank you very much for your prompt reply.
I did the code change as you suggested (Swift 3 one)
let csrString = csrBuild.base64EncodedString(options: Data.Base64EncodingOptions(rawValue: 0)).addingPercentEncoding(withAllowedCharacters: CharacterSet.alphanumerics)
and then print out the new generated CSR string.
I am enclosing it as an attachment on this thread.
The problem is it is still NOT working when tested in https://redkestrel.co.uk/products/decoder/
If you check on the new generated CSR now it comes with % values all across the text.
Please provide advice when you have a free moment.
Kind regards
from certificatesigningrequest.
@iosdevninja it appears the encoding line I gave you earlier was still correct. Correcting two lines of your code will fix your problem:
let csrString = csrBuild.base64EncodedString(options: Data.Base64EncodingOptions(rawValue: 0)).addingPercentEncoding(withAllowedCharacters: CharacterSet.urlQueryAllowed)
let formattedCSRString = String(format:"%@%@%@","-----BEGIN CERTIFICATE REQUEST-----\n", csrString!, "\n-----END CERTIFICATE REQUEST-----\n")
I have attached the CSR created using your code. My apologies for the late reply.
If there is still an issue, this string extension seems to encode perfectly:
CSR Decoder and Certificate Decoder.pdf
from certificatesigningrequest.
@iosdevninja I added two methods which encodes the CSR for you:
Full CSR string:
let builtCSR = csr.buildCSRAndReturnString(publicKeyBits, privateKey: privateKey)
CSR without header and footer:
let builtCSR = csr.buildAndEncodeDataAsString(publicKeyBits, privateKey: privateKey)
from certificatesigningrequest.
Related Issues (20)
- Adding Certificate Extensions HOT 11
- Publishing cocoapods library HOT 4
- Invalid signature HOT 8
- Domain=NSOSStatusErrorDomain Code=-50 "Key generation failed HOT 2
- FAILED - CSR has an invalid signature HOT 3
- This is not working on macOS for the given public and private keys HOT 10
- Code=-67808 "RSA signature verification failed, no match" HOT 10
- CSR max linelength, parsing on macOS HOT 26
- CSR key size = 0 when decoding, MacOS HOT 12
- CSR Enhancement HOT 4
- Country field MUST be PRINTABLESTRING HOT 3
- How can we set UID attribute in CSR? HOT 4
- Email should be IA5STRING instead of UTF8STRING HOT 4
- CSR Enhancement : CSR To Self Signed Certificate HOT 4
- Open SSL config HOT 2
- EC key SHA1 oid size mismatch HOT 1
- FAILED - CSR has an invalid signature. Key Size WARNING (0 bits) HOT 1
- Adding Attribute in Certificate HOT 4
- Not really an issue, it's an improvement suggestion HOT 1
- CSR Subject enhancement 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 certificatesigningrequest.