Commit f7af06d
committed
Add support for non-printable HTTP passwords
The OCPP 1.6 Security Whitepaper foresees that the AuthorizationKey,
which is a hexadecimal string representation of the HTTP Basic
Authentication password to be used, may use the full byte range, i.e.
including non-printable characters. Thus, passing it as a Java String
object is not suitable.
In contrast, OCPP 2.0.1 specifies the password as being a string of
printable UTF-8 characters. The library already supports that.
To accomodate both, take advantage of the fact that JSONConfiguration
treats all parameters as Objects, so either a String or a byte array can
be set.
Change the code adding the credentials to the HTTP header to correctly
generate the Base64 encoded credentials from either a password string or
a byte array, depending on the object type that was set as the password.1 parent 441adb1 commit f7af06d
File tree
1 file changed
+19
-3
lines changed- OCPP-J/src/main/java/eu/chargetime/ocpp
1 file changed
+19
-3
lines changedLines changed: 19 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| |||
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
71 | | - | |
| 72 | + | |
| 73 | + | |
72 | 74 | | |
73 | | - | |
74 | | - | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
75 | 84 | | |
76 | 85 | | |
77 | 86 | | |
| |||
132 | 141 | | |
133 | 142 | | |
134 | 143 | | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
135 | 151 | | |
136 | 152 | | |
137 | 153 | | |
| |||
0 commit comments