code: public static byte[] sign(
        Signature signatureAlgorithm, PrivateKey privateKey, byte[] contentBytes)
        throws InvalidKeyException, SignatureException {
      signatureAlgorithm.initSign(privateKey);
      signatureAlgorithm.update(contentBytes);
      return signatureAlgorithm.sign();
    }
docs: Signs content using a private key.
  
  @param signatureAlgorithm signature algorithm
  @param privateKey private key
  @param contentBytes content to sign
  @return signed content