Stores data encrypted into the system keychain. More...
Import Statement: | import ArcGIS.AppFramework.SecureStorage 1.0 |
Properties
- connectedToBackend : bool
- maximumKeyLength : int
- maximumValueLength : int
Signals
- error(string errorMessage)
Methods
Detailed Description
This code sample demonstrates usage of the SecureStorage component.
Item { TextField { id: key placeholderText: "Enter key" } TextField { id: value placeholderText: "Enter value" anchors.left: key.right } //Click on the button to store data in the keychain Button { id: secureButton text: qsTr("Secure Data") onClicked: { SecureStorage.setValue(key.text,value.text) } anchors.top:value.bottom anchors.topMargin: 10 * AppFramework.displayScaleFactor } //Click on the button to retrieve data Button { id: retrieveButton text: qsTr("Retrieve Data") onClicked: { retrieveData.text = qsTr("Value: ") + SecureStorage.value(key.text) } anchors.top: secureButton.bottom anchors.topMargin: 10 * AppFramework.displayScaleFactor } //Display retrieved data Text { id: retrieveData anchors.top: retrieveButton.bottom anchors.topMargin: 10 * AppFramework.displayScaleFactor } //Display maximum key length supported by the operating system Text { id: maximumKeyLength text: qsTr("Maximum Key Length: ") + SecureStorage.maximumKeyLength anchors.top: retrieveData.bottom anchors.topMargin: 10 * AppFramework.displayScaleFactor } //Display maximum value length supported by the operating system Text { id: maximumValueLength text: qsTr("Maximum Value Length: ") + SecureStorage.maximumValueLength anchors.top: maximumKeyLength.bottom anchors.topMargin: 10 * AppFramework.displayScaleFactor } }
Property Documentation
Returns true if the SecureStorage component is connected to a secure kernel in the OS to store the information. In most cases, you should expect this property to return true on every platform but Linux.
Text { id: connectedSecurely Layout.fillWidth: true font.pointSize: 10 Layout.preferredWidth: parent.width wrapMode: Text.Wrap horizontalAlignment: Text.AlignLeft text: qsTr("Connected to a secure kernel: ") + SecureStorage.connectedToBackend }
Returns the maximum key length supported by the operating system.
If the key you need to store is larger than the key length, consider splitting and storing the key separately.
Returns the maximum value length supported by the operating system.
If the value you need to store is larger than the value length, consider splitting and storing the value separately.
Signal Documentation
Signal emitted when an error is encountered when executing the setValue or value methods.
Note: The corresponding handler is onError
.
Method Documentation
Returns true if the given key exists in the secure storage. Otherwise, returns false.
The key parameter
The key to check is present in the secure storage.
Stores data in the keychain associated with the provided key.
If you use the same key twice, the previous value associated with the key will be overwritten.
If you enter a valid key with an empty string, it will remove the key present in the keychain.
The key parameter
The key to be used to retrieve the value. This key cannot be null or an empty string.
Be aware that Android will encounter an exception if certain special characters, such as /, are used in keys.
The value parameter
The value to encrypt and store.
See also value().
Retrieves data associated with the key.
The key parameter
The key to return the encrypted value for.
See also setValue().