5.2 Lock/Unlock Text

5.2.1 Lock Text

The lockText function of BayunCore class locks text with default encryption-policy dictated by server settings.

The function takes the following parameters :

  • sessionId : Unique SessionId which is received in the authenticate function response.

  • plainText : Text to be locked.

lockedText = bayunCore.lockText("<sessionId>", "<plainText>")

5.2.2 Lock Text with encryption-policy

The lockText function with encryption-policy as an optional parameter locks text with the encryption key dictated by the policy. The function takes the following parameters :

  • sessionId : Unique SessionId which is received in the authenticate function response.

  • plainText : Text to be locked.

    • dataType : string

  • encryptionPolicy : BayunEncryptionPolicy determines the key for locking.

  • keyGenerationPolicy : BayunKeyGenerationPolicy determines the policy to generate the data encryption key.

  • groupId : GroupId is required if encryptionPolicy is BayunEncryptionPolicyGroup.

If encryption-policy is other than BayunEncryptionPolicyGroup then groupId should be empty string.

from BayunCore import BayunEncryptionPolicy
from BayunCore import BayunKeyGenerationPolicy

encryptionPolicy = BayunEncryptionPolicy.Company
keyGenerationPolicy = BayunKeyGenerationPolicy.Static
lockedText =  bayunCore.lockText("<sessionId>", "<plainText>", encryptionPolicy, keyGenerationPolicy, "<groupId>")

5.2.3 Unlock Text

The unlockText function of BayunCore class unlocks a locked text. The function takes the following parameters :

  • sessionId : Unique SessionId which is received in the authenticate function response.

  • lockedText : Text to be unlocked.

    • dataType : string

plainText = bayunCore.unlockText("<sessionId>", "<lockedText>")

Last updated