VaultMobileSDK  18R3
iOS framework for Vault API
Instance Methods | Class Methods | List of all members
VEVVaultCrypt Class Reference

A singleton class that provides convenience methods for encrypting and decrypting locally stored files. More...

Inherits NSObject.

Instance Methods

(void) - encryptFileAtPath:attributes:handler:
 Encrypts contents at path. More...
 
(BOOL) - createEncryptedFileAtPath:contents:attributes:error:
 Writes contents to disk after first encrypting them. This method is meant to mirror NSFileManager:createFileAtAtPath:contents:attributes: but with the addition of encryption. More...
 
(nullable NSInputStream *) - streamFromEncryptedFileAtPath:
 Returns an NSInputStream that decrypts the contents as they are read. More...
 
(nullable NSData *) - decryptContentsAtPath:error:
 Returns the contents at path after first decrypting them. This method is meant to mirror NSFileManager:contentsAtPath: but with the addition of decryption. More...
 

Class Methods

(instancetype) + sharedInstance
 Return the singleton instance.
 

Detailed Description

A singleton class that provides convenience methods for encrypting and decrypting locally stored files.

Note
Encryption keys are generated per user, so the user must be locally authenticated to perform these operations. If the user is not locally authenticated an error is returned with error code VEVCryptUserLoggedOutError.

Method Documentation

◆ encryptFileAtPath:attributes:handler:()

- (void) encryptFileAtPath: (NSString *)  path
attributes: (nullable NSDictionary< NSString *, id > *)  attributes
handler: (VEVVaultCryptResultHandler handler 

Encrypts contents at path.

Remarks
The user must be locally authenticated or an error with error code VEVCryptUserLoggedOutError is returned.
This method uses streams internally making it appropriate for files that do not fit comfortably in memory.
Parameters
pathThe file path to encrypt.
attributesThe file attributes.
handlerThe callback to invoke when complete.

◆ createEncryptedFileAtPath:contents:attributes:error:()

- (BOOL) createEncryptedFileAtPath: (NSString *)  path
contents: (NSData *)  contents
attributes: (nullable NSDictionary< NSString *, id > *)  attributes
error: (NSError *_Nullable __autoreleasing *)  error 

Writes contents to disk after first encrypting them. This method is meant to mirror NSFileManager:createFileAtAtPath:contents:attributes: but with the addition of encryption.

Remarks
The user must be locally authenticated or an error with error code VEVCryptUserLoggedOutError is returned.
This method is not appropriate for large files as it reads the entire contents at path into memory. For large files use VEVVaultCrypt:encryptFileAtPath:attributes:handler:
Parameters
pathThe file path to write the new file to.
contentsThe data to encrypt and write.
attributesThe file attributes.
errorThe error object in the event an error occurs writing the contents to disk.
See also
VEVVaultAuth
NSFileManager:createFileAtPath:contents:attributes:.

◆ streamFromEncryptedFileAtPath:()

- (nullable NSInputStream*) streamFromEncryptedFileAtPath: (NSString *)  srcPath

Returns an NSInputStream that decrypts the contents as they are read.

Remarks
The user must be locally authenticated or an error with error code VEVCryptUserLoggedOutError is returned.
Parameters
srcPathThe file path with the encrypted contents to decrypt.
Returns
The decrypting NSInputStream.

◆ decryptContentsAtPath:error:()

- (nullable NSData*) decryptContentsAtPath: (NSString *)  path
error: (NSError *_Nullable __autoreleasing *)  error 

Returns the contents at path after first decrypting them. This method is meant to mirror NSFileManager:contentsAtPath: but with the addition of decryption.

Remarks
The user must be locally authenticated or an error with code VEVCryptUserLoggedOutError is returned.
This method is not appropriate for large files as it reads the entire contents at path into memory. For large files use VEVVaultCrypt:streamFromEncryptedFileAtPath:
Parameters
pathThe local file path of the file to read.
errorThe error object in the event an error occurs reading the contents from disk.
Returns
The encrypted contents.
See also
VEVVautlCrypt::streamFromEncryptedFileAtPath:
VEVVaultAuth
NSFileManager:contentsAtPath:.

The documentation for this class was generated from the following file: