Skip to content

Commit

Permalink
Some i18n fixes. PublicKeySignature added to more CTR formats.
Browse files Browse the repository at this point in the history
  • Loading branch information
ahzf committed May 6, 2024
1 parent 429a5a6 commit 14547f0
Show file tree
Hide file tree
Showing 5 changed files with 219 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,41 @@
"meterInfo": {
"firmwareVersion": "123",
"type": "eHZ IW8E EMH",
"manufacturer": "EMH"
"manufacturer": "EMH",
"publicKeySignatures": [
{
"signer": "Open Charging Cloud",
"publicKey": "04a8ff0d82107922522e004a167cc658f0eef408c5020f98e7a2615be326e61852666877335f4f8d9a0a756c26f0c9fb3f401431416abb5317cc0f5d714d3026fe",
"timestamp": "2019-06-30T00:00:00Z",
"comment": { "en": "Hello world!" },
"notBefore": "2018-11-04T16:47:01Z",
"notAfter": "2023-03-12T13:54:12Z",
"operations": {
"signCertificates": false,
"signMeterValues": true
},
"revocationURIs": [],
"algorithm": "secp256k1",
"format": "DER",
"value": "303502181dce9223416d64e5362bc8eb46eddf23adcb74382b602e1f021900eca85b1a48bc1f64d25951e947c7e48fa0b070b82e2cae41"
},
{
"signer": "chargeIT mobility",
"publicKey": "04a8ff0d82107922522e004a167cc658f0eef408c5020f98e7a2615be326e61852666877335f4f8d9a0a756c26f0c9fb3f401431416abb5317cc0f5d714d3026fe",
"timestamp": "2019-06-30T00:00:00Z",
"comment": { "en": "Hello world!" },
"notBefore": "2018-11-04T16:47:01Z",
"notAfter": "2023-03-12T13:54:12Z",
"operations": {
"signCertificates": false,
"signMeterValues": true
},
"revocationURIs": [],
"algorithm": "secp256k1",
"format": "DER",
"value": "303502181dce9223416d64e5362bc8eb46eddf23adcb74382b602e1f021900eca85b1a48bc1f64d25951e947c7e48fa0b070b82e2cae41"
}
]
},
"connectorInfo": {
"type": "Typ-2 Socket",
Expand Down
170 changes: 167 additions & 3 deletions src/i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@
"en": "No charge transparency records found!"
},

"Invalid number of signed meter values!" : {
"de": "Ungültige Anzahl signierter Messwerte!",
"en": "Invalid number of signed meter values!"
},

"Invalid charging session format!": {
"de": "Ungültiges Ladevorgangsformat!",
"en": "Invalid charging session format!"
},

"Unknown or invalid charge transparency record!": {
"de": "Unbekannter oder ungültiger Transparenzdatensatz!",
"en": "Unknown or invalid charge transparency record!"
Expand All @@ -61,6 +71,11 @@
"en": "Unknown or invalid charging session format!"
},

"Inconsistent public keys!": {
"de": "Inkonsistente öffentliche Schlüssel!",
"en": "Inconsistent public keys!"
},

"ValidChargingSession": {
"de": "Gültiger Ladevorgang",
"en": "Valid charging session"
Expand Down Expand Up @@ -98,6 +113,11 @@
"en": "OBIS code"
},

"Inconsistent OBIS code!": {
"de": "Inkonsistente OBIS-Kennzahl!",
"en": "Inconsistent OBIS code!"
},

"Plain text": {
"de": "Klartext",
"en": "Plain text"
Expand Down Expand Up @@ -271,6 +291,11 @@
"en": "Missing or invalid meter information within the %p. signed meter value!"
},

"Inconsistent meter identification!": {
"de": "Inkonsistente Zähleridentifikation!",
"en": "Inconsistent meter identification!"
},

