当前位置: 首页>>代码示例>>PHP>>正文


PHP XMLSecurityKey类代码示例

本文整理汇总了PHP中XMLSecurityKey的典型用法代码示例。如果您正苦于以下问题:PHP XMLSecurityKey类的具体用法?PHP XMLSecurityKey怎么用?PHP XMLSecurityKey使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了XMLSecurityKey类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __doRequest

 function __doRequest($request, $location, $saction, $version)
 {
     $dom = new DOMDocument();
     $dom->loadXML($request);
     $objWSSE = new WSSESoap($dom);
     /* Sign all headers to include signing the WS-Addressing headers */
     $objWSSE->signAllHeaders = TRUE;
     $objWSSE->addTimestamp();
     /* create new XMLSec Key using RSA SHA-1 and type is private key */
     $objKey = new XMLSecurityKey(XMLSecurityKey::RSA_SHA1, array('type' => 'private'));
     /* load the private key from file - last arg is bool if key in file (TRUE) or is string (FALSE) */
     $objKey->loadKey(PRIVATE_KEY, TRUE);
     // Sign the message - also signs appropraite WS-Security items
     $objWSSE->signSoapDoc($objKey);
     /* Add certificate (BinarySecurityToken) to the message and attach pointer to Signature */
     $token = $objWSSE->addBinaryToken(file_get_contents(CERT_FILE));
     $objWSSE->attachTokentoSig($token);
     $request = $objWSSE->saveXML();
     $dom = new DOMDocument();
     $dom->loadXML($request);
     $objWSA = new WSASoap($dom);
     $objWSA->addAction($saction);
     $objWSA->addTo($location);
     $objWSA->addMessageID();
     $objWSA->addReplyTo();
     $request = $objWSA->getDoc()->saveXML();
     return parent::__doRequest($request, $location, $saction, $version);
 }
开发者ID:Deeplace,项目名称:mpay_integration,代码行数:28,代码来源:client.php

示例2: validateElementWithKeys

 /**
  * BC compatible version of the signature check
  *
  * @param SAML2_SignedElement      $element
  * @param SAML2_Certificate_X509[] $pemCandidates
  *
  * @throws Exception
  *
  * @return bool
  */
 protected function validateElementWithKeys(SAML2_SignedElement $element, $pemCandidates)
 {
     $lastException = NULL;
     foreach ($pemCandidates as $index => $candidateKey) {
         $key = new XMLSecurityKey(XMLSecurityKey::RSA_SHA1, array('type' => 'public'));
         $key->loadKey($candidateKey->getCertificate());
         try {
             /*
              * Make sure that we have a valid signature on either the response or the assertion.
              */
             $result = $element->validate($key);
             if ($result) {
                 $this->logger->debug(sprintf('Validation with key "#%d" succeeded', $index));
                 return TRUE;
             }
             $this->logger->debug(sprintf('Validation with key "#%d" failed without exception.', $index));
         } catch (Exception $e) {
             $this->logger->debug(sprintf('Validation with key "#%d" failed with exception: %s', $index, $e->getMessage()));
             $lastException = $e;
         }
     }
     if ($lastException !== NULL) {
         throw $lastException;
     } else {
         return FALSE;
     }
 }
开发者ID:Shalmezad,项目名称:saml2,代码行数:37,代码来源:AbstractChainedValidator.php

