/** * Constructor for the metadata signer. * * You can pass an list of options as key-value pairs in the array. This allows you to initialize * a metadata signer in one call. * * The following keys are recognized: * - privatekey The file with the private key, relative to the cert-directory. * - privatekey_pass The passphrase for the private key. * - certificate The file with the certificate, relative to the cert-directory. * - privatekey_array The private key, as an array returned from SimpleSAML_Utilities::loadPrivateKey. * - publickey_array The public key, as an array returned from SimpleSAML_Utilities::loadPublicKey. * - id The name of the ID attribute. * * @param $options Associative array with options for the constructor. Defaults to an empty array. */ public function __construct($options = array()) { assert('is_array($options)'); if (self::$certDir === FALSE) { $config = SimpleSAML_Configuration::getInstance(); self::$certDir = $config->getPathValue('certdir', 'cert/'); } $this->idAttrName = FALSE; $this->privateKey = FALSE; $this->certificate = FALSE; $this->extraCertificates = array(); if (array_key_exists('privatekey', $options)) { $pass = NULL; if (array_key_exists('privatekey_pass', $options)) { $pass = $options['privatekey_pass']; } $this->loadPrivateKey($options['privatekey'], $pass); } if (array_key_exists('certificate', $options)) { $this->loadCertificate($options['certificate']); } if (array_key_exists('privatekey_array', $options)) { $this->loadPrivateKeyArray($options['privatekey_array']); } if (array_key_exists('publickey_array', $options)) { $this->loadPublicKeyArray($options['publickey_array']); } if (array_key_exists('id', $options)) { $this->setIdAttribute($options['id']); } }