Skip to content

Commit 8dad027

Browse files
1 parent 6fd2f6a commit 8dad027

File tree

3 files changed

+33
-48
lines changed

3 files changed

+33
-48
lines changed

proxy-parent/owasp-proxy/pom.xml

+5-5
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@
3232
<dependencies>
3333
<dependency>
3434
<groupId>org.bouncycastle</groupId>
35-
<artifactId>bcprov-jdk15on</artifactId>
36-
<version>1.47</version>
35+
<artifactId>bcprov-jdk18on</artifactId>
36+
<version>1.79</version>
3737
</dependency>
3838

3939
<dependency>
4040
<groupId>org.bouncycastle</groupId>
41-
<artifactId>bcpkix-jdk15on</artifactId>
42-
<version>1.47</version>
41+
<artifactId>bcpkix-jdk18on</artifactId>
42+
<version>1.79</version>
4343
</dependency>
4444
<dependency>
4545
<groupId>org.apache.httpcomponents</groupId>
@@ -48,7 +48,7 @@
4848
<dependency>
4949
<groupId>org.springframework</groupId>
5050
<artifactId>spring-jdbc</artifactId>
51-
<version>2.5.6</version>
51+
<version>6.2.0</version>
5252
<scope>compile</scope>
5353
<exclusions>
5454
<exclusion>

proxy-parent/owasp-proxy/src/main/java/org/owasp/proxy/http/dao/JdbcMessageDAO.java

+26-37
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@
4242
import org.springframework.dao.DataAccessException;
4343
import org.springframework.dao.EmptyResultDataAccessException;
4444
import org.springframework.jdbc.core.JdbcTemplate;
45+
import org.springframework.jdbc.core.RowMapper;
4546
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
4647
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcDaoSupport;
47-
import org.springframework.jdbc.core.simple.ParameterizedRowMapper;
48-
import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
48+
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
4949
import org.springframework.jdbc.support.GeneratedKeyHolder;
5050
import org.springframework.jdbc.support.KeyHolder;
5151

@@ -66,11 +66,11 @@ public class JdbcMessageDAO extends NamedParameterJdbcDaoSupport implements
6666
private static final String RESPONSE_HEADER_TIME = "headerTime";
6767
private static final String RESPONSE_CONTENT_TIME = "contentTime";
6868

69-
private static final ParameterizedRowMapper<MutableBufferedRequest> REQUEST_MAPPER = new RequestMapper();
70-
private static final ParameterizedRowMapper<MutableBufferedResponse> RESPONSE_MAPPER = new ResponseMapper();
71-
private static final ParameterizedRowMapper<byte[]> CONTENT_MAPPER = new ContentMapper();
72-
private static final ParameterizedRowMapper<Integer> ID_MAPPER = new IdMapper();
73-
private static final ParameterizedRowMapper<Conversation> CONVERSATION_MAPPER = new ConversationMapper();
69+
private static final RowMapper<MutableBufferedRequest> REQUEST_MAPPER = new RequestMapper();
70+
private static final RowMapper<MutableBufferedResponse> RESPONSE_MAPPER = new ResponseMapper();
71+
private static final RowMapper<byte[]> CONTENT_MAPPER = new ContentMapper();
72+
private static final RowMapper<Integer> ID_MAPPER = new IdMapper();
73+
private static final RowMapper<Conversation> CONVERSATION_MAPPER = new ConversationMapper();
7474

7575
private final static String INSERT_CONTENT = "INSERT INTO contents (content, size) VALUES (:content, :size)";
7676