示例3: __doRequest

 public function __doRequest($request, $location, $saction, $version)
 {
     $doc = new DOMDocument('1.0');
     $doc->loadXML($request);
     $objWSSE = new WSSESoap($doc);
     /* add Timestamp with no expiration timestamp */
     $objWSSE->addTimestamp();
     /* create new XMLSec Key using AES256_CBC and type is private key */
     $objKey = new XMLSecurityKey(XMLSecurityKey::RSA_SHA1, array('type' => 'private'));
     /* load the private key from file - last arg is bool if key in file (true) or is string (false) */
     $objKey->loadKey(PRIVATE_KEY, true);
     /* Sign the message - also signs appropiate WS-Security items */
     $options = array("insertBefore" => false);
     $objWSSE->signSoapDoc($objKey, $options);
     /* Add certificate (BinarySecurityToken) to the message */
     $token = $objWSSE->addBinaryToken(file_get_contents(CERT_FILE));
     /* Attach pointer to Signature */
     $objWSSE->attachTokentoSig($token);
     $objKey = new XMLSecurityKey(XMLSecurityKey::AES256_CBC);
     $objKey->generateSessionKey();
     $siteKey = new XMLSecurityKey(XMLSecurityKey::RSA_OAEP_MGF1P, array('type' => 'public'));
     $siteKey->loadKey(SERVICE_CERT, true, true);
     $options = array("KeyInfo" => array("X509SubjectKeyIdentifier" => true));
     $objWSSE->encryptSoapDoc($siteKey, $objKey, $options);
     $retVal = parent::__doRequest($objWSSE->saveXML(), $location, $saction, $version);
     $doc = new DOMDocument();
     $doc->loadXML($retVal);
     $options = array("keys" => array("private" => array("key" => PRIVATE_KEY, "isFile" => true, "isCert" => false)));
     $objWSSE->decryptSoapDoc($doc, $options);
     return $doc->saveXML();
 }
开发者ID:leoclaro,项目名称:wse-php,代码行数:31,代码来源:soap-sign-encrypt.php

示例4: setAssertion

 /**
  * Set the assertion.
  *
  * @param SAML2_Assertion $assertion The assertion.
  * @param XMLSecurityKey  $key       The key we should use to encrypt the assertion.
  * @throws Exception
  */
 public function setAssertion(SAML2_Assertion $assertion, XMLSecurityKey $key)
 {
     $xml = $assertion->toXML();
     SAML2_Utils::getContainer()->debugMessage($xml, 'encrypt');
     $enc = new XMLSecEnc();
     $enc->setNode($xml);
     $enc->type = XMLSecEnc::Element;
     switch ($key->type) {
         case XMLSecurityKey::TRIPLEDES_CBC:
         case XMLSecurityKey::AES128_CBC:
         case XMLSecurityKey::AES192_CBC:
         case XMLSecurityKey::AES256_CBC:
             $symmetricKey = $key;
             break;
         case XMLSecurityKey::RSA_1_5:
         case XMLSecurityKey::RSA_OAEP_MGF1P:
             $symmetricKey = new XMLSecurityKey(XMLSecurityKey::AES128_CBC);
             $symmetricKey->generateSessionKey();
             $enc->encryptKey($key, $symmetricKey);
             break;
         default:
             throw new Exception('Unknown key type for encryption: ' . $key->type);
     }
     $this->encryptedData = $enc->encryptNode($symmetricKey);
 }
开发者ID:danielkjfrog,项目名称:docker,代码行数:32,代码来源:EncryptedAssertion.php

示例5: addUserToken

 public function addUserToken($userName, $password = NULL, $passwordDigest = FALSE)
 {
     if ($passwordDigest && empty($password)) {
         throw new Exception("Cannot calculate the digest without a password");
     }
     $security = $this->locateSecurityHeader();
     $token = $this->SOAPDoc->createElementNS(WSSESoap::WSUNS, WSSESoap::WSUPFX . ':UsernameToken');
     $security->insertBefore($token, $security->firstChild);
     $username = $this->SOAPDoc->createElementNS(WSSESoap::WSUNS, WSSESoap::WSUPFX . ':Username', $userName);
     $token->appendChild($username);
     /* Generate nonce - create a 256 bit session key to be used */
     $objKey = new XMLSecurityKey(XMLSecurityKey::AES256_CBC);
     $nonce = $objKey->generateSessionKey();
     unset($objKey);
     $createdate = gmdate("Y-m-d\\TH:i:s") . 'Z';
     if ($password) {
         $passType = '#PasswordText';
         if ($passwordDigest) {
             $password = base64_encode(sha1($nonce . $createdate . $password, true));
             $passType = '#PasswordDigest';
         }
         $passwordNode = $this->SOAPDoc->createElementNS(WSSESoap::WSUNS, WSSESoap::WSUPFX . ':Password', $userName);
         $token->appendChild($passwordNode);
         $passwordNode->setAttribute('Type', $passType);
     }
     $nonceNode = $this->SOAPDoc->createElementNS(WSSESoap::WSUNS, WSSESoap::WSUPFX . ':Nonce', base64_encode($nonce));
     $token->appendChild($nonceNode);
     $created = $this->SOAPDoc->createElementNS(WSSESoap::WSUNS, WSSESoap::WSUPFX . ':Created', $createdate);
     $token->appendChild($created);
     return $token;
 }
