Subversion Repositories php_utils

Rev

Rev 5 | Rev 22 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5 Rev 10
Line 1... Line 1...
1
<?php
1
<?php
2
 
2
 
3
/*
3
/*
4
 * X.509 Utilities for PHP
4
 * X.509 Utilities for PHP
5
 * Copyright 2011-2014 Daniel Marschall, ViaThinkSoft
5
 * Copyright 2011-2021 Daniel Marschall, ViaThinkSoft
6
 * Version 2014-11-17
6
 * Version 2021-06-10
7
 *
7
 *
8
 * Licensed under the Apache License, Version 2.0 (the "License");
8
 * Licensed under the Apache License, Version 2.0 (the "License");
9
 * you may not use this file except in compliance with the License.
9
 * you may not use this file except in compliance with the License.
10
 * You may obtain a copy of the License at
10
 * You may obtain a copy of the License at
11
 *
11
 *
Line 373... Line 373...
373
function openssl_get_sig_base64($cert, $mode = 0) {
373
function openssl_get_sig_base64($cert, $mode = 0) {
374
        # mode
374
        # mode
375
        # 0 = cert is a file
375
        # 0 = cert is a file
376
        # 1 = cert is pem string
376
        # 1 = cert is pem string
377
 
377
 
-
 
378
        $params = '';
-
 
379
 
378
        $out = array();
380
        $out = array();
379
        if ($mode == 0) {
381
        if ($mode == 0) {
380
                exec(OPENSSL_EXEC.' x509 -noout'.$params.' -in '.escapeshellarg($cert), $out, $code);
382
                exec(OPENSSL_EXEC.' x509 -noout'.$params.' -in '.escapeshellarg($cert), $out, $code);
381
        } else if ($mode == 1) {
383
        } else if ($mode == 1) {
382
                exec('echo '.escapeshellarg($cert).' | '.OPENSSL_EXEC.' x509 -noout'.$params, $out, $code);
384
                exec('echo '.escapeshellarg($cert).' | '.OPENSSL_EXEC.' x509 -noout'.$params, $out, $code);