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

merely suggest phpseclib/phpseclib as a possible dependency, not requ… #39

Closed
wants to merge 3 commits into from
Closed

Conversation

ghost
Copy link

@ghost ghost commented Jul 4, 2015

…ire it. Applications using the JOSE library can require it themselves if they need it

François Kooman added 2 commits July 4, 2015 17:16
…ire it. Applications using the JOSE library can require it themselves if they need it
@ghost
Copy link
Author

ghost commented Jul 5, 2015

Hm... the unit tests break now as they also test phplibsec functionality. Also, with phpseclib the required version of PHP will be lower than 5.4.8 I guess...

@Spomky
Copy link
Contributor

Spomky commented Jul 5, 2015

# composer.json
....,
    "require-dev": {
        "phpseclib/phpseclib": "~0.3"
    },
....

You should also throw exception in case openssl is not available and phpseclib not installed.

@ghost
Copy link
Author

ghost commented Jul 6, 2015

In that situation I think it makes sense to check if the following constants are defined.

    OPENSSL_ALGO_SHA256              2       openssl 5.4.8       5.4.8        
    OPENSSL_ALGO_SHA384              2       openssl 5.4.8       5.4.8        
    OPENSSL_ALGO_SHA512              2       openssl 5.4.8       5.4.8        

These are only available starting PHP 5.4.8. So if you are using a PHP version < 5.4.8 then phpseclib/phpseclib must be used for the RSA signing.

Maybe it makes sense to automatically detect this. So if the constants are defined, use OpenSSL, if not use phpseclib...

@Spomky
Copy link
Contributor

Spomky commented Jul 6, 2015

These are only available starting PHP 5.4.8. So if you are using a PHP version < 5.4.8 then phpseclib/phpseclib must be used for the RSA signing.

No, phpseclib MUST NOT be required because PHP version < 5.4.8.

You just have to check if the openssl extension is loaded or not:

if (!extension_loaded('openssl')) {
    // Check if phpseclib is available (class_exists), else throw an exception.
}

@odino
Copy link
Contributor

odino commented Jul 6, 2015

Agree with @Spomky -- is there any reliable way to test this on travis? I guess we can just moch the method that selects which SSL engine to choose

@cirpo
Copy link
Contributor

cirpo commented Jul 26, 2015

👍 for @Spomky

@odino
Copy link
Contributor

odino commented Aug 3, 2015

closing this for now as it's on hold since a while

@odino odino closed this Aug 3, 2015
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

Successfully merging this pull request may close these issues.

3 participants