开发者ID:rakesh-mohanta,项目名称:scalr,代码行数:31,代码来源:class.WSSESOAP.php

示例6: createLogoutResponse

 protected function createLogoutResponse($testrun, $logoutRequest, $logoutRelayState)
 {
     $this->log($testrun, 'Creating response with relaystate [' . $logoutRelayState . ']');
     $idpMetadata = SimpleSAML_Configuration::loadFromArray($this->idpmetadata);
     $spMetadata = SimpleSAML_Configuration::loadFromArray($this->metadata);
     // Get SingleLogoutService URL
     $consumerURLf = $spMetadata->getDefaultEndpoint('SingleLogoutService', array('urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect'));
     $consumerURL = $consumerURLf['Location'];
     /* Create an send response. */
     $response = sspmod_saml2_Message::buildLogoutResponse($idpMetadata, $spMetadata);
     $response->setRelayState($logoutRequest->getRelayState());
     $response->setInResponseTo($logoutRequest->getId());
     $keyArray = SimpleSAML_Utilities::loadPrivateKey($idpMetadata, TRUE);
     $certArray = SimpleSAML_Utilities::loadPublicKey($idpMetadata, FALSE);
     $privateKey = new XMLSecurityKey(XMLSecurityKey::RSA_SHA1, array('type' => 'private'));
     $privateKey->loadKey($keyArray['PEM'], FALSE);
     $response->setSignatureKey($privateKey);
     if ($certArray === NULL) {
         throw new Exception('No certificates found. [1]');
     }
     if (!array_key_exists('PEM', $certArray)) {
         throw new Exception('No certificates found. [2]');
     }
     $response->setCertificates(array($certArray['PEM']));
     #$this->tweakResponse($testrun, $response);
     $msgStr = $response->toUnsignedXML();
     #$this->tweakResponseDOM($testrun, $msgStr);
     $msgStr = $msgStr->ownerDocument->saveXML($msgStr);
     #	echo '<pre>'; echo(htmlspecialchars($msgStr)); exit;
     #		$msgStr = base64_encode($msgStr);
     #		$msgStr = htmlspecialchars($msgStr);
     return array('url' => $consumerURL, 'Response' => $msgStr, 'ResponseObj' => $response, 'RelayState' => $logoutRelayState);
 }
开发者ID:filonuse,项目名称:fedlab,代码行数:33,代码来源:SLOTest.php

