Skip to content
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

Crash while creating private key with Base64 string on Linux #38

Closed
Luzanov opened this issue Feb 27, 2019 · 4 comments
Closed

Crash while creating private key with Base64 string on Linux #38

Luzanov opened this issue Feb 27, 2019 · 4 comments
Assignees
Milestone

Comments

@Luzanov
Copy link

Luzanov commented Feb 27, 2019

I removed header and footer lines in my private key file and use:

let privateKey = try CryptorRSA.createPrivateKey(withBase64: base64String)

it works well on Mac OS but on Linux it crashes with error:

Fatal error: Unexpectedly found nil while unwrapping an Optional value

@Andrew-Lees11
Copy link
Contributor

@Luzanov
Would you be able to create a dummy private key and post it here so I can try and recreate the crash?
Alternatively could you ASN1 decode your key here and let me know what structure it has?

@Luzanov
Copy link
Author

Luzanov commented Feb 28, 2019

@Andrew-Lees11 this is my private key without header and footer lines:
MIIJJwIBAAKCAgEAlR5b4qvWa/3OdkN8r4aoPaIdAryPc5hfNHXf7imZQKzU1LfQde+HICPYp1lBBxDPrEIT3QBjo+EX4l/2AiUXagyVfnQKGwy5un93CMdjRmWuqoCQ1KHxaM2Qb9NFvY+5qAqv+vX3Qdy8KK76x1zfectxWPRA1ql/6yJV4US939aZKrv46mUiyAfhmLMNspxe0Q63+qTj2GvHiv3KvR6/7HjwzBq54eU8ivZdK/3i+jlqNGorDhTsHOfDhXzHFTfYLKvA6aLQ6+SrTKHzSD7DfEPTAN5fhdZeWCP4b/EegokCItFZhSj6hVj2+9TFDU5JvOofljJHfXn5bjWGurvn3f3HP/bVGHa5ndDEjUobXatHD9oSNb9+gGQGqITwNB1BMZlH7opJ70oU8UJfqVCXHNMr8EhrEh4G1oZ3AYomFUorS5+DjRLWK8jCbJDRcAlyxa2hI5N9aG23Ilz2u7hlkKdHmmdid+98uc9v9oJi64oNo3Q4wsTE1sYkEXGOmvO7hAIW1InNUhKBiB/aTmeua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RmQZzdVjuppM3V3sx6X9G+Wf6sKftjExD8SvtkZa8DwbV/hx9bsJ/XmiZGPPSRQIEpz1Jg5M2BUmRFogvceZDd6jDkCggEAHJxM8Uk2tdOhoaW3bdz3fMr/fPyMCChJuOExQabLW32Ypr2KC02I/UhFeX1QOcFnd6jdvX9DNk5osVV8mCqzL0jJbr+2qimGEo5iSiqJRW/SXo7NuN73EqEmtii+5m4sb6JWl7cs8hDwOjzIfJVGbJJmDdvz5vp056/adKLi6INN5FjbL1vx8AG0eB3f552FY+bcBhtIeG+o7WuvLMlClkXW4ol8T9VscQdhGQbyfuprI5SozB0t9YvBFkyI4yuIu+cBQdhHmPUdD2YaDaNGAyrJVLAMZkVuEIpLUMAyXrNBma964Xc1M3YvhspvSD4L6bfpYxaHf33ZBUcR9OeGjw==

@Andrew-Lees11
Copy link
Contributor

I have found the bug and raised PR #39 which fixes this case.
Once @billabt reviews it we an look at releasing this fix.

@Andrew-Lees11
Copy link
Contributor

Closing this issue now the fix has been merged in 1.0.25.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants