Package com.mongodb.crypt.capi
Interface MongoCryptContext
-
- All Superinterfaces:
java.lang.AutoCloseable,java.io.Closeable
public interface MongoCryptContext extends java.io.CloseableAn interface representing the lifecycle of an encryption or decryption request. It's modelled as a state machine.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classMongoCryptContext.StateThe possible states.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddMongoOperationResult(org.bson.BsonDocument document)voidclose()voidcompleteKeyDecryptors()Indicate that all key decryptors have been completedvoidcompleteMongoOperation()Signal completion of the operationorg.bson.RawBsonDocumentfinish()org.bson.RawBsonDocumentgetMongoOperation()MongoCryptContext.StategetState()Gets the current state.MongoKeyDecryptornextKeyDecryptor()voidprovideKmsProviderCredentials(org.bson.BsonDocument credentialsDocument)Provide KMS credentials on demand, in response to NEED_KMS_CREDENTIALS state
-
-
-
Method Detail
-
getState
MongoCryptContext.State getState()
Gets the current state.- Returns:
- the current state
-
getMongoOperation
org.bson.RawBsonDocument getMongoOperation()
- Returns:
- the operation to execute
-
addMongoOperationResult
void addMongoOperationResult(org.bson.BsonDocument document)
- Parameters:
document- a result of the operation
-
completeMongoOperation
void completeMongoOperation()
Signal completion of the operation
-
provideKmsProviderCredentials
void provideKmsProviderCredentials(org.bson.BsonDocument credentialsDocument)
Provide KMS credentials on demand, in response to NEED_KMS_CREDENTIALS state- Parameters:
credentialsDocument- document containing all credentials- Since:
- 1.4
-
nextKeyDecryptor
MongoKeyDecryptor nextKeyDecryptor()
- Returns:
- the next key decryptor, or null if there are no more
-
completeKeyDecryptors
void completeKeyDecryptors()
Indicate that all key decryptors have been completed
-
finish
org.bson.RawBsonDocument finish()
- Returns:
- the encrypted or decrypted document
-
close
void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable
-
-