EncryptionWrappingOracle implements WrappingOracleIF { @Override public int maxPossibilities() { return m_MaxPossibilites; } EncryptionWrappingOracle( AbstractEncryptionElement encPay, DetectionReport detRep,
                                     SchemaAnalyzer schemaAnalyser ); @Override int maxPossibilities(); @Override Document getPossibility( int index ); void addAdditionalEncryptionWeakness( AbstractEncryptionWeakness addWeak ); final static Logger LOG; }
@Test public void testSignedEncKeyWithSignedEncDataWrapping() throws Exception { Document doc = DomUtilities.readDocument( "src/test/resources/schema_encKey_sig_encData_sig.xml" ); Document possAvoidedDoc = null; int max = 0; String attackContentData = "ENCRYPTED ATTACK PAYLOAD DATA"; String attackContentKey = "ENCRYPTED ATTACK PAYLOAD KEY"; DetectionManager detectManager = new DetectionManager( m_PipeLine, doc ); detectManager.startDetection(); DetectionReport detectReport = detectManager.getDetectionReport(); EncryptionInfo encInfo = (EncryptionInfo) detectReport.getDetectionInfo( DetectFilterEnum.ENCRYPTIONFILTER ); SignatureInfo sigInfo = (SignatureInfo) detectReport.getDetectionInfo( DetectFilterEnum.SIGNATUREFILTER ); assertTrue( sigInfo.isSignature() ); m_SigManager = sigInfo.getSignatureManager(); assertEquals( 2, m_SigManager.getPayloads().size() ); assertEquals( "Body", m_SigManager.getPayloads().get( 0 ).getSignedElement().getLocalName() ); assertEquals( "EncryptedKey", m_SigManager.getPayloads().get( 1 ).getSignedElement().getLocalName() ); EncryptedKeyElement encKey = encInfo.getEncryptedKeyElements().get( 0 ); AbstractEncryptionElement encEl = ( (DataReferenceElement) encInfo.getEncryptedKeyElements().get( 0 ).getReferenceElementList().get( 0 ) ).getRefEncData(); EncryptedDataElement encDataPay = new EncryptedDataElement( (Element) encEl.getEncryptedElement().cloneNode( true ) ); ( (CipherValueElement) encDataPay.getCipherDataChild() ).setEncryptedData( attackContentData ); EncryptedKeyElement encKeyPay = new EncryptedKeyElement( (Element) encKey.getEncryptedElement().cloneNode( true ) ); ( (CipherValueElement) encKeyPay.getCipherDataChild() ).setEncryptedData( attackContentKey ); ElementAttackProperties attackPropsData = encEl.getAttackProperties(); ElementAttackProperties attackPropsKey = encKey.getAttackProperties(); attackPropsData.setWrappingPayloadElement( encDataPay.getEncryptedElement() ); attackPropsKey.setWrappingPayloadElement( encKeyPay.getEncryptedElement() ); assertFalse( encDataPay.getCipherDataChild().getEncryptedData().equals( encEl.getCipherDataChild().getEncryptedData() ) ); assertFalse( encKeyPay.getCipherDataChild().getEncryptedData().equals( encKey.getCipherDataChild().getEncryptedData() ) ); m_EncWrappOracle = new EncryptionWrappingOracle( encKey, detectReport, m_SchemaAnalyser ); max = m_EncWrappOracle.maxPossibilities(); assertTrue( 0 < max ); }