示例7: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     $cert = "-----BEGIN CERTIFICATE-----\n" . "MIIDfjCCAmagAwIBAQICJxAwDQYJKoZIhvcNAQEFBQAwgYExCzAJBgNVBAYTAlVT\r\n" . "MRIwEAYDVQQIEwlMYXMgVmVnYXMxEjAQBgNVBAcTCUxhcyBWZWdhczEYMBYGA1UE\r\n" . "ChMPTGF1bmNoS2V5LCBJbmMuMRgwFgYDVQQLEw9MYXVuY2hLZXksIEluYy4xFjAU\r\n" . "BgNVBAMTDWxhdW5jaGtleS5jb20wHhcNMTUxMTAyMjMyNzQ5WhcNMTYxMTAxMjMy\r\n" . "NzQ5WjCBgTELMAkGA1UEBhMCVVMxEjAQBgNVBAgTCUxhcyBWZWdhczESMBAGA1UE\r\n" . "BxMJTGFzIFZlZ2FzMRgwFgYDVQQKEw9MYXVuY2hLZXksIEluYy4xGDAWBgNVBAsT\r\n" . "D0xhdW5jaEtleSwgSW5jLjEWMBQGA1UEAxMNbGF1bmNoa2V5LmNvbTCCASIwDQYJ\r\n" . "KoZIhvcNAQEBBQADggEPADCCAQoCggEBAN1Q3Og6izyf35UaeivS88Wlzjdz2yPm\r\n" . "juOge/awYJa8V2dED0oCjdAxex9Ak8lEE9naD6ZcuA0Kta5mHKk1ho5Z4aq1493w\r\n" . "HFbPbzVFldBAzFqig7m5/k1B/QY8w7CP1QG5aM9ebQeCJwdhz7UBmNQL2r2K02zn\r\n" . "2DFhEuus1YKM+pfSO2I+yTd/AyBtq4zu+LusibNoU9ADKQ3IoJtzyZ+CUuuOG3jz\r\n" . "Z+zwuzH/0hpuTs6TnBSAGYD1Xow2X7lULLzXwZ4R3SopTesncIbXLa2luTLQIody\r\n" . "uA/gSirbW7g02zQ8G3JcO+ce6UnusklzvdBPoJ2vttpDEsWlNqbSTWcCAwEAATAN\r\n" . "BgkqhkiG9w0BAQUFAAOCAQEARz9V7cBG2et/741mdtbspQTN4HF0hUp3NEJzBrP/\r\n" . "YtdMYIVAUh2sc3sf/oiakLgqYBA78rSk9CbNlv4EJ/FEC/5X3l1o9h5dFLXt40LL\r\n" . "4I+ijYY3BlsgRL9K2CNYRCq1bJX8xlcY0hVqqsZipzR4zeyqQVMLXH/zSScTrF5j\r\n" . "b5KQcYFiRP7AF30OtGoZxhnsDUcErhdWY5lGvaSex6LsOC2UGtmwK3FWu+NMDzL0\r\n" . "+ovdBGpsmDp3IN1AKwd9/6EQ3XbQPyXoXpW0TCBzs/OxGqnhiJD9rROCtVl1SJze\r\n" . "LWllWSmosQFhsXwSO5ZlnechO+SMaxN7OrV7POOv8aRcpQ==\r\n" . "-----END CERTIFICATE-----\n";
     static::$key = new XMLSecurityKey(XMLSecurityKey::RSA_SHA1, array('type' => 'public'));
     static::$key->loadKey($cert, false, true);
     static::$response_data = "PG5zMDpSZXNwb25zZSB4bWxuczpuczA9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMDpwcm90b2Nv" . "bCIgeG1sbnM6bnMxPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6YXNzZXJ0aW9uIiB4bWxuczp" . "uczI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NvbS9pZHAueG1sPC9uczE6QXV0aGVudGljYXRpbmd" . "BdXRob3JpdHk+PC9uczE6QXV0aG5Db250ZXh0PjwvbnMxOkF1dGhuU3RhdGVtZW50PjxuczE6QXR0cm" . "lidXRlU3RhdGVtZW50PjxuczE6QXR0cmlidXRlIE5hbWU9ImFrZXkiIE5hbWVGb3JtYXQ9InVybjpvY" . "XNpczpuYW1lczp0YzpTQU1MOjIuMDphdHRybmFtZS1mb3JtYXQ6dXJpIj48bnMxOkF0dHJpYnV0ZVZh" . "bHVlIHhzaTp0eXBlPSJ4czpzdHJpbmciPmF2YWx1ZTwvbnMxOkF0dHJpYnV0ZVZhbHVlPjwvbnMxOkF" . "0dHJpYnV0ZT48L25zMTpBdHRyaWJ1dGVTdGF0ZW1lbnQ+PC9uczE6QXNzZXJ0aW9uPjwvbnMwOlJlc3" . "BvbnNlPg==";
 }
开发者ID:aenglander,项目名称:launchkey-wordpress,代码行数:7,代码来源:class-launchkey-wp-saml2-response-service-test.php

