class CipherDetector extends BasicInjectionDetector {


    private static final String DES_USAGE_TYPE = "DES_USAGE";

    private static final InvokeMatcherBuilder CIPHER_GET_INSTANCE = invokeInstruction()
            .atClass("javax/crypto/Cipher")
            .atMethod("getInstance")
            .withArgs("(Ljava/lang/String;)Ljavax/crypto/Cipher;");
    private static final InvokeMatcherBuilder CIPHER_GET_INSTANCE_PROVIDER = invokeInstruction()
            .atClass("javax/crypto/Cipher")
            .atMethod("getInstance")
            .withArgs("(Ljava/lang/String;Ljava/lang/String;)Ljavax/crypto/Cipher;",
                    "(Ljava/lang/String;Ljava/security/Provider;)Ljavax/crypto/Cipher;");

    private static final InvokeMatcherBuilder KEYGENERATOR_GET_INSTANCE = invokeInstruction()
            .atClass("javax/crypto/KeyGenerator")
            .atMethod("getInstance")
            .withArgs("(Ljava/lang/String;)Ljavax/crypto/KeyGenerator;");
    private static final InvokeMatcherBuilder KEYGENERATOR_GET_INSTANCE_PROVIDER = invokeInstruction()
            .atClass("javax/crypto/KeyGenerator")
            .atMethod("getInstance")
            .withArgs("(Ljava/lang/String;Ljava/lang/String;)Ljavax/crypto/KeyGenerator;",
                    "(Ljava/lang/String;Ljava/security/Provider;)Ljavax/crypto/KeyGenerator;");


    public CipherDetector(BugReporter bugReporter) {
        super(bugReporter);
    }

    /**
     * Hook Cipher.getInstance(), KeyGenerator.getInstance()
     * @param invoke
     * @param cpg
     * @param handle
     * @return
     */
    @Override
    protected InjectionPoint getInjectionPoint(InvokeInstruction invoke, ConstantPoolGen cpg,
                                               InstructionHandle handle) {<FILL_FUNCTION_BODY>}

    @Override
    protected int getPriorityFromTaintFrame(TaintFrame fact, int offset)
            throws DataflowAnalysisException {

        Taint valueTaint = fact.getStackValue(offset);

        String cipherValue = valueTaint.getConstantOrPotentialValue();
        if(cipherValue == null) {
            return Priorities.IGNORE_PRIORITY;
        }
        return getCipherPriority(cipherValue);
    }

    abstract int    getCipherPriority(String cipherValue);
    abstract String getBugPattern();
}

        assert invoke != null && cpg != null;

        //ByteCode.printOpCode(invoke,cpg);

        if(CIPHER_GET_INSTANCE.matches(invoke,cpg)) {
            return new InjectionPoint(new int[]{0}, getBugPattern());
        }
        else if(CIPHER_GET_INSTANCE_PROVIDER.matches(invoke,cpg)) {
            return new InjectionPoint(new int[]{1}, getBugPattern());
        }
        else if(KEYGENERATOR_GET_INSTANCE.matches(invoke,cpg)) {
            return new InjectionPoint(new int[]{0}, getBugPattern());
        }
        else if(KEYGENERATOR_GET_INSTANCE_PROVIDER.matches(invoke,cpg)) {
            return new InjectionPoint(new int[]{1}, getBugPattern());
        }
        return InjectionPoint.NONE;
    
<methods>public void registerVisitor(com.h3xstream.findsecbugs.taintanalysis.TaintFrameAdditionalVisitor) <variables>static com.h3xstream.findsecbugs.injection.ClassMethodSignature OBJECT,private static final com.h3xstream.findsecbugs.injection.SinksLoader SINKS_LOADER,private final Map<com.h3xstream.findsecbugs.injection.ClassMethodSignature,com.h3xstream.findsecbugs.injection.InjectionPoint> injectionMap