> For the complete documentation index, see [llms.txt](https://legacy-docs.usesmileid.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://legacy-docs.usesmileid.com/integration-options/server-to-server/java/generate-signature.md).

# Signature

## Generating a Signature

### getSignatureKey

Use the getSignatureKey method to generate a signature

```java
import smile.identity.core.Signature;

/*
 You have two options for generating a signature:
 You can provide a timestamp string or we will generate a signature
 using the current time as the timestamp.
*/

// calling method without providing timestamp
Signature signature = new Signature(partnerId, apiKey);
SignatureKey key = signature.getSignatureKey();
String timestamp = key.getTimestamp();
String signature = key.getSignature();
// you can print the timestamp used in calculating your signature

// providing your own timestamp
Signature signature = new Signature(partnerId, apiKey);
String isoTimestamp = "2023-03-13T13:25:35.984437Z"; // ISO format or use String timestamp = Instant.now().toString();
SignatureKey key = signature.getSignatureKey(isoTimestamp);
String timestamp = key.getTimestamp();
String signature = key.getSignature();
```

## Confirming an Incoming Signature

### confirmSignature

Use the confirmSignature method to confirm the signature you receive while interacting with our servers.

Pass in the timestamp that was returned and the signature String. The method will return a boolean value. True for confirmed and False for unconfirmed

```java
import smile.identity.core.Signature;

Signature signature = new Signature(partnerId, apiKey);
boolean signatureConfirmed = signature.confirmSignature(timestamp, "receivedSignatureString");
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://legacy-docs.usesmileid.com/integration-options/server-to-server/java/generate-signature.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