示例8: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     $cert = "-----BEGIN CERTIFICATE-----\n" . "MIIDfjCCAmagAwIBAQICJxAwDQYJKoZIhvcNAQEFBQAwgYExCzAJBgNVBAYTAlVT\r\n" . "MRIwEAYDVQQIEwlMYXMgVmVnYXMxEjAQBgNVBAcTCUxhcyBWZWdhczEYMBYGA1UE\r\n" . "ChMPTGF1bmNoS2V5LCBJbmMuMRgwFgYDVQQLEw9MYXVuY2hLZXksIEluYy4xFjAU\r\n" . "BgNVBAMTDWxhdW5jaGtleS5jb20wHhcNMTUxMTAyMjMyNzQ5WhcNMTYxMTAxMjMy\r\n" . "NzQ5WjCBgTELMAkGA1UEBhMCVVMxEjAQBgNVBAgTCUxhcyBWZWdhczESMBAGA1UE\r\n" . "BxMJTGFzIFZlZ2FzMRgwFgYDVQQKEw9MYXVuY2hLZXksIEluYy4xGDAWBgNVBAsT\r\n" . "D0xhdW5jaEtleSwgSW5jLjEWMBQGA1UEAxMNbGF1bmNoa2V5LmNvbTCCASIwDQYJ\r\n" . "KoZIhvcNAQEBBQADggEPADCCAQoCggEBAN1Q3Og6izyf35UaeivS88Wlzjdz2yPm\r\n" . "juOge/awYJa8V2dED0oCjdAxex9Ak8lEE9naD6ZcuA0Kta5mHKk1ho5Z4aq1493w\r\n" . "HFbPbzVFldBAzFqig7m5/k1B/QY8w7CP1QG5aM9ebQeCJwdhz7UBmNQL2r2K02zn\r\n" . "2DFhEuus1YKM+pfSO2I+yTd/AyBtq4zu+LusibNoU9ADKQ3IoJtzyZ+CUuuOG3jz\r\n" . "Z+zwuzH/0hpuTs6TnBSAGYD1Xow2X7lULLzXwZ4R3SopTesncIbXLa2luTLQIody\r\n" . "uA/gSirbW7g02zQ8G3JcO+ce6UnusklzvdBPoJ2vttpDEsWlNqbSTWcCAwEAATAN\r\n" . "BgkqhkiG9w0BAQUFAAOCAQEARz9V7cBG2et/741mdtbspQTN4HF0hUp3NEJzBrP/\r\n" . "YtdMYIVAUh2sc3sf/oiakLgqYBA78rSk9CbNlv4EJ/FEC/5X3l1o9h5dFLXt40LL\r\n" . "4I+ijYY3BlsgRL9K2CNYRCq1bJX8xlcY0hVqqsZipzR4zeyqQVMLXH/zSScTrF5j\r\n" . "b5KQcYFiRP7AF30OtGoZxhnsDUcErhdWY5lGvaSex6LsOC2UGtmwK3FWu+NMDzL0\r\n" . "+ovdBGpsmDp3IN1AKwd9/6EQ3XbQPyXoXpW0TCBzs/OxGqnhiJD9rROCtVl1SJze\r\n" . "LWllWSmosQFhsXwSO5ZlnechO+SMaxN7OrV7POOv8aRcpQ==\r\n" . "-----END CERTIFICATE-----\n";
     static::$key = new XMLSecurityKey(XMLSecurityKey::RSA_SHA1, array('type' => 'public'));
     static::$key->loadKey($cert, false, true);
     static::$request_data = "PG5zMDpMb2dvdXRSZXF1ZXN0IHhtbG5zOm5zMD0idXJuOm9hc2lzOm5hbWVzOnRjOlNBTUw6Mi4wOnByb3R" . "vY29sIiB4bWxuczpu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k" . "FBT0NBUUVBUno5VjdjQkcyZXQvNzQxbWR0YnNwUVRONEhGMGhVcDNORUp6QnJQL1l0ZE1ZSVZBVWgyc2Mzc" . "2Yvb2lha0xncVlCQTc4clNrOUNiTmx2NEVKL0ZFQy81WDNsMW85aDVkRkxYdDQwTEw0SStpallZM0Jsc2dS" . "TDlLMkNOWVJDcTFiSlg4eGxjWTBoVnFxc1ppcHpSNHpleXFRVk1MWEgvelNTY1RyRjVqYjVLUWNZRmlSUDd" . "BRjMwT3RHb1p4aG5zRFVjRXJoZFdZNWxHdmFTZXg2THNPQzJVR3Rtd0szRld1K05NRHpMMCtvdmRCR3BzbU" . "RwM0lOMUFLd2Q5LzZFUTNYYlFQeVhvWHBXMFRDQnpzL094R3FuaGlKRDlyUk9DdFZsMVNKemVMV2xsV1Ntb" . "3NRRmhzWHdTTzVabG5lY2hPK1NNYXhON09yVjdQT092OGFSY3BRPT08L25zMjpYNTA5Q2VydGlmaWNhdGU+" . "PC9uczI6WDUwOURhdGE+PC9uczI6S2V5SW5mbz48L25zMjpTaWduYXR1cmU+PG5zMTpOYW1lSUQ+dGVzdGV" . "tYWlsQHRlc3RtZS5vcmc8L25zMTpOYW1lSUQ+PG5zMDpTZXNzaW9uSW5kZXg+aWQtMDcyNjAyMjVmZTdkMW" . "UyZWU4Zjg4Njg0NmNjNDBhZmE8L25zMDpTZXNzaW9uSW5kZXg+PC9uczA6TG9nb3V0UmVxdWVzdD4=";
 }
