public PublicKey getKey(PublicKeyDataObject publicKeyDataObject)
      throws EACException, InvalidKeySpecException {
    if (publicKeyDataObject.getUsage().on(EACObjectIdentifiers.id_TA_ECDSA)) {
      return getECPublicKeyPublicKey((ECDSAPublicKey) publicKeyDataObject);
    } else {
      RSAPublicKey pubKey = (RSAPublicKey) publicKeyDataObject;
      RSAPublicKeySpec pubKeySpec =
          new RSAPublicKeySpec(pubKey.getModulus(), pubKey.getPublicExponent());

      try {
        KeyFactory factk = helper.createKeyFactory("RSA");

        return factk.generatePublic(pubKeySpec);
      } catch (NoSuchProviderException e) {
        throw new EACException("cannot find provider: " + e.getMessage(), e);
      } catch (NoSuchAlgorithmException e) {
        throw new EACException("cannot find algorithm ECDSA: " + e.getMessage(), e);
      }
    }
  }