I think this should be $project->getSshPublicKey() not getPublicKey() ?