5 Intents
Dominik Schürmann edited this page 2017-02-05 12:33:25 +01:00

These Intents can be used without using Android permissions to start OpenKeychain activities for cryptographic operations, such as encrypt/decrypt/sign/verify, or other method, such as key import.

Usage

All Intents require user interaction, e.g. to finally encrypt the user needs to press the "Encrypt" button. To do automatic encryption/decryption/sign/verify use the OpenPGP API.

Example Code

Please look into OpenKeychainIntentsActivity.

Intents

Android Intent actions:

  • android.intent.action.VIEW connected to .gpg and .asc files: Import Key and Decrypt
  • android.intent.action.SEND connected to all mime types (text/plain and every binary data like files and images): Encrypt and Decrypt
  • android.intent.action.SEND_MULTIPLE connected to all mime types except text/* and message/*

Preferred MIME types

  • application/pgp-message for encrypted OpenPGP data
  • application/pgp-keys to import OpenPGP keys

Panic Intent

OpenKeychain Intent actions:

We are following Android Guidelines by including the full package name as a prefix.

  • org.sufficientlysecure.keychain.action.ENCRYPT_TEXT
    • org.sufficientlysecure.keychain.action.EXTRA_TEXT: To encrypt or sign text, use this extra (type: String)
  • org.sufficientlysecure.keychain.action.ENCRYPT_DATA
    • Set data Uri (intent.setData()) pointing to a file/image, anything that can be read via an InputStream
    • org.sufficientlysecure.keychain.action.EXTRA_ASCII_ARMOR: Enable ASCII Armor for file encryption (encoding to Radix-64, 33% overhead) by adding the extra with value true
  • org.sufficientlysecure.keychain.action.DECRYPT_TEXT
    • org.sufficientlysecure.keychain.action.EXTRA_TEXT: To decrypt or verify text, use this extra (type: String)
  • org.sufficientlysecure.keychain.action.DECRYPT_DATA
    • Set data Uri (intent.setData()) pointing to a file
  • org.sufficientlysecure.keychain.action.IMPORT_KEY
    • org.sufficientlysecure.keychain.action.EXTRA_KEY_BYTES: key as byte array (type: byte[])
    • or set data Uri (intent.setData()) pointing to a file
  • org.sufficientlysecure.keychain.action.IMPORT_KEY_FROM_KEYSERVER
    • org.sufficientlysecure.keychain.action.EXTRA_QUERY:Extras: query (type: String)
    • or org.sufficientlysecure.keychain.action.EXTRA_FINGERPRINT (type: String)
  • org.sufficientlysecure.keychain.action.IMPORT_KEY_FROM_QR_CODE
    • without extras, starts Barcode Scanner to get QR Code

QR Codes

see QR Codes

NFC