Skip to content

PublicKey

Defines a public key for email encryption (OpenPGP or S/MIME).

This object can be configured from the WebUI under Account › Public Keys

Type: Id<Account> · read-only

Identifier for the account this public key belongs to

Type: Text · required

OpenPGP key or S/MIME certificate, armored, PEM, or binary encoded as base64

Type: String · required

Description of the public key

Type: Boolean · default: false

Use the RFC 5753 key wrap encoding for elliptic-curve S/MIME certificates; required by gpgsm and KMail, may not be readable by Microsoft Outlook

Type: Boolean · default: false

All 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.

Type: UTCDateTime · server-set

Creation date of the public key

Type: UTCDateTime? · server-set

Expiration date of the key, taken from the key itself

Type: Set<EmailAddress> · server-set

Email addresses bound to the key, taken from the key itself

Type: PublicKeyKind? · server-set

Type of key, taken from the key itself

Type: String? · server-set

Type of key and its encryption algorithms, taken from the key itself

Type: Set<String> · server-set

Fingerprints of the keys or certificates used for encryption

Type: Set<PublicKeyCapability> · server-set

Encryption features supported by the key

Type: Set<PublicKeyWarning> · server-set

Issues detected in the key that may affect security or compatibility

The PublicKey object is available via the urn:stalwart:jmap capability.

This is a standard Foo/get method as defined in RFC 8620, Section 5.1.

This method requires the sysPublicKeyGet permission.

Terminal window
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"
]
}'

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.

This operation requires the sysPublicKeyCreate permission.

Terminal window
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"
]
}'

This operation requires the sysPublicKeyUpdate permission.

Terminal window
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"
]
}'

This operation requires the sysPublicKeyDestroy permission.

Terminal window
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"
]
}'

This is a standard Foo/query method as defined in RFC 8620, Section 5.5.

This method requires the sysPublicKeyQuery permission.

Terminal window
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):

ConditionKind
accountIdid of Account

stalwart-cli wraps the same JMAP calls. See the CLI reference for installation, authentication, and general usage.

Terminal window
stalwart-cli get PublicKey id1
Terminal window
stalwart-cli create PublicKey \
--field key=Example \
--field description=Example
Terminal window
stalwart-cli query PublicKey
stalwart-cli query PublicKey --where accountId=id1
Terminal window
stalwart-cli update PublicKey id1 --field key='updated value'
Terminal window
stalwart-cli delete PublicKey --ids id1
ValueLabel
openPgpOpenPGP
smimeS/MIME
ValueLabel
aeadAuthenticated encryption
postQuantumPost-quantum
ValueLabel
weakRsaRSA key shorter than 3072 bits
noKnownDecryptorNo common mail client can decrypt messages for this key type
postQuantumOnlyOnly post-quantum keys, some clients cannot decrypt
expiresSoonExpires within 14 days
addressMismatchNone of the key’s addresses belong to this account
unusableThe key cannot be used for encryption