AvoidingManager { public DetectionReport getDetectionReport() { return m_DetectionReport; } AvoidingManager( AbstractEncryptionElement wrapPay, DetectionReport detectRep, SchemaAnalyzer schemaAnalyzer ); void setWrapErrCmpThreshold( double wrapErrCmpThreshold ); AbstractEncryptionElement getAttackPay(); void setAttackPay( AbstractEncryptionElement attackPay ); Document getInputFile(); DetectionReport getDetectionReport(); Document getAvoidedFile(); void setAvoidedFile( Document avoidedFile ); AvoidedDocErrorInfo getAvoidedDocument( WrappingAttackMode wrapMode, ServerSendCommandIF serverSendCmd ); void setUseEncTypeWeakness( boolean encTypeWeakness ); final static Logger LOG; }
@Test public void testSomething() throws FileNotFoundException, XPathExpressionException, SAXException, IOException, InvalidPayloadException, InvalidWeaknessException { DetectionManager detectManager = null; DetectionReport detectReport = null; EncryptionInfo encInfo = null; Pipeline pipeLine = null; EncSigWrappingOracle encSigWrappOracle = null; EncryptionWrappingOracle encWrappOracle = null; Document rawFile = null; Document possAvoidedDoc = null; int max = 0; rawFile = DomUtilities.readDocument( "src/test/resources/case_encKey_encData_signed.xml" ); pipeLine = new Pipeline(); pipeLine.addFilerToPipline( FactoryFilter.createFilter( DetectFilterEnum.ENCRYPTIONFILTER ) ); pipeLine.addFilerToPipline( FactoryFilter.createFilter( DetectFilterEnum.SIGNATUREFILTER ) ); detectManager = new DetectionManager( pipeLine, rawFile ); detectManager.startDetection(); detectReport = detectManager.getDetectionReport(); encInfo = ( (EncryptionInfo) detectReport.getDetectionInfo( DetectFilterEnum.ENCRYPTIONFILTER ) ); AbstractEncryptionElement encEl = ( (DataReferenceElement) encInfo.getEncryptedKeyElements().get( 0 ).getReferenceElementList().get( 0 ) ).getRefEncData(); List<Payload> pays = ( (SignatureInfo) detectReport.getDetectionInfo( DetectFilterEnum.SIGNATUREFILTER ) ).getSignatureManager().getPayloads(); for ( int i = 0; pays.size() > i; i++ ) { pays.get( i ).setValue( pays.get( i ).getValue() ); ElementAttackProperties attackProps = encEl.getAttackProperties(); attackProps.setWrappingPayloadElement( encEl.getEncryptedElement() ); } encSigWrappOracle = new EncSigWrappingOracle( encInfo.getEncryptedKeyElements().get( 0 ), detectReport, schemaAnalyser ); encWrappOracle = new EncryptionWrappingOracle( encInfo.getEncryptedKeyElements().get( 0 ), detectReport, schemaAnalyser ); max = encSigWrappOracle.maxPossibilities(); for ( int i = 0; max > i; i++ ) { possAvoidedDoc = encSigWrappOracle.getPossibility( i ); } }