public static function createAppCSR($keyPair, $dn) {
    $privKey = new \Crypt_RSA();
    $privKey->loadKey($keyPair['privatekey']);

    $pubKey = new \Crypt_RSA();
    $pubKey->loadKey($keyPair['publickey']);
    $pubKey->setPublicKey();

    $x509 = new \File_X509();
    $x509->setPrivateKey($privKey);
    $x509->setDN($dn);

    $x509->loadCSR($x509->saveCSR($x509->signCSR(Constants::CERT_SIGNATURE_ALGORITHM)));
    $x509->setExtension('id-ce-keyUsage', array('keyEncipherment'));

    $csrData = $x509->signCSR(Constants::CERT_SIGNATURE_ALGORITHM);
    return $x509->saveCSR($csrData);
  }
public static function createAppCSR($keyPair, $dn) {
    $privKey = new \Crypt_RSA();
    $privKey->loadKey($keyPair['privatekey']);

    $pubKey = new \Crypt_RSA();
    $pubKey->loadKey($keyPair['publickey']);
    $pubKey->setPublicKey();

    $x509 = new \File_X509();
    $x509->setPrivateKey($privKey);
    $x509->setDN($dn);

    $x509->loadCSR($x509->saveCSR($x509->signCSR(Constants::CERT_SIGNATURE_ALGORITHM)));
    $x509->setExtension('id-ce-keyUsage', array('keyEncipherment'));

    $csrData = $x509->signCSR(Constants::CERT_SIGNATURE_ALGORITHM);
    return $x509->saveCSR($csrData);
  }
public static function createAppCSR ( $ keyPair , $ dn ) { $ privKey = new \ Crypt_RSA ( ) ; $ privKey -> loadKey ( $ keyPair [ 'privatekey' ] ) ; $ pubKey = new \ Crypt_RSA ( ) ; $ pubKey -> loadKey ( $ keyPair [ 'publickey' ] ) ; $ pubKey -> setPublicKey ( ) ; $ x509 = new \ File_X509 ( ) ; $ x509 -> setPrivateKey ( $ privKey ) ; $ x509 -> setDN ( $ dn ) ; $ x509 -> loadCSR ( $ x509 -> saveCSR ( $ x509 -> signCSR ( Constants :: CERT_SIGNATURE_ALGORITHM ) ) ) ; $ x509 -> setExtension ( 'id-ce-keyUsage' , array ( 'keyEncipherment' ) ) ; $ csrData = $ x509 -> signCSR ( Constants :: CERT_SIGNATURE_ALGORITHM ) ; return $ x509 -> saveCSR ( $ csrData ) ; }
Create a CSR for a CiviConnect application.

@param array $keyPair
Array with elements:
- privatekey: string.
- publickey: string.
@param string $dn
Distinguished name.
@return string
CSR data.
Create a CSR for a CiviConnect application .