Plugin Directory

Changeset 1120688


Ignore:
Timestamp:
03/25/2015 06:27:57 PM (11 years ago)
Author:
briancolinger
Message:

Adding support for openssl signing.
Bumping the plugin version.

Location:
vaultpress/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • vaultpress/trunk/readme.txt

    r1113817 r1120688  
    44Requires at least: 2.9.2
    55Tested up to: 4.2
    6 Stable tag: 1.7.0
     6Stable tag: 1.7.1
    77License: GPLv2
    88
     
    5252
    5353== Changelog ==
     54= 1.7.1 - 25 Mar 2015 =
     55* Added support for openssl signing.
     56
    5457= 1.7.0 - 9 Jan 2015 =
    5558* Added an option to disable calls to php_uname, as some hosts don't allow them.
  • vaultpress/trunk/vaultpress.php

    r1099574 r1120688  
    44 * Plugin URI: http://vaultpress.com/?utm_source=plugin-uri&utm_medium=plugin-description&utm_campaign=1.0
    55 * Description: Protect your content, themes, plugins, and settings with <strong>realtime backup</strong> and <strong>automated security scanning</strong> from <a href="http://vaultpress.com/?utm_source=wp-admin&amp;utm_medium=plugin-description&amp;utm_campaign=1.0" rel="nofollow">VaultPress</a>. Activate, enter your registration key, and never worry again. <a href="http://vaultpress.com/help/?utm_source=wp-admin&amp;utm_medium=plugin-description&amp;utm_campaign=1.0" rel="nofollow">Need some help?</a>
    6  * Version: 1.7.0
     6 * Version: 1.7.1
    77 * Author: Automattic
    88 * Author URI: http://vaultpress.com/?utm_source=author-uri&amp;utm_medium=plugin-description&amp;utm_campaign=1.0
     
    1919    var $option_name    = 'vaultpress';
    2020    var $db_version     = 4;
    21     var $plugin_version = '1.7.0';
     21    var $plugin_version = '1.7.1';
    2222
    2323    function __construct() {
     
    18221822        ksort( $post );
    18231823        $to_sign = serialize( array( 'uri' => $uri, 'post' => $post ) );
     1824
     1825        if ( $this->can_use_openssl() ) {
     1826            $sslsig = '';
     1827            if ( isset( $post['sslsig'] ) ) {
     1828                $sslsig = $post['sslsig'];
     1829                unset( $post['sslsig'] );
     1830            }
     1831            if ( openssl_verify( serialize( array( 'uri' => $uri, 'post' => $post ) ), base64_decode( $sslsig ), $this->get_option( 'public_key' ) ) ) {
     1832                return true;
     1833            } else {
     1834                $__vp_validate_error = array( 'error' => 'invalid_signed_data' );
     1835                return false;
     1836            }
     1837        }
     1838
    18241839        $signature = $this->sign_string( $to_sign, $secret, $sig[1] );
    18251840        if ( $sig[0] === $signature )
     
    19561971    function sign_string( $string, $secret, $salt ) {
    19571972        return hash_hmac( 'sha1', "$string:$salt", $secret );
     1973    }
     1974
     1975    function can_use_openssl() {
     1976        if ( !function_exists( 'openssl_verify' ) )
     1977            return false;
     1978        if ( 1 !== (int) $this->get_option( 'use_openssl_signing' ) )
     1979            return false;
     1980        return true;
    19581981    }
    19591982
Note: See TracChangeset for help on using the changeset viewer.