@@ -188,9 +188,8 @@ public Collection<Integer> listConversationsSince(int id)
188188
MapSqlParameterSource params = new MapSqlParameterSource();
189189
try {
190190
params.addValue(ID, id, Types.INTEGER);
191-
SimpleJdbcTemplate template = new SimpleJdbcTemplate(
192-
getNamedParameterJdbcTemplate());
193-
return template.query(SELECT_CONVERSATIONS, ID_MAPPER, params);
191+
NamedParameterJdbcTemplate template = getNamedParameterJdbcTemplate();
192+
return template.query(SELECT_CONVERSATIONS, params, ID_MAPPER);
194193
} catch (EmptyResultDataAccessException erdae) {
195194
return Collections.emptyList();
196195
}
@@ -205,9 +204,8 @@ public int getMessageContentId(int headerId) throws DataAccessException {
205204
try {
206205
MapSqlParameterSource params = new MapSqlParameterSource();
207206
params.addValue(ID, headerId, Types.INTEGER);
208-
SimpleJdbcTemplate template = new SimpleJdbcTemplate(
209-
getNamedParameterJdbcTemplate());
210-
return template.queryForInt(SELECT_CONTENT_ID, params);
207+
NamedParameterJdbcTemplate template = getNamedParameterJdbcTemplate();
208+
return template.queryForObject(SELECT_CONTENT_ID, params, Integer.class);
211209
} catch (EmptyResultDataAccessException erdae) {
212210
return -1;
213211
}
@@ -222,9 +220,8 @@ public int getMessageContentSize(int id) throws DataAccessException {
222220
try {
223221
MapSqlParameterSource params = new MapSqlParameterSource();
224222
params.addValue(ID, id, Types.INTEGER);
225-
SimpleJdbcTemplate template = new SimpleJdbcTemplate(
226-
getNamedParameterJdbcTemplate());
227-
return template.queryForInt(SELECT_CONTENT_SIZE, params);
223+
NamedParameterJdbcTemplate template = getNamedParameterJdbcTemplate();
224+
return template.queryForObject(SELECT_CONTENT_SIZE, params, Integer.class);
228225
} catch (EmptyResultDataAccessException erdae) {
229226
return -1;
230227
}
@@ -239,10 +236,8 @@ public Conversation getConversation(int id) throws DataAccessException {
239236
try {
240237
MapSqlParameterSource params = new MapSqlParameterSource();
241238
params.addValue(ID, id, Types.INTEGER);
242-
SimpleJdbcTemplate template = new SimpleJdbcTemplate(
243-
getNamedParameterJdbcTemplate());
244-
return template.queryForObject(SELECT_SUMMARY, CONVERSATION_MAPPER,
245-
params);
239+
NamedParameterJdbcTemplate template = getNamedParameterJdbcTemplate();
240+
return template.queryForObject(SELECT_SUMMARY, params, CONVERSATION_MAPPER);
246241
} catch (EmptyResultDataAccessException erdae) {
247242
return null;
248243
}
@@ -286,10 +281,8 @@ public byte[] loadMessageContent(int id) throws DataAccessException {
286281
try {
287282
MapSqlParameterSource params = new MapSqlParameterSource();
288283
params.addValue(ID, id, Types.INTEGER);
289-
SimpleJdbcTemplate template = new SimpleJdbcTemplate(
290-
getNamedParameterJdbcTemplate());
291-
return template.queryForObject(SELECT_CONTENT, CONTENT_MAPPER,
292-
params);
284+
NamedParameterJdbcTemplate template = getNamedParameterJdbcTemplate();
285+
return template.queryForObject(SELECT_CONTENT, params, CONTENT_MAPPER);
293286
} catch (EmptyResultDataAccessException erdae) {
294287
return null;
295288
}
@@ -319,10 +312,8 @@ public RequestHeader loadRequestHeader(int id) throws DataAccessException {
319312
MapSqlParameterSource params = new MapSqlParameterSource();
320313
try {
321314
params.addValue(ID, id, Types.INTEGER);
322-
SimpleJdbcTemplate template = new SimpleJdbcTemplate(
323-
getNamedParameterJdbcTemplate());
324-
return template.queryForObject(SELECT_REQUEST, REQUEST_MAPPER,
325-
params);
315+
NamedParameterJdbcTemplate template = getNamedParameterJdbcTemplate();
316+
return template.queryForObject(SELECT_REQUEST, params, REQUEST_MAPPER);
326317
} catch (EmptyResultDataAccessException erdae) {
327318
return null;
328319
}
@@ -354,10 +345,8 @@ public MutableResponseHeader loadResponseHeader(int id)
354345
try {
355346
MapSqlParameterSource params = new MapSqlParameterSource();
356347
params.addValue(ID, id, Types.INTEGER);
357-
SimpleJdbcTemplate template = new SimpleJdbcTemplate(
358-
getNamedParameterJdbcTemplate());
359-
return template.queryForObject(SELECT_RESPONSE, RESPONSE_MAPPER,
360-
params);
348+
NamedParameterJdbcTemplate template = getNamedParameterJdbcTemplate();
349+
return template.queryForObject(SELECT_RESPONSE, params, RESPONSE_MAPPER);
361350
} catch (EmptyResultDataAccessException erdae) {
362351
return null;
363352
}
@@ -478,7 +467,7 @@ private void saveMessageHeader(MutableMessageHeader header, int contentId) {
478467
}
479468

480469
private static class RequestMapper implements
481-
ParameterizedRowMapper<MutableBufferedRequest> {
470+
RowMapper<MutableBufferedRequest> {
482471

483472
public MutableBufferedRequest mapRow(ResultSet rs, int rowNum)
484473
throws SQLException {
@@ -504,7 +493,7 @@ public MutableBufferedRequest mapRow(ResultSet rs, int rowNum)
504493
}
505494

506495
private static class ResponseMapper implements
507-
ParameterizedRowMapper<MutableBufferedResponse> {
496+
RowMapper<MutableBufferedResponse> {
508497

509498
public MutableBufferedResponse mapRow(ResultSet rs, int rowNum)
510499
throws SQLException {
@@ -529,22 +518,22 @@ public MutableBufferedResponse mapRow(ResultSet rs, int rowNum)
529518
}
530519

531520
private static class ContentMapper implements
532-
ParameterizedRowMapper<byte[]> {
521+
RowMapper<byte[]> {
533522

534523
public byte[] mapRow(ResultSet rs, int rowNum) throws SQLException {
535524
return rs.getBytes(CONTENT);
536525
}
537526
}
538527

539-
private static class IdMapper implements ParameterizedRowMapper<Integer> {
528+
private static class IdMapper implements RowMapper<Integer> {
540529

541530
public Integer mapRow(ResultSet rs, int rowNum) throws SQLException {
542531
return Integer.valueOf(rs.getInt(ID));
543532
}
544533
}
545534

546535
private static class ConversationMapper implements
547-
ParameterizedRowMapper<Conversation> {
536+
RowMapper<Conversation> {
548537

549538
public Conversation mapRow(ResultSet rs, int rowNum)
550539
throws SQLException {

proxy-parent/owasp-proxy/src/main/java/org/owasp/proxy/util/BouncyCastleCertificateUtils.java

+2-6
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,10 @@
3434

3535
import javax.security.auth.x500.X500Principal;
3636

37-
import org.bouncycastle.asn1.x509.BasicConstraints;
38-
import org.bouncycastle.asn1.x509.ExtendedKeyUsage;
39-
import org.bouncycastle.asn1.x509.KeyPurposeId;
40-
import org.bouncycastle.asn1.x509.X509Extensions;
37+
import org.bouncycastle.asn1.x509.*;
4138
import org.bouncycastle.jce.X509KeyUsage;
4239
import org.bouncycastle.x509.X509V3CertificateGenerator;
4340
import org.bouncycastle.x509.extension.AuthorityKeyIdentifierStructure;
44-
import org.bouncycastle.x509.extension.SubjectKeyIdentifierStructure;
4541

4642
@SuppressWarnings("deprecation")
4743
public class BouncyCastleCertificateUtils {
@@ -116,7 +112,7 @@ private static void addCertificateExtensions(PublicKey pubKey,
116112
// new SubjectKeyIdentifierExtension(new KeyIdentifier(pubKey)
117113
// .getIdentifier()));
118114
certGen.addExtension(X509Extensions.SubjectKeyIdentifier, false,
119-
new SubjectKeyIdentifierStructure(pubKey));
115+
SubjectKeyIdentifier.getInstance(pubKey));
120116
//
121117
// ext.set(AuthorityKeyIdentifierExtension.NAME,
122118
// new AuthorityKeyIdentifierExtension(

0 commit comments

Comments
 (0)