"MissingOrInvalid_SignedMeterValue_MeterInfo_MeterIdP": {
"de": "Fehlende oder ungültige Zähleridentifikation im %p. signierten Messwert!",
"en": "Missing or invalid meter identification within the %p. signed meter value!"
Expand Down Expand Up @@ -531,6 +556,7 @@
},



"Charging Tariffs": {
"de": "Ladetarife",
"en": "Charging Tariffs"
Expand All @@ -541,9 +567,6 @@
"en": "Charging Tariff Id"
},




"Total Costs": {
"de": "Gesamtkosten",
"en": "Total Costs"
Expand Down Expand Up @@ -670,6 +693,11 @@
"en": "Unknown charge transparency data format!"
},

"Invalid energy meter": {
"de": "Ungültiger Energiezähler",
"en": "Invalid energy meter"
},

"Energy meter not found": {
"de": "Energiezähler nicht gefunden",
"en": "Energy meter not found"
Expand Down Expand Up @@ -745,6 +773,141 @@
"en": "End value"
},

"Inconsistent Alfen adapter identification!": {
"de": "Inkonsistente Alfen-Adapter-Identifikation!",
"en": "Inconsistent Alfen adapter identification!"
},

"Inconsistent Alfen adapter firmware version!": {
"de": "Inkonsistente Alfen-Adapter-Firmwareversion!",
"en": "Inconsistent Alfen adapter firmware version!"
},

"Inconsistent Alfen adapter firmware checksum!": {
"de": "Inkonsistente Alfen-Adapter-Firmware-Prüfsumme!",
"en": "Inconsistent Alfen adapter firmware checksum!"
},

"Inconsistent unit (encoded) value!" : {
"de": "Inkonsistenter (enkodierter) Einheitenwert!",
"en": "Inconsistent unit (encoded) value!"
},

"Inconsistent measurement scalar!" : {
"de": "Inkonsistenter Messwert-Skalierungsfaktor!",
"en": "Inconsistent measurement scalar!"
},

"Inconsistent user identification!" : {
"de": "Inkonsistente Benutzeridentifikation!",
"en": "Inconsistent user identification!"
},

"Inconsistent internal charging session identification!" : {
"de": "Inkonsistente interne Ladevorgangsidentifikation!",
"en": "Inconsistent internal charging session identification!"
},

"Inconsistent timestamps!": {
"de": "Inkonsistente Zeitstempel!",
"en": "Inconsistent timestamps!"
},

"Exception occured: ": {
"de": "Ausnahmefehler aufgetreten: ",
"en": "Exception occured: "
},

"Hashed plain text": {
"de": "Gehashter Klartext",
"en": "Hashed plain text"
},

"Autorisierung":
{
"de": "Autorisierung",
"en": "Authorization"
},

"Invalid meter status!": {
"de": "Ungültiger Zählerstatus!",
"en": "Invalid meter status!"
},

"RTC error": {
"de": "RTC-Fehler",
"en": "RTC error"
},

"EEPROM error": {
"de": "EEPROM-Fehler",
"en": "EEPROM error"
},

"Dataflash error": {
"de": "Dataspeicher-Fehler",
"en": "Dataflash error"
},

"Phase L1 failure": {
"de": "Phasenausfall L1",
"en": "Phase L1 failure"
},

"Phase L2 failure": {
"de": "Phasenausfall L2",
"en": "Phase L2 failure"
},

"Phase L3 failure": {
"de": "Phasenausfall L3",
"en": "Phase L3 failure"
},

"Phase sequence wrong": {
"de": "Falsche Phasenfolge",
"en": "Phase sequence wrong"
},

"Adapter fatal error": {
"de": "Schwerer Adapter-Fehler",
"en": "Adapter fatal error"
},

"Stop and Start Meter reading mismatch": {
"de": "Start- und Endzählerstand stimmen nicht überein",
"en": "Stop and Start Meter reading mismatch"
},

"Intermediate command": {
"de": "Zwischenbefehl",
"en": "Intermediate command"
},

"Stop charge command": {
"de": "Ladevorgang beenden",
"en": "Stop charge command"
},

