PublicKey
Defines a public key for email encryption (OpenPGP or S/MIME).
This object can be configured from the WebUI under Account › Public Keys
Fields
Section titled “Fields”accountId
Section titled “accountId”Type:
Id<Account>· read-onlyIdentifier for the account this public key belongs to
Type:
Text· requiredOpenPGP key or S/MIME certificate, armored, PEM, or binary encoded as base64
description
Section titled “description”Type:
String· requiredDescription of the public key
strictKeyWrapEncoding
Section titled “strictKeyWrapEncoding”Type:
Boolean· default:falseUse the RFC 5753 key wrap encoding for elliptic-curve S/MIME certificates; required by gpgsm and KMail, may not be readable by Microsoft Outlook
authenticatedEncryption
Section titled “authenticatedEncryption”Type:
Boolean· default:falseAll mail clients holding the private key can read AES-GCM with RSA-OAEP. Applies to S/MIME RSA and elliptic-curve keys. Apple Mail and Thunderbird ESR cannot read it.
createdAt
Section titled “createdAt”Type:
UTCDateTime· server-setCreation date of the public key
expiresAt
Section titled “expiresAt”Type:
UTCDateTime?· server-setExpiration date of the key, taken from the key itself
emailAddresses
Section titled “emailAddresses”Type:
Set<EmailAddress>· server-setEmail addresses bound to the key, taken from the key itself
Type:
PublicKeyKind?· server-setType of key, taken from the key itself
keyType
Section titled “keyType”Type:
String?· server-setType of key and its encryption algorithms, taken from the key itself
fingerprints
Section titled “fingerprints”Type:
Set<String>· server-setFingerprints of the keys or certificates used for encryption
capabilities
Section titled “capabilities”Type:
Set<PublicKeyCapability>· server-setEncryption features supported by the key
warnings
Section titled “warnings”Type:
Set<PublicKeyWarning>· server-setIssues detected in the key that may affect security or compatibility
JMAP API
Section titled “JMAP API”The PublicKey object is available via the urn:stalwart:jmap capability.
x:PublicKey/get
Section titled “x:PublicKey/get”This is a standard Foo/get method as defined in RFC 8620, Section 5.1.
This method requires the sysPublicKeyGet permission.
curl -X POST https://mail.example.com/jmap/ \ -H 'Authorization: Bearer $TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "methodCalls": [ [ "x:PublicKey/get", { "ids": [ "id1" ] }, "c1" ] ], "using": [ "urn:ietf:params:jmap:core", "urn:stalwart:jmap" ] }'x:PublicKey/set
Section titled “x:PublicKey/set”This is a standard Foo/set method as defined in RFC 8620, Section 5.3.
Supports the following operations in a single call: create, update, destroy.
Create
Section titled “Create”This operation requires the sysPublicKeyCreate permission.
curl -X POST https://mail.example.com/jmap/ \ -H 'Authorization: Bearer $TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "methodCalls": [ [ "x:PublicKey/set", { "create": { "new1": { "description": "Example", "key": "Example" } } }, "c1" ] ], "using": [ "urn:ietf:params:jmap:core", "urn:stalwart:jmap" ] }'Update
Section titled “Update”This operation requires the sysPublicKeyUpdate permission.
curl -X POST https://mail.example.com/jmap/ \ -H 'Authorization: Bearer $TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "methodCalls": [ [ "x:PublicKey/set", { "update": { "id1": { "key": "updated value" } } }, "c1" ] ], "using": [ "urn:ietf:params:jmap:core", "urn:stalwart:jmap" ] }'Destroy
Section titled “Destroy”This operation requires the sysPublicKeyDestroy permission.
curl -X POST https://mail.example.com/jmap/ \ -H 'Authorization: Bearer $TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "methodCalls": [ [ "x:PublicKey/set", { "destroy": [ "id1" ] }, "c1" ] ], "using": [ "urn:ietf:params:jmap:core", "urn:stalwart:jmap" ] }'x:PublicKey/query
Section titled “x:PublicKey/query”This is a standard Foo/query method as defined in RFC 8620, Section 5.5.
This method requires the sysPublicKeyQuery permission.
curl -X POST https://mail.example.com/jmap/ \ -H 'Authorization: Bearer $TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "methodCalls": [ [ "x:PublicKey/query", { "filter": { "accountId": "id1" } }, "c1" ] ], "using": [ "urn:ietf:params:jmap:core", "urn:stalwart:jmap" ] }'The x:PublicKey/query filter argument accepts the following conditions (combinable with AnyOf / AllOf / Not per RFC 8620):
| Condition | Kind |
|---|---|
accountId | id of Account |
stalwart-cli wraps the same JMAP calls. See the CLI reference for installation, authentication, and general usage.
stalwart-cli get PublicKey id1Create
Section titled “Create”stalwart-cli create PublicKey \ --field key=Example \ --field description=Examplestalwart-cli query PublicKeystalwart-cli query PublicKey --where accountId=id1Update
Section titled “Update”stalwart-cli update PublicKey id1 --field key='updated value'Delete
Section titled “Delete”stalwart-cli delete PublicKey --ids id1PublicKeyKind
Section titled “PublicKeyKind”| Value | Label |
|---|---|
openPgp | OpenPGP |
smime | S/MIME |
PublicKeyCapability
Section titled “PublicKeyCapability”| Value | Label |
|---|---|
aead | Authenticated encryption |
postQuantum | Post-quantum |
PublicKeyWarning
Section titled “PublicKeyWarning”| Value | Label |
|---|---|
weakRsa | RSA key shorter than 3072 bits |
noKnownDecryptor | No common mail client can decrypt messages for this key type |
postQuantumOnly | Only post-quantum keys, some clients cannot decrypt |
expiresSoon | Expires within 14 days |
addressMismatch | None of the key’s addresses belong to this account |
unusable | The key cannot be used for encryption |