public static function signForApp($bytes_to_sign) {
    $req = new SignForAppRequest();
    $resp = new SignForAppResponse();

    if (!is_string($bytes_to_sign)) {
      throw new \InvalidArgumentException('$bytes_to_sign must be a string.');
    }

    $req->setBytesToSign($bytes_to_sign);

    try {
      ApiProxy::makeSyncCall(self::PACKAGE_NAME, 'SignForApp', $req, $resp);
    } catch (ApplicationError $e) {
      throw self::applicationErrorToException($e);
    }

    return [
      'key_name' => $resp->getKeyName(),
      'signature' => $resp->getSignatureBytes(),
    ];
  }
public static function signForApp($bytes_to_sign) {
    $req = new SignForAppRequest();
    $resp = new SignForAppResponse();

    if (!is_string($bytes_to_sign)) {
      throw new \InvalidArgumentException('$bytes_to_sign must be a string.');
    }

    $req->setBytesToSign($bytes_to_sign);

    try {
      ApiProxy::makeSyncCall(self::PACKAGE_NAME, 'SignForApp', $req, $resp);
    } catch (ApplicationError $e) {
      throw self::applicationErrorToException($e);
    }

    return [
      'key_name' => $resp->getKeyName(),
      'signature' => $resp->getSignatureBytes(),
    ];
  }
public static function signForApp ( $ bytes_to_sign ) { $ req = new SignForAppRequest ( ) ; $ resp = new SignForAppResponse ( ) ; if ( ! is_string ( $ bytes_to_sign ) ) { throw new \ InvalidArgumentException ( '$bytes_to_sign must be a string.' ) ; } $ req -> setBytesToSign ( $ bytes_to_sign ) ; try { ApiProxy :: makeSyncCall ( self :: PACKAGE_NAME , 'SignForApp' , $ req , $ resp ) ; } catch ( ApplicationError $ e ) { throw self :: applicationErrorToException ( $ e ) ; } return [ 'key_name' => $ resp -> getKeyName ( ) , 'signature' => $ resp -> getSignatureBytes ( ) , ] ; }
Signs arbitrary byte array using per app private key.

@param string $bytes_to_sign The bytes to generate the signature for.

@throws \InvalidArgumentException If $bytes_to_sign is not a string.
@throws AppIdentityException If there is an error using the AppIdentity
service.

@return array An array containing the elements
'key_name' - the name of the key used to sign the bytes
'signature' - the signature of the bytes.
Signs arbitrary byte array using per app private key .