rspec/rules/S2087/java/rule.adoc

39 lines
769 B
Plaintext
Raw Permalink Normal View History

== Why is this an issue?
2020-06-30 12:48:07 +02:00
include::../description.adoc[]
=== Noncompliant code example
2020-06-30 12:48:07 +02:00
2022-02-04 17:28:24 +01:00
[source,java]
2020-06-30 12:48:07 +02:00
----
String password = Base64.decode(retrievePassword());
DriverManager.getConnection(url, usr, password); // Noncompliant
----
=== Compliant solution
2020-06-30 12:48:07 +02:00
2022-02-04 17:28:24 +01:00
[source,java]
2020-06-30 12:48:07 +02:00
----
Cipher cipher = Cipher.getInstance("RSA/ECB/OAEPWithMD5AndMGF1Padding");
cipher.init(Cipher.DECRYPT_MODE, privateKey); // key management out of scope for this example
cipher.doFinal(retrievePassword()));
----
include::../see.adoc[]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]