开发者ID:aenglander,项目名称:launchkey-wordpress,代码行数:7,代码来源:class-launchkey-wp-saml2-request-service-test.php

示例9: processDocument

function processDocument()
{
    global $src_file, $target_file, $user_pubkey_file_path, $user_cert_file_path;
    require dirname(__FILE__) . '/xmlseclibs.php';
    if (file_exists($target_file)) {
        unlink($target_file);
    }
    $doc = new DOMDocument();
    $doc->load($src_file);
    $objDSig = new XMLSecurityDSig();
    $objDSig->setCanonicalMethod(XMLSecurityDSig::EXC_C14N);
    $objDSig->addReference($doc, XMLSecurityDSig::SHA1, array('http://www.w3.org/2000/09/xmldsig#enveloped-signature'));
    /* gako pribatu bat behar dugu prozesua burutzeko. orain edozein erabiliko dugu. gero txartelekoarekin ordezkatzeko */
    $objKey = new XMLSecurityKey(XMLSecurityKey::RSA_SHA1, array('type' => 'private'));
    /* if key has Passphrase, set it using $objKey->passphrase = <passphrase> " */
    $objKey->loadKey(dirname(__FILE__) . '/privkey.pem', TRUE);
    $objDSig->sign($objKey);
    /* Add associated public key */
    // $objDSig->add509Cert(file_get_contents(dirname(__FILE__) . '/mycert.pem'));
    // $objDSig->add509Cert(file_get_contents($user_cert_file_path));
    if (!file_exists($user_cert_file_path)) {
        debug('File not found', $user_cert_file_path);
    } else {
        $objDSig->add509Cert($user_cert_file_path);
    }
    $objDSig->appendSignature($doc->documentElement);
    $doc->save($target_file);
}
开发者ID:Esleelkartea,项目名称:legedia-ESLE,代码行数:28,代码来源:index.php

示例10: testThumbPrint

 public function testThumbPrint()
 {
     $siteKey = new XMLSecurityKey(XMLSecurityKey::RSA_OAEP_MGF1P, array('type' => 'public'));
     $siteKey->loadKey(dirname(__FILE__) . '/../mycert.pem', true, true);
     $thumbprint = $siteKey->getX509Thumbprint();
     $this->assertEquals('8b600d9155e8e8dfa3c10998f736be086e83ef3b', $thumbprint, "Thumbprint doesn't match");
     $this->assertEquals('OGI2MDBkOTE1NWU4ZThkZmEzYzEwOTk4ZjczNmJlMDg2ZTgzZWYzYg==', base64_encode($thumbprint), "Base64 Thumbprint doesn't match");
 }
开发者ID:ddvzwzjm,项目名称:xmlseclibs,代码行数:8,代码来源:XMLSecurityKeyTest.php

