PHP 클래스 RobRichards\XMLSecLibs\XMLSecurityKey

Copyright (c) 2007-2015, Robert Richards . All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Robert Richards nor the names of his contributors may be used to endorse or promote products derived from this software without specific prior written permission. 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.
저자: Robert Richards ([email protected])
파일 보기 프로젝트 열기: robrichards/xmlseclibs 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$encryptedCtx RobRichards\XMLSecLibs\XMLSecEnc | null
$guid mixed | null
$isEncrypted boolean
$iv string | null
$key mixed | null
$keyChain mixed | null
$name string | null
$passphrase string
$type integer | string

공개 메소드들

메소드 설명
__construct ( string $type, null | array $params = null )
convertRSA ( string $modulus, string $exponent ) : string Hint: Modulus and Exponent must already be base64 decoded
decryptData ( string $data ) : mixed | string Decrypts the given data (string) using the regarding php-extension, depending on the library assigned to algorithm in the contructor.
encryptData ( string $data ) : mixed | string Encrypts the given data (string) using the regarding php-extension, depending on the library assigned to algorithm in the contructor.
fromEncryptedKeyElement ( DOMElemen\DOMElement $element ) : XMLSecurityKey Create key from an EncryptedKey-element.
generateSessionKey ( ) : string Generates a session key using the openssl-extension or using the mcrypt-extension as a fallback.
getAlgorith ( ) : mixed
getAlgorithm ( ) : mixed
getRawThumbprint ( string $cert ) : null | string Get the raw thumbprint of a certificate
getSymmetricKeySize ( ) : integer | null Retrieve the key size for the symmetric encryption algorithm.
getX509Certificate ( ) : string Retrieve the X509 certificate this key represents.
getX509Thumbprint ( ) : string Get the thumbprint of this X509 certificate.
loadKey ( string $key, boolean $isFile = false, boolean $isCert = false ) Loads the given key, or - with isFile set true - the key from the keyfile.
makeAsnSegment ( integer $type, string $string ) : null | string
serializeKey ( mixed $parent )
signData ( string $data ) : mixed | string Signs the data (string) using the extension assigned to the type in the constructor.
verifySignature ( string $data, string $signature ) : boolean | integer Verifies the data (string) against the given signature using the extension assigned to the type in the constructor.

비공개 메소드들

메소드 설명
decryptMcrypt ( string $data ) : string Decrypts the given data (string) using the mcrypt-extension
decryptOpenSSL ( string $data ) : string Decrypts the given data (string) using the openssl-extension
encryptMcrypt ( string $data ) : string Encrypts the given data (string) using the mcrypt-extension
encryptOpenSSL ( string $data ) : string Encrypts the given data (string) using the openssl-extension
signOpenSSL ( string $data ) : string Signs the given data (string) using the openssl-extension
verifyOpenSSL ( string $data, string $signature ) : integer Verifies the given data (string) belonging to the given signature using the openssl-extension

메소드 상세

__construct() 공개 메소드

public __construct ( string $type, null | array $params = null )
$type string
$params null | array

convertRSA() 공개 정적인 메소드

Hint: Modulus and Exponent must already be base64 decoded
public static convertRSA ( string $modulus, string $exponent ) : string
$modulus string
$exponent string
리턴 string

decryptData() 공개 메소드

Decrypts the given data (string) using the regarding php-extension, depending on the library assigned to algorithm in the contructor.
public decryptData ( string $data ) : mixed | string
$data string
리턴 mixed | string

encryptData() 공개 메소드

Encrypts the given data (string) using the regarding php-extension, depending on the library assigned to algorithm in the contructor.
public encryptData ( string $data ) : mixed | string
$data string
리턴 mixed | string

fromEncryptedKeyElement() 공개 정적인 메소드

Create key from an EncryptedKey-element.
public static fromEncryptedKeyElement ( DOMElemen\DOMElement $element ) : XMLSecurityKey
$element DOMElemen\DOMElement The EncryptedKey-element.
리턴 XMLSecurityKey The new key.

generateSessionKey() 공개 메소드

In case of using DES3-CBC the key is checked for a proper parity bits set - Mcrypt doesn't care about the parity bits, but others may care.
public generateSessionKey ( ) : string
리턴 string

getAlgorith() 공개 메소드

또한 보기: getAlgorithm()
사용 중단:
public getAlgorith ( ) : mixed
리턴 mixed

getAlgorithm() 공개 메소드

public getAlgorithm ( ) : mixed
리턴 mixed

getRawThumbprint() 공개 정적인 메소드

Get the raw thumbprint of a certificate
public static getRawThumbprint ( string $cert ) : null | string
$cert string
리턴 null | string

getSymmetricKeySize() 공개 메소드

. If the key size is unknown, or this isn't a symmetric encryption algorithm, null is returned.
public getSymmetricKeySize ( ) : integer | null
리턴 integer | null The number of bytes in the key.

getX509Certificate() 공개 메소드

Will return the X509 certificate in PEM-format if this key represents an X509 certificate.
public getX509Certificate ( ) : string
리턴 string The X509 certificate or null if this key doesn't represent an X509-certificate.

getX509Thumbprint() 공개 메소드

Returns: The thumbprint as a lowercase 40-character hexadecimal number, or null if this isn't a X509 certificate.
public getX509Thumbprint ( ) : string
리턴 string Lowercase 40-character hexadecimal number of thumbprint

loadKey() 공개 메소드

Loads the given key, or - with isFile set true - the key from the keyfile.
public loadKey ( string $key, boolean $isFile = false, boolean $isCert = false )
$key string
$isFile boolean
$isCert boolean

makeAsnSegment() 공개 정적인 메소드

public static makeAsnSegment ( integer $type, string $string ) : null | string
$type integer
$string string
리턴 null | string

serializeKey() 공개 메소드

public serializeKey ( mixed $parent )
$parent mixed

signData() 공개 메소드

Signs the data (string) using the extension assigned to the type in the constructor.
public signData ( string $data ) : mixed | string
$data string
리턴 mixed | string

verifySignature() 공개 메소드

Verifies the data (string) against the given signature using the extension assigned to the type in the constructor.
public verifySignature ( string $data, string $signature ) : boolean | integer
$data string
$signature string
리턴 boolean | integer

프로퍼티 상세

$encryptedCtx 공개적으로 프로퍼티

public XMLSecEnc,RobRichards\XMLSecLibs|null $encryptedCtx
리턴 RobRichards\XMLSecLibs\XMLSecEnc | null

$guid 공개적으로 프로퍼티

public mixed|null $guid
리턴 mixed | null

$isEncrypted 공개적으로 프로퍼티

public bool $isEncrypted
리턴 boolean

$iv 공개적으로 프로퍼티

public string|null $iv
리턴 string | null

$key 공개적으로 프로퍼티

public mixed|null $key
리턴 mixed | null

$keyChain 공개적으로 프로퍼티

public mixed|null $keyChain
리턴 mixed | null

$name 공개적으로 프로퍼티

public string|null $name
리턴 string | null

$passphrase 공개적으로 프로퍼티

public string $passphrase
리턴 string

$type 공개적으로 프로퍼티

public int|string $type
리턴 integer | string