rem generates several self signed keys <name>.cer, <name>.jks, and <name>.p12 .
rem Truststore is set with name truststore.jks and set password of password12345

rem usage: createKey.bat <user> <password>
rem        createKey.bat somebody password123

set NAME=%1%
set PASSWORD=%2%
set STORE_PASSWORD=password12345

echo 'Creating key for ' %NAME% ' using password ' %PASSWORD%

keytool -genkey -alias %NAME% -keyalg RSA -keysize 1024 -dname "CN=NiFi %NAME%, OU=SCC,O=SCC,L=Annapolis,S=Maryland,C=US" -keypass %PASSWORD% -keystore  %NAME%.jks -storepass %PASSWORD% -validity 360

keytool -importkeystore -srckeystore  %NAME%.jks -destkeystore %NAME%.p12 -srcstoretype JKS -deststoretype PKCS12 -srcstorepass %PASSWORD% -deststorepass %PASSWORD% -srcalias %NAME% -destalias %NAME% -srckeypass %PASSWORD% -destkeypass

%PASSWORD% -noprompt

keytool -export -keystore  %NAME%.jks -storepass %PASSWORD% -alias %NAME% -file %NAME%.cer

#keytool -import -trustcacerts -file %NAME%.cer -alias %NAME% -keystore truststore.jks -storepass %STORE_PASSWORD% -noprompt
keytool -import -trustcacerts -file %NAME%.cer -alias %NAME% -keystore truststore.jks -storepass password12345 -noprompt

echo 'Done creating key for ' %NAME%

keytool -list -keystore truststore.jks -storepass password12345 -noprompt

.... The ONE silver lining for all of your software needs!

NiFi Lesson 10: java file source code.

package scc.processors.demo;

import org.apache.nifi.components.PropertyDescriptor;
import org.apache.nifi.components.PropertyValue;
import org.apache.nifi.flowfile.FlowFile;
import org.apache.nifi.processor.*;
import org.apache.nifi.annotation.behavior.ReadsAttribute;
import org.apache.nifi.annotation.behavior.ReadsAttributes;
import org.apache.nifi.annotation.behavior.WritesAttribute;
import org.apache.nifi.annotation.behavior.WritesAttributes;
import org.apache.nifi.annotation.lifecycle.OnScheduled;
import org.apache.nifi.annotation.documentation.CapabilityDescription;
import org.apache.nifi.annotation.documentation.SeeAlso;
import org.apache.nifi.annotation.documentation.Tags;
import org.apache.nifi.processor.exception.ProcessException;
import org.apache.nifi.processor.util.StandardValidators;

import java.util.*;

@Tags({ "example" })
@CapabilityDescription("Provide a description")
@ReadsAttributes({ @ReadsAttribute(attribute = "", description = "") })
@WritesAttributes({ @WritesAttribute(attribute = "", description = "") })
public class FileSizeFilter extends AbstractProcessor {

    private static int MAX_FILE_SIZE = 0;

    public static final Relationship SUCCESS_RELATIONSHIP = new Relationship.Builder()
            .name("pass the file")
            .description("this file will be passed on to success").build();

    public static final Relationship FAIL_RELATIONSHIP = new Relationship.Builder()
            .name("do NOT pass the file")
            .description("this file will NOT be passed on to success").build();

    public static final PropertyDescriptor MAX_FILE_SIZE_ATTRIBUTE_PROPERTY = new PropertyDescriptor.Builder()
            .name("Max File Size Attribute")
                    "This is the name of the attribute that contains the file size")

    private List<PropertyDescriptor> descriptors;

    private Set<Relationship> relationships;

    protected void init(final ProcessorInitializationContext context) {
        final List<PropertyDescriptor> descriptors = new ArrayList<PropertyDescriptor>();
        this.descriptors = Collections.unmodifiableList(descriptors);

        final Set<Relationship> relationships = new HashSet<Relationship>();

        this.relationships = Collections.unmodifiableSet(relationships);

    public Set<Relationship> getRelationships() {
        return this.relationships;

    public final List<PropertyDescriptor> getSupportedPropertyDescriptors() {
        return descriptors;

    public void onScheduled(final ProcessContext context) {


    public void onTrigger(final ProcessContext context,
            final ProcessSession session) throws ProcessException {
        FlowFile flowFile = session.get();
        if (flowFile == null) {

        String attributeMax = context.getProperty(
        getLogger().info("Got a flow file");

        if (flowFile.getAttribute(attributeMax) != null) {
            MAX_FILE_SIZE = Integer.parseInt(flowFile
                    "Reset MAX file size value to " + MAX_FILE_SIZE
                            + "   Attrib Ref:" + attributeMax);

        if (flowFile.getSize() < MAX_FILE_SIZE) {
                    "File passed, size is less than " + MAX_FILE_SIZE + "("
                            + flowFile.getSize() + " )");
            session.transfer(flowFile, SUCCESS_RELATIONSHIP);
        } else {
                    "File NOT passed, size is more than " + MAX_FILE_SIZE + "("
                            + flowFile.getSize() + " )");
            session.transfer(flowFile, FAIL_RELATIONSHIP);