27 lines
618 B
Plaintext
27 lines
618 B
Plaintext
include::../description.adoc[]
|
|
|
|
== Noncompliant Code Example
|
|
|
|
----
|
|
String password = Base64.decode(retrievePassword());
|
|
DriverManager.getConnection(url, usr, password); // Noncompliant
|
|
----
|
|
|
|
== Compliant Solution
|
|
|
|
----
|
|
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[]
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::../comments-and-links.adoc[]
|
|
endif::env-github,rspecator-view[]
|