-
-
Notifications
You must be signed in to change notification settings - Fork 10
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
Linux support #40
Linux support #40
Conversation
Hey @dscreve. This is awesome actually, good job. I would say we require a workflow that runs the tests in Linux. I agree with you this probably works on windows and (maybe) on android. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I checked your PR, :) as for now tests need to be updated they are failing building. This just happens because if you removed the SecKey: KeyRepresentable
conformance, if you add the #if canImport(Security)
and not remove the conformances the tests don't need to be fixed to run on Apple platforms.
Even so be aware that the a few tests are failing mainly the RSA
example tests.
} | ||
|
||
#else | ||
return Data((0 ..< count).map { _ in UInt8.random(in: UInt8.min ... UInt8.max) }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to be careful here, UInt8.random
may not be cryptographically secure, this basically depends on the platform, in Linux it may use dev/urandom
or not.
I was checking if CryptoSwift had a secure random implementation for Linux they don't seem to have. Any opinion on this?
If not I would say at least for now we should add this in the documentation as a warning when running on Linux ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/dev/urandom is available on most distribution : I think we can rely on it because if this not present, this a really customised distribution
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool agree with that.
extension SecKey: KeyRepresentable { | ||
public var jwk: JWK { | ||
get throws { | ||
try SecKeyExtended(secKey: self).jwk() | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SecKey
is still a big part of Apple systems, this conformance helps with the adoption of the library.
Instead of deleting the code you need to do this when SecKey is not available (there are a few other places on this PR that this is applicable):
#if canImport(Security)
extension SecKey: KeyRepresentable {
public var jwk: JWK {
get throws {
try SecKeyExtended(secKey: self).jwk()
}
}
}
#else
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will fix this
Hey @dscreve . Ive been checking this and I fixed most of the problems and added a linux workflow so it can be tested, I've also tested on a docker and everything seems to run fine. Can you give me permissions so I can create a PR on your forked repo? There is just as far as I see a remaining issue, the |
I was just working on this and discovered the SWCompression issue as you did....I commit my job and give you permissions. Is there something I have to do to allow you to fork ? |
Since it is a forked repo if you don't mind just on the settings allow me to push. I created a different branch on top of your main I push and you decide. The RSA tests were also failing the way you changed, I added a ci workflow to run the tests in Linux, I want to check what is the problem if there is other way to fix it without using Security framework. |
The RSA failed because you use 1024 RSA keys which is too short. Use 2048 keys and it will work.David ScrèveLe 6 mars 2025 à 19:11, Gonçalo Frade ***@***.***> a écrit :
Is there something I have to do to allow you to fork ?
Since it is a forked repo if you don't mind just on the settings allow me to push. I created a different branch on top of your main I push and you decide.
The RSA tests were also failing the way you changed, I added a ci workflow to run the tests in Linux, I want to check what is the problem if there is other way to fix it without using Security framework.—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
beatt83 left a comment (beatt83/jose-swift#40)
Is there something I have to do to allow you to fork ?
Since it is a forked repo if you don't mind just on the settings allow me to push. I created a different branch on top of your main I push and you decide.
The RSA tests were also failing the way you changed, I added a ci workflow to run the tests in Linux, I want to check what is the problem if there is other way to fix it without using Security framework.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
@dscreve went to check this statement:
It is true but you can use the other init that will accept 1024 So just the if the |
I will work on this tomorrow.David ScrèveLe 6 mars 2025 à 20:46, Gonçalo Frade ***@***.***> a écrit :
@dscreve went to check this statement:
The RSA failed because you use 1024 RSA keys which is too short. Use 2048 keys and it will work.
It is true but you can use the other init that will accept 1024 _RSA.Encryption.PublicKey(unsafeDERRepresentation:) and it will work I changed this on the changes I will push ;)
So just the if the SWCompression issue is fixed and all tests run on linux we can merge ;)—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
beatt83 left a comment (beatt83/jose-swift#40)
@dscreve went to check this statement:
The RSA failed because you use 1024 RSA keys which is too short. Use 2048 keys and it will work.
It is true but you can use the other init that will accept 1024 _RSA.Encryption.PublicKey(unsafeDERRepresentation:) and it will work I changed this on the changes I will push ;)
So just the if the SWCompression issue is fixed and all tests run on linux we can merge ;)
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
I have rewritten zlib compression to be compatible with NSData implementation. |
Hey mate. Also can you give me the push permissions on your fork branch? I would really like to commit my changes on your PR, so we can have the GitHub actions as well. |
How can I do that ? (GitHub PR is a nightmare for me…)David ScrèveLe 8 mars 2025 à 20:07, Gonçalo Frade ***@***.***> a écrit :
I have rewritten zlib compression to be compatible with NSData implementation. This should be ok for now.
Hey mate.
I was checking this in the weekend I left a PR for you on that repo :) .
Also can you give me the push permissions on your fork branch? I would really like to commit my changes on your PR, so we can have the GitHub actions as well.—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
beatt83 left a comment (beatt83/jose-swift#40)
I have rewritten zlib compression to be compatible with NSData implementation. This should be ok for now.
Hey mate.
I was checking this in the weekend I left a PR for you on that repo :) .
Also can you give me the push permissions on your fork branch? I would really like to commit my changes on your PR, so we can have the GitHub actions as well.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
@dscreve you can go to your forked repository -> settings -> collaborators -> add me as a collaborator This will enable me to push a branch and create a pr. Since its a fork repo there is no problem I guess ;) ![]() |
Ok. I’ll do it tomorrow (it’s 22PM here).David ScrèveLe 8 mars 2025 à 21:55, Gonçalo Frade ***@***.***> a écrit :
@dscreve you can go to your forked repository -> settings -> collaborators -> add me as a collaborator beatt83.
This will enable me to push a branch and create a pr.
Since its a fork repo there is no problem I guess ;)
Screenshot.2025-03-08.at.20.52.37.png (view on web)—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
beatt83 left a comment (beatt83/jose-swift#40)
@dscreve you can go to your forked repository -> settings -> collaborators -> add me as a collaborator beatt83.
This will enable me to push a branch and create a pr.
Since its a fork repo there is no problem I guess ;)
Screenshot.2025-03-08.at.20.52.37.png (view on web)
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Same :) U will be off site for a week, so I guess you got time, if I have access during the morning I will do it then ;) . |
Done (also work from phone…)David ScrèveLe 8 mars 2025 à 21:58, David Scrève ***@***.***> a écrit :Ok. I’ll do it tomorrow (it’s 22PM here).David ScrèveLe 8 mars 2025 à 21:55, Gonçalo Frade ***@***.***> a écrit :
@dscreve you can go to your forked repository -> settings -> collaborators -> add me as a collaborator beatt83.
This will enable me to push a branch and create a pr.
Since its a fork repo there is no problem I guess ;)
Screenshot.2025-03-08.at.20.52.37.png (view on web)—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
beatt83 left a comment (beatt83/jose-swift#40)
@dscreve you can go to your forked repository -> settings -> collaborators -> add me as a collaborator beatt83.
This will enable me to push a branch and create a pr.
Since its a fork repo there is no problem I guess ;)
Screenshot.2025-03-08.at.20.52.37.png (view on web)
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Closing this PR since we now have #42 . |
This PR add Linux support and maybe Windows (not tested).