//[ConnectBot SSH Library](../../../index.md)/[org.connectbot.sshlib](../index.md)/[SshSigning](index.md)

# SshSigning

[jvm]\
object [SshSigning](index.md)

Utility for signing authentication data with local private keys.

Use from [AuthHandler.onSignatureRequest](../-auth-handler/on-signature-request.md) when you have the private key available locally. For SSH agent forwarding, return the agent's response directly instead.

## Functions

| Name | Summary |
|---|---|
| [encodePublicKey](encode-public-key.md) | [jvm]<br>fun [encodePublicKey](encode-public-key.md)(keyPair: [KeyPair](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/security/KeyPair.html)): [AuthPublicKey](../-auth-public-key/index.md)<br>Encode a [KeyPair](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/security/KeyPair.html)'s public key to an [AuthPublicKey](../-auth-public-key/index.md) for use with [AuthHandler.onPublicKeysNeeded](../-auth-handler/on-public-keys-needed.md). |
| [encodePublicKeyBlob](encode-public-key-blob.md) | [jvm]<br>fun [encodePublicKeyBlob](encode-public-key-blob.md)(publicKey: [PublicKey](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/security/PublicKey.html)): [ByteArray](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html)<br>Encode a [PublicKey](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/security/PublicKey.html) to its raw SSH wire-format public key blob. |
| [getPublicKey](get-public-key.md) | [jvm]<br>fun [getPublicKey](get-public-key.md)(algorithmName: [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html), privateKeyData: [ByteArray](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html), passphrase: [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)?): [AuthPublicKey](../-auth-public-key/index.md)<br>fun [getPublicKey](get-public-key.md)(algorithmName: [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html), privateKeyData: [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html), passphrase: [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)?): [AuthPublicKey](../-auth-public-key/index.md)<br>Extract the [AuthPublicKey](../-auth-public-key/index.md) from a private key for use with [AuthHandler.onPublicKeysNeeded](../-auth-handler/on-public-keys-needed.md). |
| [sign](sign.md) | [jvm]<br>fun [sign](sign.md)(algorithmName: [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html), privateKeyData: [ByteArray](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html), passphrase: [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)?, dataToSign: [ByteArray](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html)): [ByteArray](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html)<br>fun [sign](sign.md)(algorithmName: [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html), privateKeyData: [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html), passphrase: [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)?, dataToSign: [ByteArray](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html)): [ByteArray](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html)<br>Sign authentication data using a private key. |
| [signWithKeyPair](sign-with-key-pair.md) | [jvm]<br>fun [signWithKeyPair](sign-with-key-pair.md)(algorithmName: [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html), keyPair: [KeyPair](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/security/KeyPair.html), dataToSign: [ByteArray](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html)): [ByteArray](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html)<br>Sign authentication data using a JCA [KeyPair](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/security/KeyPair.html). |