SAML2\CertificatesMock::getPublicKey PHP Method

getPublicKey() public static method

public static getPublicKey ( ) : XMLSecurityKey
return RobRichards\XMLSecLibs\XMLSecurityKey
    public static function getPublicKey()
    {
        $publicKey = new XMLSecurityKey(XMLSecurityKey::RSA_1_5, array('type' => 'public'));
        $publicKey->loadKey(self::PUBLIC_KEY_PEM);
        return $publicKey;
    }

Usage Example

 /**
  * Test that signatures no longer validate if the value has been tampered with.
  */
 public function testValidateWithValueTampering()
 {
     // Test modification of SignatureValue.
     $signedMockElementCopy = Utils::copyElement($this->signedMockElement);
     $signedMockElementCopy->ownerDocument->appendChild($signedMockElementCopy);
     $digestValueElements = Utils::xpQuery($signedMockElementCopy, '/root/ds:Signature/ds:SignatureValue');
     $this->assertCount(1, $digestValueElements);
     $digestValueElements[0]->firstChild->data = 'invalid';
     $tmp = new SignedElementHelperMock($signedMockElementCopy);
     $this->setExpectedException('Exception', 'Unable to validate Signature');
     $tmp->validate(CertificatesMock::getPublicKey());
 }
All Usage Examples Of SAML2\CertificatesMock::getPublicKey