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

Does not work on Python 2.7 with javaobj-py3==0.3.0 #47

Open
danpker opened this issue Apr 29, 2019 · 4 comments
Open

Does not work on Python 2.7 with javaobj-py3==0.3.0 #47

danpker opened this issue Apr 29, 2019 · 4 comments

Comments

@danpker
Copy link
Contributor

danpker commented Apr 29, 2019

I'm not sure why this issue is happening but you can replicate it by running the tests on Python 2 with javaobj-py3==0.3.0.

You get the following exception: UnexpectedAlgorithmException: Unexpected algorithm used for encrypting SealedObject: sealAlg=PBEWithMD5AndTripleDES.

Using javaobj-py3==0.2.4 works correctly. This is hard to see because the requirements file in this repo pins that dependancy to 0.2.1, whereas the setup.py file makes no specification.

@mahmoud
Copy link
Collaborator

mahmoud commented Apr 29, 2019

Hey @danpker! This is Interesting.

How far did you have to downgrade to get it working? Shall we open an issue over on javaobj? I see 0.3.0 just came out a couple days ago.

I guess one fix in the meantime would be to change the install_requires to be javaobj-py3<0.3.0.

@danpker
Copy link
Contributor Author

danpker commented Apr 30, 2019

@mahmoud I have got it working on 0.2.4, and fixing it at that version has worked for me. I'm not sure where the root cause of the issue is (whether it is in pyjks or javaobj)

@cory-parr
Copy link

I believe I tracked the source of the problem down to a change they made in 0.3.0:
tcalmant/python-javaobj#26

This causes a comparison failure here:
https://github.com/kurtbrose/pyjks/blob/v18.0.0/jks/jks.py#L303

@mahmoud
Copy link
Collaborator

mahmoud commented Apr 30, 2019

Wow, thank you @cory-parr! That makes perfect sense, very cogent.

Kind of a big change for a minor release, but it's wild times in 0ver-land.

But at least we have a potential second option (other than pinning <0.3.0): maybe we can fix with from __future__ import unicode_literals (or just plain unicode literals, though that can be hard to keep track), then pin to javaobj>=0.3.0.

Any volunteers to test/PR that approach?

kuldeep-mishra added a commit to kuldeep-mishra/pyjks that referenced this issue Jul 4, 2020
In python 2.7.x many issues have occured where comparison between 'JavaString' & 'str' have failed.
kurtbrose#60, kurtbrose#47
type cast sealed_obj.sealAlg which is of type <class 'javaobj.v1.beans.JavaString'> to <type 'str'>
So, that 'String' to 'String' comparison is performed and not 'JavaString' to 'String'
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