class XMLSecurityKey
Constants
TRIPLEDES_CBC |
|
AES128_CBC |
|
AES192_CBC |
|
AES256_CBC |
|
RSA_1_5 |
|
RSA_OAEP_MGF1P |
|
DSA_SHA1 |
|
RSA_SHA1 |
|
RSA_SHA256 |
|
RSA_SHA384 |
|
RSA_SHA512 |
|
HMAC_SHA1 |
|
Properties
int|string | $type | |||
mixed|null | $key | |||
string | $passphrase | |||
string|null | $iv | |||
string|null | $name | |||
mixed|null | $keyChain | |||
bool | $isEncrypted | |||
XMLSecEnc|null | $encryptedCtx | |||
mixed|null | $guid |
Methods
Loads the given key, or - with isFile set true - the key from the keyfile.
Encrypts the given data (string) using the regarding php-extension, depending on the library assigned to algorithm in the contructor.
Decrypts the given data (string) using the regarding php-extension, depending on the library assigned to algorithm in the contructor.
Signs the data (string) using the extension assigned to the type in the constructor.
Verifies the data (string) against the given signature using the extension assigned to the type in the constructor.
Hint: Modulus and Exponent must already be base64 decoded
Details
at line 70
__construct(string $type, null|array $params = null)
at line 193
int|null
getSymmetricKeySize()
Retrieve the key size for the symmetric encryption algorithm.
.</p> <p>If the key size is unknown, or this isn't a symmetric encryption algorithm, null is returned.
at line 207
string
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.
at line 241
static null|string
getRawThumbprint(string $cert)
Get the raw thumbprint of a certificate
at line 276
loadKey(string $key, bool $isFile = false, bool $isCert = false)
Loads the given key, or - with isFile set true - the key from the keyfile.
at line 499
mixed|string
encryptData(string $data)
Encrypts the given data (string) using the regarding php-extension, depending on the library assigned to algorithm in the contructor.
at line 522
mixed|string
decryptData(string $data)
Decrypts the given data (string) using the regarding php-extension, depending on the library assigned to algorithm in the contructor.
at line 545
mixed|string
signData(string $data)
Signs the data (string) using the extension assigned to the type in the constructor.
at line 573
bool|int
verifySignature(string $data, string $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.</p> <p>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".
at line 591
mixed
getAlgorith()
deprecated
deprecated
at line 599
mixed
getAlgorithm()
at line 610
static null|string
makeAsnSegment(int $type, string $string)
at line 643
static string
convertRSA(string $modulus, string $exponent)
Hint: Modulus and Exponent must already be base64 decoded
at line 672
string
getX509Certificate()
Retrieve the X509 certificate this key represents.
Will return the X509 certificate in PEM-format if this key represents an X509 certificate.
at line 686
string
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.
at line 700
static XMLSecurityKey
fromEncryptedKeyElement(DOMElement $element)
Create key from an EncryptedKey-element.