Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HBCIKeyFiles.jl

A Julia package for working with HBCI/FinTS 3.0 key files ("Schlüsseldateien").

Supported today:

  • Reading hbci4j / HBCI4Java passport files in the H4JAES format — the format hbci4j uses for RAH-10 key file passports (e.g. as created by Hibiscus).
  • Writing (and reading) SIZ RDH key files in the RDH-2 container layout (optionally RDH-10), the key file format used by VR-NetWorld, StarMoney and other SIZ-derived banking software, and understood by HBCI4Java's RDHXFile passport.

The key material itself is profile-independent RSA — an RAH-10 key is an RSA key pair whose on-the-wire signature/encryption schemes use AES instead of 3DES. This package converts the storage container; the keys pass through unchanged, so an RAH-10 key can be carried in an RDH-2 file.

Usage

using HBCIKeyFiles

# Read an hbci4j passport (format is auto-detected; read_hbci4j/read_sizrdh
# are also available directly)
pp = HBCIKeyFiles.load("passport.dat"; password = "secret")

# pp is a `Passport`: bank connection data plus six key slots
pp.blz, pp.userid, pp.host
pp.my_private_sig_key.key   # RSAPrivateKey with n, e, d, p, q, dP, dQ, qInv

# Write it as a SIZ/RDH-2 key file
write_sizrdh("keyfile.rdh", pp; password = "secret")

# ... or as an RDH-10 container
write_sizrdh("keyfile.rdh", pp; password = "secret", profile = 10)

write_sizrdh requires complete user key pairs (signature and encryption); institute keys and account/bank data are carried over when present. Reading a file with a wrong password throws InvalidPassphraseError.

File formats

hbci4j H4JAES passports

"H4JAES" | version (1) | salt len | salt | IV len | IV | ciphertext

AES-256-CBC/PKCS#5, key derived with PBKDF2-HMAC-SHA256 (65536 iterations). The plaintext is a Java-serialized PassportData object; this package includes a reader for the Java object serialization stream protocol (HBCIKeyFiles.JavaSer) and the DER structures (X.509 SubjectPublicKeyInfo / PKCS#8) in which the JDK serializes RSA keys.

SIZ RDH-2 / RDH-10 key files

A flat sequence of little-endian TLV fields: file header (KDF salt and iteration count), one or more accounts (bank data plus user keys), the bank's public keys, a timestamp, and an HMAC over the whole file. Private user keys are stored 3DES-CBC-encrypted; both the 3DES key and the MAC key are derived from the passphrase with PBKDF2 (HMAC-SHA1 in the RDH-2 layout, HMAC-SHA256 in RDH-10).

All cryptography (AES-CBC, 3DES-CBC, PBKDF2) is provided by libnettle via Nettle.jl/Nettle_jll (3DES and PBKDF2 are called directly in the library, as Nettle.jl does not wrap them); HMAC comes from the SHA standard library.

Interoperability testing

The test fixtures were generated with HBCI4Java 4.1.12 (see test/fixtures/README.md), and the writer output has been verified to load correctly in HBCI4Java's HBCIPassportRDHXFile for both container profiles.

This package contains a clean-room implementation based on the publicly documented behavior of the formats; no code was copied from HBCI4Java or Hibiscus.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages