class SignatureKeyManager {

  public KeyPair getOrCreateKeyPair(String workspaceId) throws SignatureKeyManagerException {
    SignatureKeyPair keyPair;
    try {
      try {
        keyPair = signatureKeyDao.get(workspaceId);
      } catch (NotFoundException e) {
        keyPair = generateKeyPair(workspaceId);
      }
    } catch (NoSuchAlgorithmException | ServerException | ConflictException ex) {
      LOG.error(
          "Failed to load signature keys for ws  {}. Cause: {}", workspaceId, ex.getMessage());
      throw new SignatureKeyManagerException(ex.getMessage(), ex);
    }
    return toJavaKeyPair(keyPair);
  }

  @Inject public  SignatureKeyManager(
      @Named("che.auth.signature_key_size") int keySize,
      @Named("che.auth.signature_key_algorithm") String algorithm,
      EventService eventService,
      SignatureKeyDao signatureKeyDao);

}