示例11: convertPrivateKeyToRsaKey

 /**
  * @param SAML2_Certificate_PrivateKey $privateKey
  *
  * @return XMLSecurityKey
  * @throws Exception
  */
 private function convertPrivateKeyToRsaKey(SAML2_Certificate_PrivateKey $privateKey)
 {
     $key = new XMLSecurityKey(XMLSecurityKey::RSA_1_5, array('type' => 'private'));
     $passphrase = $privateKey->getPassphrase();
     if ($passphrase) {
         $key->passphrase = $passphrase;
     }
     $key->loadKey($privateKey->getKeyAsString());
     return $key;
 }
开发者ID:Shalmezad,项目名称:saml2,代码行数:16,代码来源:PrivateKeyLoader.php

示例12: __doRequest

 function __doRequest($request, $location, $saction, $version)
 {
     $doc = new DOMDocument('1.0');
     $doc->loadXML($request);
     $objWSSE = new WSSESoap($doc);
     $objKey = new XMLSecurityKey(XMLSecurityKey::RSA_SHA1, array('type' => 'private'));
     $objKey->loadKey(PRIVATE_KEY, TRUE);
     $options = array("insertBefore" => TRUE);
     $objWSSE->signSoapDoc($objKey, $options);
     $objWSSE->addIssuerSerial(CERT_FILE);
     $objKey = new XMLSecurityKey(XMLSecurityKey::AES256_CBC);
     $objKey->generateSessionKey();
     #está wea está rara, no pasa el wsdl y cambía el puerto o.O
     $location = "https://201.238.207.130:7200/WSWebpayTransaction/cxf/WSWebpayService?wsdl";
     #die($location);
     #die(CERT_FILE." ".PRIVATE_KEY);
     $retVal = parent::__doRequest($objWSSE->saveXML(), $location, $saction, $version);
     $doc = new DOMDocument();
     $doc->loadXML($retVal);
     return $doc->saveXML();
     /*
     if ($this->useSSL){ 
             $locationparts = parse_url($location); 
             $location = 'https://'; 
             if(isset($locationparts['host']))  $location .= $locationparts['host']; 
             if(isset($locationparts['port']))  $location .= ':'.$locationparts['port']; 
             if(isset($locationparts['path']))  $location .= $locationparts['path']; 
             if(isset($locationparts['query'])) $location .= '?'.$locationparts['query']; 
     }
     
     $doc = new DOMDocument('1.0'); 
     $doc->loadXML($request); 
     
     $objWSSE = new WSSESoap($doc); 
     $objKey = new XMLSecurityKey(XMLSecurityKey::RSA_SHA1,array('type' => 'private')); 
     $objKey->loadKey(PRIVATE_KEY, TRUE);
     
     $options = array("insertBefore" => TRUE); 
     
     $objWSSE->signSoapDoc($objKey, $options); 
     $objWSSE->addIssuerSerial(CERT_FILE);
     
     $objKey = new XMLSecurityKey(XMLSecurityKey::AES256_CBC); 
     $objKey->generateSessionKey(); 
     
     $retVal = parent::__doRequest($objWSSE->saveXML(), $location, $saction, $version); 
     
     $doc = new DOMDocument(); 
     $doc->loadXML($retVal); 
     return $doc->saveXML(); 
     */
 }
开发者ID:cstamariab,项目名称:API-SOAP-WebPay---PHP,代码行数:52,代码来源:MySoap.php

示例13: getRequest

 /**
  * @return \AerialShip\LightSaml\Model\Protocol\AuthnRequest
  */
 protected function getRequest()
 {
     $request = CommonHelper::buildAuthnRequestFromEntityDescriptors(__DIR__ . '/../../../../../resources/sample/EntityDescriptor/sp-ed2.xml', __DIR__ . '/../../../../../resources/sample/EntityDescriptor/idp2-ed.xml');
     $certificate = new X509Certificate();
     $certificate->loadFromFile(__DIR__ . '/../../../../../resources/sample/Certificate/saml.crt');
     $key = new \XMLSecurityKey(\XMLSecurityKey::RSA_SHA1, array('type' => 'private'));
     $key->loadKey(__DIR__ . '/../../../../../resources/sample/Certificate/saml.pem', true, false);
     $signature = new SignatureCreator();
     $signature->setCertificate($certificate);
     $signature->setXmlSecurityKey($key);
     $request->setSignature($signature);
     $request->setRelayState($this->relayState);
     return $request;
 }
