Expand description
The rules a Charging Station’s HTTP Basic password must follow, per version.
Pure checks with no dependencies, so the station blocks can refuse a credential they could
not present without pulling in the transport. The password type itself, which zeroizes and
generates, is transport::BasicAuthPassword (feature tokio).
- 1.6
AuthorizationKey: “Minimal 16-bytes long … Hexadecimal represented (20 bytes maximum, represented as a string of up to 40 hexadecimal digits)” (1.6 Security Whitepaper ed. 4, A00.FR.205). The decoded octets are the password. - 2.x
BasicAuthPassword: “a randomly chosen passwordString … consisting of minimum 16 and a maximum as defined by the maxLimit of configuration variableBasicAuthPassword, which must be at least 40 characters and at most 64” (A00.FR.205), wherepasswordString“can only contain characters from the following character set: a-z, A-Z, 0-9, ‘*’, ‘-’, ‘_’, ‘=’, ‘:’, ‘+’, ‘|’, ‘@’, ‘.’” (Part 2 §2.1.4, primitive datatypes).
use ocpp_kit::credentials::{self, CredentialError};
assert!(credentials::check_password("a-sixteen-char-pw", 40).is_ok());
assert_eq!(
credentials::check_password("sixteen-chars-ok!", 40),
Err(CredentialError::Character('!'))
);
assert_eq!(credentials::authorization_key_octets("00112233445566778899AABBCCDDEEFF")?.len(), 16);Enums§
- Credential
Error - Why a credential was rejected.
Constants§
- AUTHORIZATION_
KEY_ MAX_ BYTES - The longest 1.6
AuthorizationKey, in octets (Security Whitepaper A00.FR.205). - AUTHORIZATION_
KEY_ MIN_ BYTES - The shortest 1.6
AuthorizationKey, in octets (Security Whitepaper A00.FR.205). - BASIC_
AUTH_ INTEROPERABLE_ MAX_ LEN - The smallest
maxLimita CSMS may configure forBasicAuthPassword(A00.FR.205). - BASIC_
AUTH_ MAX_ LEN - The longest
BasicAuthPasswordOCPP 2.x can define. - BASIC_
AUTH_ MIN_ LEN - The shortest
BasicAuthPasswordOCPP 2.x allows (A00.FR.205). - PASSWORD_
STRING_ CHARSET - Every character a 2.x
passwordStringmay contain (Part 2 §2.1.4), 71 in all.
Functions§
- authorization_
key_ octets - Decodes a 1.6
AuthorizationKeyinto the password octets: hexadecimal (either case, surrounding whitespace ignored),AUTHORIZATION_KEY_MIN_BYTEStoAUTHORIZATION_KEY_MAX_BYTESoctets. - check_
password - Checks a 2.x
BasicAuthPassword:BASIC_AUTH_MIN_LEN..=max_lencharacters, every one apasswordStringcharacter.