PkiEncrypter
Class: PkiEncrypter
Defined in: packages/core/src/services/pki.encrypter.ts:316
Asymmetric encrypter: hybrid RSA-OAEP-256 + AES-256-GCM
The public keys are committed with the application, so anyone can encrypt a value. The private keys only live in the runtime (a Kubernetes Secret mount or environment variables), so only the application can decrypt.
Format: v1:<kid>:<base64(wrappedKey)>:<base64(iv | tag | ciphertext)>, the kid is authenticated.
Implements
Constructors
Constructor
new PkiEncrypter():
PkiEncrypter
Returns
PkiEncrypter
Properties
configuration
protectedconfiguration:string
Defined in: packages/core/src/services/pki.encrypter.ts:321
Serialized configuration of the keyring, to keep its cache when unchanged
keyring
protectedkeyring:PkiKeyring
Defined in: packages/core/src/services/pki.encrypter.ts:317
Methods
configure()
configure(
options?,context?):void
Defined in: packages/core/src/services/pki.encrypter.ts:328
Configure the keyring
Parameters
options?
PkiEncrypterOptions = {}
the encrypter options
context?
the encryption context
Returns
void
Implementation of
decrypt()
decrypt(
data):Promise<string>
Defined in: packages/core/src/services/pki.encrypter.ts:384
Decrypt with the private key of the value kid
Parameters
data
string
the encrypted value
Returns
Promise<string>
the plain value
Implementation of
encrypt()
encrypt(
data):Promise<string>
Defined in: packages/core/src/services/pki.encrypter.ts:363
Encrypt with the public key of the active key
Parameters
data
string
the plain value
Returns
Promise<string>
the encrypted value
Implementation of
getKeyring()
getKeyring():
PkiKeyring
Defined in: packages/core/src/services/pki.encrypter.ts:342
Get the keyring, with the default options when not configured
Returns
the keyring
needsUpgrade()
needsUpgrade(
data):boolean
Defined in: packages/core/src/services/pki.encrypter.ts:409
A value needs an upgrade when it was not encrypted with the active key
Parameters
data
string
the encrypted value
Returns
boolean
true to re-encrypt it
Implementation of
aad()
protectedstaticaad(kid):Uint8Array
Defined in: packages/core/src/services/pki.encrypter.ts:354
Additional authenticated data binding the format and the kid
Parameters
kid
string
the key id
Returns
Uint8Array
the AAD