code: public void clearSign(InputStream input, OutputStream output) throws IOException, PGPException, GeneralSecurityException {
  
          PGPSignatureGenerator signatureGenerator = new PGPSignatureGenerator(new BcPGPContentSignerBuilder(privateKey.getPublicKeyPacket().getAlgorithm(), digest));
          signatureGenerator.init(PGPSignature.CANONICAL_TEXT_DOCUMENT, privateKey);
  
          ArmoredOutputStream armoredOutput = new ArmoredOutputStream(output);
          armoredOutput.beginClearText(digest);
  
          LineIterator iterator = new LineIterator(new InputStreamReader(input));
  
          while (iterator.hasNext()) {
              String line = iterator.nextLine();
  
              // trailing spaces must be removed for signature calculation (see http://tools.ietf.org/html/rfc4880#section-7.1)
              byte[] data = trim(line).getBytes("UTF-8");
  
              armoredOutput.write(data);
              armoredOutput.write(EOL);
  
              signatureGenerator.update(data);
              if (iterator.hasNext()) {
                  signatureGenerator.update(EOL);
              }
          }
  
          armoredOutput.endClearText();
  
          PGPSignature signature = signatureGenerator.generate();
          signature.encode(new BCPGOutputStream(armoredOutput));
  
          armoredOutput.close();
      }
docs: Creates a clear sign signature over the input data. (Not detached)
  
  @param input      the content to be signed
  @param output     the output destination of the signature