ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
|
Public Member Functions | |
__construct ($type, $params=null) | |
getSymmetricKeySize () | |
Retrieve the key size for the symmetric encryption algorithm. More... | |
generateSessionKey () | |
Generates a session key using the openssl-extension. More... | |
loadKey ($key, $isFile=false, $isCert=false) | |
Loads the given key, or - with isFile set true - the key from the keyfile. More... | |
encryptData ($data) | |
Encrypts the given data (string) using the regarding php-extension, depending on the library assigned to algorithm in the contructor. More... | |
decryptData ($data) | |
Decrypts the given data (string) using the regarding php-extension, depending on the library assigned to algorithm in the contructor. More... | |
signData ($data) | |
Signs the data (string) using the extension assigned to the type in the constructor. More... | |
verifySignature ($data, $signature) | |
Verifies the data (string) against the given signature using the extension assigned to the type in the constructor. More... | |
getAlgorith () | |
getAlgorithm () | |
serializeKey ($parent) | |
getX509Certificate () | |
Retrieve the X509 certificate this key represents. More... | |
getX509Thumbprint () | |
Get the thumbprint of this X509 certificate. More... | |
Static Public Member Functions | |
static | getRawThumbprint ($cert) |
Get the raw thumbprint of a certificate. More... | |
static | makeAsnSegment ($type, $string) |
static | convertRSA ($modulus, $exponent) |
Hint: Modulus and Exponent must already be base64 decoded. More... | |
static | fromEncryptedKeyElement (DOMElement $element) |
Create key from an EncryptedKey-element. More... | |
Data Fields | |
const | TRIPLEDES_CBC = 'http://www.w3.org/2001/04/xmlenc#tripledes-cbc' |
const | AES128_CBC = 'http://www.w3.org/2001/04/xmlenc#aes128-cbc' |
const | AES192_CBC = 'http://www.w3.org/2001/04/xmlenc#aes192-cbc' |
const | AES256_CBC = 'http://www.w3.org/2001/04/xmlenc#aes256-cbc' |
const | RSA_1_5 = 'http://www.w3.org/2001/04/xmlenc#rsa-1_5' |
const | RSA_OAEP_MGF1P = 'http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p' |
const | DSA_SHA1 = 'http://www.w3.org/2000/09/xmldsig#dsa-sha1' |
const | RSA_SHA1 = 'http://www.w3.org/2000/09/xmldsig#rsa-sha1' |
const | RSA_SHA256 = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256' |
const | RSA_SHA384 = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha384' |
const | RSA_SHA512 = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha512' |
const | HMAC_SHA1 = 'http://www.w3.org/2000/09/xmldsig#hmac-sha1' |
$type = 0 | |
$key = null | |
$passphrase = "" | |
$iv = null | |
$name = null | |
$keyChain = null | |
$isEncrypted = false | |
$encryptedCtx = null | |
$guid = null | |
Private Member Functions | |
padISO10126 ($data, $blockSize) | |
ISO 10126 Padding. More... | |
unpadISO10126 ($data) | |
Remove ISO 10126 Padding. More... | |
encryptSymmetric ($data) | |
Encrypts the given data (string) using the openssl-extension. More... | |
decryptSymmetric ($data) | |
Decrypts the given data (string) using the openssl-extension. More... | |
encryptPublic ($data) | |
Encrypts the given public data (string) using the openssl-extension. More... | |
decryptPublic ($data) | |
Decrypts the given public data (string) using the openssl-extension. More... | |
encryptPrivate ($data) | |
Encrypts the given private data (string) using the openssl-extension. More... | |
decryptPrivate ($data) | |
Decrypts the given private data (string) using the openssl-extension. More... | |
signOpenSSL ($data) | |
Signs the given data (string) using the openssl-extension. More... | |
verifyOpenSSL ($data, $signature) | |
Verifies the given data (string) belonging to the given signature using the openssl-extension. More... | |
Private Attributes | |
$cryptParams = array() | |
$x509Certificate = null | |
$X509Thumbprint = null | |
Copyright (c) 2007-2019, Robert Richards rrich. All rights reserved. ards @cdat azon e.org
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Definition at line 47 of file XMLSecurityKey.php.
RobRichards\XMLSecLibs\XMLSecurityKey::__construct | ( | $type, | |
$params = null |
|||
) |
string | $type | |
null | array | $params |
Exception |
Definition at line 110 of file XMLSecurityKey.php.
References PHPMailer\PHPMailer\$params, and RobRichards\XMLSecLibs\XMLSecurityKey\$type.
|
static |
Hint: Modulus and Exponent must already be base64 decoded.
string | $modulus | |
string | $exponent |
Definition at line 670 of file XMLSecurityKey.php.
Referenced by RobRichards\XMLSecLibs\XMLSecEnc\staticLocateKeyInfo().
RobRichards\XMLSecLibs\XMLSecurityKey::decryptData | ( | $data | ) |
Decrypts the given data (string) using the regarding php-extension, depending on the library assigned to algorithm in the contructor.
string | $data |
Definition at line 556 of file XMLSecurityKey.php.
References $data, RobRichards\XMLSecLibs\XMLSecurityKey\decryptPrivate(), RobRichards\XMLSecLibs\XMLSecurityKey\decryptPublic(), and RobRichards\XMLSecLibs\XMLSecurityKey\decryptSymmetric().
|
private |
Decrypts the given private data (string) using the openssl-extension.
string | $data |
Exception |
Definition at line 478 of file XMLSecurityKey.php.
References $data.
Referenced by RobRichards\XMLSecLibs\XMLSecurityKey\decryptData().
|
private |
Decrypts the given public data (string) using the openssl-extension.
string | $data |
Exception |
Definition at line 448 of file XMLSecurityKey.php.
References $data.
Referenced by RobRichards\XMLSecLibs\XMLSecurityKey\decryptData().
|
private |
Decrypts the given data (string) using the openssl-extension.
string | $data |
Definition at line 414 of file XMLSecurityKey.php.
References $data, and RobRichards\XMLSecLibs\XMLSecurityKey\unpadISO10126().
Referenced by RobRichards\XMLSecLibs\XMLSecurityKey\decryptData().
RobRichards\XMLSecLibs\XMLSecurityKey::encryptData | ( | $data | ) |
Encrypts the given data (string) using the regarding php-extension, depending on the library assigned to algorithm in the contructor.
string | $data |
Definition at line 536 of file XMLSecurityKey.php.
References $data, RobRichards\XMLSecLibs\XMLSecurityKey\encryptPrivate(), RobRichards\XMLSecLibs\XMLSecurityKey\encryptPublic(), and RobRichards\XMLSecLibs\XMLSecurityKey\encryptSymmetric().
|
private |
Encrypts the given private data (string) using the openssl-extension.
string | $data |
Exception |
Definition at line 463 of file XMLSecurityKey.php.
References $data.
Referenced by RobRichards\XMLSecLibs\XMLSecurityKey\encryptData().
|
private |
Encrypts the given public data (string) using the openssl-extension.
string | $data |
Exception |
Definition at line 433 of file XMLSecurityKey.php.
References $data.
Referenced by RobRichards\XMLSecLibs\XMLSecurityKey\encryptData().
|
private |
Encrypts the given data (string) using the openssl-extension.
string | $data |
Definition at line 397 of file XMLSecurityKey.php.
References $data, and RobRichards\XMLSecLibs\XMLSecurityKey\padISO10126().
Referenced by RobRichards\XMLSecLibs\XMLSecurityKey\encryptData().
|
static |
Create key from an EncryptedKey-element.
DOMElement | $element | The EncryptedKey-element. |
Exception |
Definition at line 735 of file XMLSecurityKey.php.
References RobRichards\XMLSecLibs\XMLSecEnc\staticLocateKeyInfo().
Referenced by RobRichards\XMLSecLibs\XMLSecEnc\staticLocateKeyInfo().
RobRichards\XMLSecLibs\XMLSecurityKey::generateSessionKey | ( | ) |
Generates a session key using the openssl-extension.
In case of using DES3-CBC the key is checked for a proper parity bits set.
Exception |
Definition at line 247 of file XMLSecurityKey.php.
References $i, and RobRichards\XMLSecLibs\XMLSecurityKey\$key.
RobRichards\XMLSecLibs\XMLSecurityKey::getAlgorith | ( | ) |
Definition at line 618 of file XMLSecurityKey.php.
References RobRichards\XMLSecLibs\XMLSecurityKey\getAlgorithm().
RobRichards\XMLSecLibs\XMLSecurityKey::getAlgorithm | ( | ) |
Definition at line 626 of file XMLSecurityKey.php.
Referenced by RobRichards\XMLSecLibs\XMLSecurityKey\getAlgorith(), and SAML2\Utils\insertSignature().
|
static |
Get the raw thumbprint of a certificate.
string | $cert |
Definition at line 281 of file XMLSecurityKey.php.
References $data.
RobRichards\XMLSecLibs\XMLSecurityKey::getSymmetricKeySize | ( | ) |
Retrieve the key size for the symmetric encryption algorithm.
If the key size is unknown, or this isn't a symmetric encryption algorithm, null is returned.
Definition at line 233 of file XMLSecurityKey.php.
Referenced by SAML2\Utils\insertSignature().
RobRichards\XMLSecLibs\XMLSecurityKey::getX509Certificate | ( | ) |
Retrieve the X509 certificate this key represents.
Will return the X509 certificate in PEM-format if this key represents an X509 certificate.
Definition at line 707 of file XMLSecurityKey.php.
References RobRichards\XMLSecLibs\XMLSecurityKey\$x509Certificate.
RobRichards\XMLSecLibs\XMLSecurityKey::getX509Thumbprint | ( | ) |
Get the thumbprint of this X509 certificate.
Returns: The thumbprint as a lowercase 40-character hexadecimal number, or null if this isn't a X509 certificate.
Definition at line 721 of file XMLSecurityKey.php.
References RobRichards\XMLSecLibs\XMLSecurityKey\$X509Thumbprint.
RobRichards\XMLSecLibs\XMLSecurityKey::loadKey | ( | $key, | |
$isFile = false , |
|||
$isCert = false |
|||
) |
Loads the given key, or - with isFile set true - the key from the keyfile.
string | $key | |
bool | $isFile | |
bool | $isCert |
Exception |
Definition at line 316 of file XMLSecurityKey.php.
References RobRichards\XMLSecLibs\XMLSecurityKey\$key.
|
static |
int | $type | |
string | $string |
Definition at line 637 of file XMLSecurityKey.php.
References Sabre\VObject\$output, and RobRichards\XMLSecLibs\XMLSecurityKey\$type.
|
private |
ISO 10126 Padding.
string | $data | |
integer | $blockSize |
Exception |
Definition at line 368 of file XMLSecurityKey.php.
References $data.
Referenced by RobRichards\XMLSecLibs\XMLSecurityKey\encryptSymmetric().
RobRichards\XMLSecLibs\XMLSecurityKey::serializeKey | ( | $parent | ) |
RobRichards\XMLSecLibs\XMLSecurityKey::signData | ( | $data | ) |
Signs the data (string) using the extension assigned to the type in the constructor.
string | $data |
Definition at line 576 of file XMLSecurityKey.php.
References $data, and RobRichards\XMLSecLibs\XMLSecurityKey\signOpenSSL().
|
private |
Signs the given data (string) using the openssl-extension.
string | $data |
Exception |
Definition at line 493 of file XMLSecurityKey.php.
Referenced by RobRichards\XMLSecLibs\XMLSecurityKey\signData().
|
private |
Remove ISO 10126 Padding.
string | $data |
Definition at line 384 of file XMLSecurityKey.php.
References $data.
Referenced by RobRichards\XMLSecLibs\XMLSecurityKey\decryptSymmetric().
|
private |
Verifies the given data (string) belonging to the given signature using the openssl-extension.
Returns: 1 on succesful signature verification, 0 when signature verification failed, -1 if an error occurred during processing.
NOTE: be very careful when checking the return value, because in PHP, -1 will be cast to True when in boolean context. So always check the return value in a strictly typed way, e.g. "$obj->verify(...) === 1".
string | $data | |
string | $signature |
Definition at line 521 of file XMLSecurityKey.php.
Referenced by RobRichards\XMLSecLibs\XMLSecurityKey\verifySignature().
RobRichards\XMLSecLibs\XMLSecurityKey::verifySignature | ( | $data, | |
$signature | |||
) |
Verifies the data (string) against the given signature using the extension assigned to the type in the constructor.
Returns in case of openSSL: 1 on succesful signature verification, 0 when signature verification failed, -1 if an error occurred during processing.
NOTE: be very careful when checking the return value, because in PHP, -1 will be cast to True when in boolean context. So always check the return value in a strictly typed way, e.g. "$obj->verify(...) === 1".
string | $data | |
string | $signature |
Definition at line 602 of file XMLSecurityKey.php.
References $data, and RobRichards\XMLSecLibs\XMLSecurityKey\verifyOpenSSL().
Referenced by SAML2\HTTPRedirect\validateSignature().
|
private |
Definition at line 63 of file XMLSecurityKey.php.
RobRichards\XMLSecLibs\XMLSecurityKey::$encryptedCtx = null |
Definition at line 87 of file XMLSecurityKey.php.
RobRichards\XMLSecLibs\XMLSecurityKey::$guid = null |
Definition at line 90 of file XMLSecurityKey.php.
RobRichards\XMLSecLibs\XMLSecurityKey::$isEncrypted = false |
Definition at line 84 of file XMLSecurityKey.php.
RobRichards\XMLSecLibs\XMLSecurityKey::$iv = null |
Definition at line 75 of file XMLSecurityKey.php.
RobRichards\XMLSecLibs\XMLSecurityKey::$key = null |
Definition at line 69 of file XMLSecurityKey.php.
Referenced by RobRichards\XMLSecLibs\XMLSecurityKey\generateSessionKey(), and RobRichards\XMLSecLibs\XMLSecurityKey\loadKey().
RobRichards\XMLSecLibs\XMLSecurityKey::$keyChain = null |
Definition at line 81 of file XMLSecurityKey.php.
RobRichards\XMLSecLibs\XMLSecurityKey::$name = null |
Definition at line 78 of file XMLSecurityKey.php.
RobRichards\XMLSecLibs\XMLSecurityKey::$passphrase = "" |
Definition at line 72 of file XMLSecurityKey.php.
RobRichards\XMLSecLibs\XMLSecurityKey::$type = 0 |
Definition at line 66 of file XMLSecurityKey.php.
Referenced by RobRichards\XMLSecLibs\XMLSecurityKey\__construct(), and RobRichards\XMLSecLibs\XMLSecurityKey\makeAsnSegment().
|
private |
Definition at line 97 of file XMLSecurityKey.php.
Referenced by RobRichards\XMLSecLibs\XMLSecurityKey\getX509Certificate().
|
private |
Definition at line 103 of file XMLSecurityKey.php.
Referenced by RobRichards\XMLSecLibs\XMLSecurityKey\getX509Thumbprint().
const RobRichards\XMLSecLibs\XMLSecurityKey::AES128_CBC = 'http://www.w3.org/2001/04/xmlenc#aes128-cbc' |
Definition at line 50 of file XMLSecurityKey.php.
Referenced by SAML2\Certificate\PrivateKeyLoader\loadDecryptionKeys().
const RobRichards\XMLSecLibs\XMLSecurityKey::AES192_CBC = 'http://www.w3.org/2001/04/xmlenc#aes192-cbc' |
Definition at line 51 of file XMLSecurityKey.php.
const RobRichards\XMLSecLibs\XMLSecurityKey::AES256_CBC = 'http://www.w3.org/2001/04/xmlenc#aes256-cbc' |
Definition at line 52 of file XMLSecurityKey.php.
const RobRichards\XMLSecLibs\XMLSecurityKey::DSA_SHA1 = 'http://www.w3.org/2000/09/xmldsig#dsa-sha1' |
Definition at line 55 of file XMLSecurityKey.php.
const RobRichards\XMLSecLibs\XMLSecurityKey::HMAC_SHA1 = 'http://www.w3.org/2000/09/xmldsig#hmac-sha1' |
Definition at line 60 of file XMLSecurityKey.php.
const RobRichards\XMLSecLibs\XMLSecurityKey::RSA_1_5 = 'http://www.w3.org/2001/04/xmlenc#rsa-1_5' |
Definition at line 53 of file XMLSecurityKey.php.
Referenced by SAML2\Certificate\PrivateKeyLoader\convertPrivateKeyToRsaKey(), and SAML2\Configuration\ServiceProvider\getBlacklistedAlgorithms().
const RobRichards\XMLSecLibs\XMLSecurityKey::RSA_OAEP_MGF1P = 'http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p' |
Definition at line 54 of file XMLSecurityKey.php.
const RobRichards\XMLSecLibs\XMLSecurityKey::RSA_SHA1 = 'http://www.w3.org/2000/09/xmldsig#rsa-sha1' |
Definition at line 56 of file XMLSecurityKey.php.
const RobRichards\XMLSecLibs\XMLSecurityKey::RSA_SHA256 = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256' |
Definition at line 57 of file XMLSecurityKey.php.
Referenced by SimpleSAML\XML\Signer\loadPrivateKeyArray(), and SAML2\Signature\AbstractChainedValidator\validateElementWithKeys().
const RobRichards\XMLSecLibs\XMLSecurityKey::RSA_SHA384 = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha384' |
Definition at line 58 of file XMLSecurityKey.php.
const RobRichards\XMLSecLibs\XMLSecurityKey::RSA_SHA512 = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha512' |
Definition at line 59 of file XMLSecurityKey.php.
const RobRichards\XMLSecLibs\XMLSecurityKey::TRIPLEDES_CBC = 'http://www.w3.org/2001/04/xmlenc#tripledes-cbc' |
Definition at line 49 of file XMLSecurityKey.php.