"Start charge command": {
"de": "Ladevorgang starten",
"en": "Start charge command"
},

"Adapter memory error": {
"de": "Adapter-Speicherfehler",
"en": "Adapter memory error"
},

"Meter communication error": {
"de": "Zählerkommunikationsfehler",
"en": "Meter communication error"
},

"Invalid status!": {
"de": "Ungültiger Status!",
"en": "Invalid status!"
},

"Adapter Id": {
"de": "Adapter-Id",
Expand Down Expand Up @@ -822,4 +985,5 @@
"en": "Charging Periods"
}


}
11 changes: 6 additions & 5 deletions src/ts/Alfen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ export class Alfen {
UnitEncoded: 0,
Scalar: "",
UID: "",
InternalSessionId: 0,
InternalSessionId: 0,
dataSets: [] as any[]
};
};

let signedValues:string[] = [];
if (typeof (Content) === 'string')
Expand Down Expand Up @@ -333,7 +333,8 @@ export class Alfen {
"format": "DER",
"encoding": "base32"
}
]
],
"publicKeySignatures": ContainerInfos.energyMeter?.publicKeySignatures
}
]
}
Expand Down Expand Up @@ -622,14 +623,14 @@ export class AlfenCrypt01 extends ACrypt {
try
{

cryptoResult.publicKey = meter.publicKeys[0]?.value?.toLowerCase();
cryptoResult.publicKey = meter.publicKeys[0]?.value;
cryptoResult.publicKeyFormat = meter.publicKeys[0]?.format;
cryptoResult.publicKeySignatures = meter.publicKeys[0]?.signatures;

try
{

const publicKey = chargyLib.buf2hex(this.chargy.base32Decode(cryptoResult.publicKey?.toUpperCase(), 'RFC4648'));
const publicKey = chargyLib.buf2hex(this.chargy.base32Decode(cryptoResult.publicKey, 'RFC4648'));
let result = false;

switch (meter?.publicKeys[0]?.algorithm ?? "")
Expand Down
11 changes: 6 additions & 5 deletions src/ts/chargeIT.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1137,6 +1137,7 @@ export class ChargeIT {
const meterInfo_publicKeyEncoding = SomeJSON.meterInfo?.publicKeyEncoding;
const meterInfo_signatureFormat = SomeJSON.meterInfo?.signatureFormat;
const meterInfo_signatureEncoding = SomeJSON.meterInfo?.signatureEncoding;
const meterInfo_publicKeySignatures = SomeJSON.meterInfo?.publicKeySignatures;

const connectorInfo = SomeJSON.connectorInfo;
const connectorInfo_type = SomeJSON.connectorInfo?.type;
Expand Down Expand Up @@ -1622,11 +1623,11 @@ export class ChargeIT {
geoLocation: { "lat": geoLocation_lat, "lng": geoLocation_lon },
address: { "street": address_street, "postalCode": address_zipCode, "city": address_town, "country": address_country }
},
energyMeter: meterInfo,
connector: connectorInfo,
chargingTariffs: chargingTariffs,
chargingPeriods: chargingPeriods,
totalCosts: totalCosts
energyMeter: meterInfo,
connector: connectorInfo,
chargingTariffs: chargingTariffs,
chargingPeriods: chargingPeriods,
totalCosts: totalCosts
});

}
Expand Down
5 changes: 5 additions & 0 deletions src/ts/chargyInterfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,10 @@ export interface IEVSE
connectors?: Array<IConnector>;
}

export interface IPublicKeySignature extends ISignatureRS {

}

export interface IMeter
{
"@id": string;
Expand All @@ -306,6 +310,7 @@ export interface IMeter
signatureInfos?: ISignatureInfos;
signatureFormat?: string;
publicKeys?: Array<IPublicKey>;
publicKeySignatures?: Array<IPublicKeySignature>;
}

export interface IConnector {
Expand Down

0 comments on commit 14547f0

Please sign in to comment.