Log into your servers with SSH and authenticate with your Security Keys and OpenPGP cards over NFC and USB.
This list is not exhaustive. A full list of supported hardware can be found in the documentation of our Hardware Security SDK.
NFC:
USB:
class MainActivity:AppCompatActivity(), SecurityKeyDialogCallback<OpenPgpSecurityKey> {
private fun showSecurityKeyDialog() {
val options = SecurityKeyDialogOptions.builder()
//.setPinLength(4) // security keys with a fixed PIN and PUK length improve the UX
//.setPukLength(8)
.setShowReset(true) // show button to reset/unblock of PIN using the PUK
.build()
val securityKeyDialogFragment = OpenPgpSecurityKeyDialogFragment.newInstance(options)
securityKeyDialogFragment.show(supportFragmentManager)
}
override fun onSecurityKeyDialogDiscovered(
dialogInterface: SecurityKeyDialogInterface,
securityKey: OpenPgpSecurityKey,
pinProvider: PinProvider?
) {
val loginName = "cotech"
val loginHost = "ssh.hwsecurity.dev"
connectToSsh(loginName, loginHost, securityKey, pinProvider)
}
private fun connectToSsh(
loginName: String, loginHost: String, securityKey: OpenPgpSecurityKey, pinProvider: PinProvider
) = runBlocking {
val deferred = GlobalScope.async(Dispatchers.IO) {
val securityKeyAuthenticator = securityKey.createSshAuthenticatorFromPublicKey(pinProvider)
// NOTE: Please consult the guide for more details on SecurityKeyJschIdentity and jschConnection()
val securityKeyIdentity = SecurityKeyJschIdentity(loginName, securityKeyAuthenticator)
jschConnection(loginHost, securityKeyIdentity)
}
try {
deferred.await()
} catch (e: Exception) {
// NOTE: Please consult the guide for a full sample.
}
}
}