# Overview

`app-signer` is a tool (packaged as a Java library) to sign MicroEJ Application binaries (`.fo`).
Signed Application binaries can be verified by MicroEJ Kernels at runtime before installation.

RSA and EC signing keys are supported, producing `SHA256withRSA` and `SHA256withECDSA` signatures
respectively.

# Usage

Add the dependency to your project: `com.microej.tool.util:app-signer:x.y.z`.

Create an `AppSigner` from a keystore file (or directly from a key and its certificate chain), then
sign an Application binary. The signing output can optionally be checked with `AppSigner.verify()`:

```java
// Load the signing key and its certificate chain from a keystore file...
AppSigner signer = AppSigner.fromKeyStoreFile(keyStoreType, keyStorePath, keyStorePassword,
        signingKeyAlias, signingKeyPassword);
// ...or build it directly from a key and its certificate chain (CA certificate first):
// AppSigner signer = new AppSigner(signingKey, certPath);

// Sign a .fo file into a .fo.signed file:
signer.sign(applicationBinaryPath, appId, appVersion, signedApplicationBinaryPath);
// (an InputStream-to-InputStream overload is also available for in-memory signing.)

// Optionally, structurally check the produced signed binary (host-side, not a trust decision):
AppSigner.verify(signedApplicationBinaryPath);
```

# Requirements

This tool requires **JDK 11** or higher. It relies on JDK-internal `sun.security.*` APIs whose access is
restricted, so the JVM running it must be started with:
```
--add-exports java.base/sun.security.util=ALL-UNNAMED --add-exports java.base/sun.security.x509=ALL-UNNAMED
```

# Dependencies

_All dependencies are retrieved transitively by Gradle_.

# Source

N/A.

# Restrictions

None.

---

_Copyright 2017-2026 MicroEJ Corp. All rights reserved._\
_Use of this source code is governed by a BSD-style license that can be found with this software._\
_Build: 7E4D1F7C_  