开发者ID:LearnerNation,项目名称:lightsaml,代码行数:17,代码来源:Base.php

示例14: signXML

function signXML($token, $privkey)
{
    $sigdoc = new DOMDocument();
    if (!$sigdoc->loadXML($token)) {
        throw new Exception("Invalid XML!");
    }
    $sigNode = $sigdoc->firstChild;
    $enc = new XMLSecurityDSig();
    $enc->idKeys[] = 'ID';
    $enc->setCanonicalMethod(XMLSecurityDSig::EXC_C14N);
    $enc->addReference($sigNode, XMLSecurityDSig::SHA1, array('http://www.w3.org/2000/09/xmldsig#enveloped-signature', XMLSecurityDSig::EXC_C14N));
    $key = new XMLSecurityKey(XMLSecurityKey::RSA_SHA1, array('type' => 'private', 'library' => 'openssl'));
    $key->loadKey($privkey, false, false);
    $enc->sign($key);
    $enc->appendSignature($sigNode);
    return $sigdoc->saveXML();
}
开发者ID:GajendraNaidu,项目名称:openam,代码行数:17,代码来源:saml-lib.php

示例15: testAuthnRequestBuilder

 /**
  * @dataProvider provider
  */
 public function testAuthnRequestBuilder($name, array $idpData, array $spData, array $spMetaData, $expectedSendUrl, $expectedResponseType, $expectedReceiveUrl, $expectedReceiveBinding, $expectedException = null, $expectedExceptionMessage = '')
 {
     if ($expectedException) {
         $this->setExpectedException($expectedException, $expectedExceptionMessage);
     }
     $idp = new IdpSsoDescriptor();
     foreach ($idpData as $data) {
         $idp->addService(new SingleSignOnService($data['binding'], $data['url']));
     }
     $edIDP = new EntityDescriptor('idp');
     $edIDP->addItem($idp);
     $sp = new SpSsoDescriptor();
     foreach ($spData as $data) {
         $sp->addService(new AssertionConsumerService($data['binding'], $data['url']));
     }
     $edSP = new EntityDescriptor('sp');
     $edSP->addItem($sp);
     $spMeta = new SpMeta();
     foreach ($spMetaData as $name => $value) {
         $spMeta->{$name}($value);
     }
     // without signing
     $builder = new AuthnRequestBuilder($edSP, $edIDP, $spMeta);
     $message = $builder->build();
     $response = $builder->send($message);
     $this->assertStringStartsWith($expectedSendUrl, $response->getDestination(), $name);
     $this->assertInstanceOf($expectedResponseType, $response, $name);
     $this->assertEquals($expectedReceiveUrl, $message->getAssertionConsumerServiceURL(), $name);
     $this->assertEquals($expectedReceiveBinding, $message->getProtocolBinding(), $name);
     // with signing
     $signature = new SignatureCreator();
     $certificate = new X509Certificate();
     $certificate->loadFromFile(__DIR__ . '/../../../../../resources/sample/Certificate/saml.crt');
     $key = new \XMLSecurityKey(\XMLSecurityKey::RSA_SHA1, array('type' => 'private'));
     $key->loadKey(__DIR__ . '/../../../../../resources/sample/Certificate/saml.pem', true);
     $signature->setCertificate($certificate);
     $signature->setXmlSecurityKey($key);
     $builder = new AuthnRequestBuilder($edSP, $edIDP, $spMeta, $signature);
     $message = $builder->build();
     $response = $builder->send($message);
     $this->assertStringStartsWith($expectedSendUrl, $response->getDestination(), $name);
     $this->assertInstanceOf($expectedResponseType, $response, $name);
     $this->assertEquals($expectedReceiveUrl, $message->getAssertionConsumerServiceURL(), $name);
     $this->assertEquals($expectedReceiveBinding, $message->getProtocolBinding(), $name);
 }
开发者ID:aerialship,项目名称:lightsaml,代码行数:48,代码来源:AuthnRequestBuilderTest.php


注:本文中的XMLSecurityKey类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。