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

Remove mcrypt as a dependency #101

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 30 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,41 @@ sudo: false

language: php

sudo: required
dist: trusty
group: edge

env:
global:
COMPOSER_DISABLE_XDEBUG_WARN=true

cache:
directories:
- $HOME/.composer/cache

matrix:
fast_finish: true
include:
- php: 5.3
- php: 5.4
- php: 5.5
- php: 5.6
env:
- EXECUTE_COVERAGE=true
- php: 7
- php: hhvm
- php: 7.0
- php: 7.1
env: EXECUTE_COVERAGE=true
- php: nightly
- php: hhvm-3.12
env: COMPOSER_INSTALL_FLAGS=--ignore-platform-reqs
- php: hhvm-3.15
env: COMPOSER_INSTALL_FLAGS=--ignore-platform-reqs
- php: hhvm-nightly
env: COMPOSER_INSTALL_FLAGS=--ignore-platform-reqs
allow-failures:
- php: nightly
- php: hhvm-nightly

install:
- travis_retry composer install --prefer-dist $COMPOSER_INSTALL_FLAGS

script:
- if [[ $EXECUTE_COVERAGE == 'true' ]]; then phpunit --coverage-clover clover.xml tests; fi
- if [[ $EXECUTE_COVERAGE != 'true' ]]; then phpunit tests; fi
- if [[ $EXECUTE_COVERAGE == 'true' ]]; then vendor/bin/phpunit --coverage-clover clover.xml; fi
- if [[ $EXECUTE_COVERAGE != 'true' ]]; then vendor/bin/phpunit; fi

after_success:
- if [[ $EXECUTE_COVERAGE == 'true' ]]; then bash <(curl -s https://codecov.io/bash); fi
15 changes: 10 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,16 @@
"RobRichards\\XMLSecLibs\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"RobRichards\\XMLSecLibs\\Tests\\": "tests/src"
}
},
"require": {
"php": ">= 5.3"
},
"suggest": {
"ext-openssl": "OpenSSL extension",
"ext-mcrypt": "MCrypt extension"
"ext-openssl": "*",
"php": ">= 7.0"
},
"require-dev": {
"phpunit/phpunit": "^5.7.4"
}
}
19 changes: 19 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/autoload.php" colors="true">
<testsuites>
<testsuite name="old">
<directory suffix=".phpt">tests/</directory>
</testsuite>
<testsuite name="new">
<directory suffix="Test.php">tests/src/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src/</directory>
</whitelist>
</filter>
<php>
<ini name="date.timezone" value="UTC"/>
</php>
</phpunit>
2 changes: 1 addition & 1 deletion src/XMLSecEnc.php
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ public function encryptKey($srcKey, $rawKey, $append=true)
$this->encKey = $encKey;
}
$encMethod = $encKey->appendChild($this->encdoc->createElementNS(self::XMLENCNS, 'xenc:EncryptionMethod'));
$encMethod->setAttribute('Algorithm', $srcKey->getAlgorith());
$encMethod->setAttribute('Algorithm', $srcKey->getAlgorithm());
Copy link
Author

@skymeyer skymeyer Dec 15, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If master will used to create a new 3.0 release train as is on the table, I suggest we remove the deprecated methods XMLSecurityDSig::generate_GUID and XMLSecurityKey::getAlgorith as well. This is not part of this PR yet.

if (! empty($srcKey->name)) {
$keyInfo = $encKey->appendChild($this->encdoc->createElementNS('http://www.w3.org/2000/09/xmldsig#', 'dsig:KeyInfo'));
$keyInfo->appendChild($this->encdoc->createElementNS('http://www.w3.org/2000/09/xmldsig#', 'dsig:KeyName', $srcKey->name));
Expand Down
2 changes: 1 addition & 1 deletion src/XMLSecurityDSig.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ private function getXPathObj()
*/
public static function generateGUID($prefix='pfx')
{
$uuid = md5(uniqid(mt_rand(), true));
$uuid = bin2hex(random_bytes(16));
$guid = $prefix.substr($uuid, 0, 8)."-".
substr($uuid, 8, 4)."-".
substr($uuid, 12, 4)."-".
Expand Down
Loading