fix(android): KeyStore.load takes a LoadStoreParameter, not an Object

The one-argument overload is load(LoadStoreParameter). Declaring JObject made the bridge look for a method that does not exist - reported at runtime as 'method not found', with nothing at compile time. Same class of mistake as generateSecret earlier: the JNI signature is built from the declared types, so an approximate type is a silent break.
This commit is contained in:
r-zakarya
2026-08-15 00:56:22 +01:00
parent 60b806536a
commit 3cbfd54c26
2 changed files with 17 additions and 2 deletions
+14 -1
View File
@@ -150,6 +150,19 @@ type
end;
TJGCMParameterSpecX = class(TJavaGenericImport<JGCMParameterSpecXClass, JGCMParameterSpecX>) end;
// KeyStore.load a deux surcharges, et celle a un argument prend un
// LoadStoreParameter - pas un Object. Declarer JObject faisait chercher au
// pont une methode inexistante : "methode introuvable" a l'execution, sans
// rien signaler a la compilation.
JLoadStoreParameterClass = interface(IJavaClass)
['{1C2D3E4F-5061-7283-94A5-B6C7D8E9F001}']
end;
[JavaSignature('java/security/KeyStore$LoadStoreParameter')]
JLoadStoreParameter = interface(IJavaInstance)
['{2D3E4F50-6172-8394-A5B6-C7D8E9F00112}']
end;
TJLoadStoreParameter = class(TJavaGenericImport<JLoadStoreParameterClass, JLoadStoreParameter>) end;
JKeyStoreXClass = interface(JObjectClass)
['{A49283B5-C6D7-E2F3-0415-8091A2B3C4D5}']
function getInstance(&type: JString): JKeyStoreX; cdecl;
@@ -157,7 +170,7 @@ type
[JavaSignature('java/security/KeyStore')]
JKeyStoreX = interface(JObject)
['{B5A394C6-D7E8-F304-1526-91A2B3C4D5E6}']
procedure load(param: JObject); cdecl;
procedure load(param: JLoadStoreParameter); cdecl;
function getKey(alias: JString; password: TJavaArray<Char>): JKeyX; cdecl;
function containsAlias(alias: JString): Boolean; cdecl;
end;
+3 -1
View File
@@ -290,8 +290,10 @@ begin
else
Log(' coffre enregistre - AUCUNE protection sur cet appareil');
except
// La classe compte autant que le message : "methode introuvable"
// designe une signature JNI fausse, pas un probleme de stockage.
on E: Exception do
Log(' cache non ecrit : ' + E.Message);
Log(' cache non ecrit : ' + E.ClassName + ' - ' + E.Message);
end;
Log(' ' + LSw.ElapsedMilliseconds.ToString + ' ms pour ' +
Length(LPlain).ToString + ' caracteres');