2012-05-31 12 views
8

Zastanawiam się, czy istnieje oficjalna specyfikacja formatu magazynu klucza JKS używanego w Javie? Chciałbym napisać konwerter z/do PKCS # 12, ale nie w Javie, więc keytool lub kod Java niestety nie jest opcją.Specyfikacja formatu klucza JKS sklepu

Patrząc na jeden w edytorze szesnastkowym, mogę powiedzieć, że prawdopodobnie nie jest to ASN.1. Zanim zacznę kopać w OpenJDK, próbując odwrócić inżynierię formatu, czy ktoś wie, czy istnieje spec może? Nie udało mi się znaleźć niczego tak daleko, każda pomoc byłaby bardzo cenna!

Odpowiedz

12

Myślę, że należy rozpocząć badania w JDK sources. Jest tam bardzo użytecznych komentarzy. E.g.

/* 
     * KEYSTORE FORMAT: 
     * 
     * Magic number (big-endian integer), 
     * Version of this file format (big-endian integer), 
     * 
     * Count (big-endian integer), 
     * followed by "count" instances of either: 
     * 
     *  { 
     *  tag=1 (big-endian integer), 
     *  alias (UTF string) 
     *  timestamp 
     *  encrypted private-key info according to PKCS #8 
     *   (integer length followed by encoding) 
     *  cert chain (integer count, then certs; for each cert, 
     *   integer length followed by encoding) 
     *  } 
     * 
     * or: 
     * 
     *  { 
     *  tag=2 (big-endian integer) 
     *  alias (UTF string) 
     *  timestamp 
     *  cert (integer length followed by encoding) 
     *  } 
     * 
     * ended by a keyed SHA1 hash (bytes only) of 
     *  { password + whitener + preceding body } 
     */ 
Powiązane problemy