private static boolean checkPreauthContext ( Smb2NegotiateRequest req, PreauthIntegrityNegotiateContext pc ) { if ( pc.getHashAlgos() == null || pc.getHashAlgos().length != 1 ) { log.error("Server returned no hash selection"); return false; } PreauthIntegrityNegotiateContext rpc = null; for ( NegotiateContextRequest rnc : req.getNegotiateContexts() ) { if ( rnc instanceof PreauthIntegrityNegotiateContext ) { rpc = (PreauthIntegrityNegotiateContext) rnc; } } if ( rpc == null ) { return false; } boolean valid = false; for ( int hash : rpc.getHashAlgos() ) { if ( hash == pc.getHashAlgos()[ 0 ] ) { valid = true; } } if ( !valid ) { log.error("Server returned invalid hash selection"); return false; } return true; }
private static boolean checkEncryptionContext ( Smb2NegotiateRequest req, EncryptionNegotiateContext ec ) { if ( ec.getCiphers() == null || ec.getCiphers().length != 1 ) { log.error("Server returned no cipher selection"); return false; } EncryptionNegotiateContext rec = null; for ( NegotiateContextRequest rnc : req.getNegotiateContexts() ) { if ( rnc instanceof EncryptionNegotiateContext ) { rec = (EncryptionNegotiateContext) rnc; } } if ( rec == null ) { return false; } boolean valid = false; for ( int cipher : rec.getCiphers() ) { if ( cipher == ec.getCiphers()[ 0 ] ) { valid = true; } } if ( !valid ) { log.error("Server returned invalid cipher selection"); return false; } return true; }
private static boolean checkEncryptionContext ( Smb2NegotiateRequest req, EncryptionNegotiateContext ec ) { if ( ec.getCiphers() == null || ec.getCiphers().length != 1 ) { log.error("Server returned no cipher selection"); return false; } EncryptionNegotiateContext rec = null; for ( NegotiateContextRequest rnc : req.getNegotiateContexts() ) { if ( rnc instanceof EncryptionNegotiateContext ) { rec = (EncryptionNegotiateContext) rnc; } } if ( rec == null ) { return false; } boolean valid = false; for ( int cipher : rec.getCiphers() ) { if ( cipher == ec.getCiphers()[ 0 ] ) { valid = true; } } if ( !valid ) { log.error("Server returned invalid cipher selection"); return false; } return true; }
private static boolean checkPreauthContext ( Smb2NegotiateRequest req, PreauthIntegrityNegotiateContext pc ) { if ( pc.getHashAlgos() == null || pc.getHashAlgos().length != 1 ) { log.error("Server returned no hash selection"); return false; } PreauthIntegrityNegotiateContext rpc = null; for ( NegotiateContextRequest rnc : req.getNegotiateContexts() ) { if ( rnc instanceof PreauthIntegrityNegotiateContext ) { rpc = (PreauthIntegrityNegotiateContext) rnc; } } if ( rpc == null ) { return false; } boolean valid = false; for ( int hash : rpc.getHashAlgos() ) { if ( hash == pc.getHashAlgos()[ 0 ] ) { valid = true; } } if ( !valid ) { log.error("Server returned invalid hash selection"); return false; } return true; }