RNCryptor

public enum RNCryptor

RNCryptor encryption/decryption interface.

  • Errors thrown by RNCryptorType.

    See more

    Declaration

    Swift

    public enum Error: Int, Swift.Error
  • Encrypt data using password and return encrypted data.

    Declaration

    Swift

    public static func encrypt(data: Data, withPassword password: String) -> Data
  • Decrypt data using password and return decrypted data. Throws if password is incorrect or ciphertext is in the wrong format.

    Throws

    throws Error

    Declaration

    Swift

    public static func decrypt(data: Data, withPassword password: String) throws -> Data
  • Generates random Data of given length Crashes if length is larger than allocatable memory, or if the system random number generator is not available.

    Declaration

    Swift

    public static func randomData(ofLength length: Int) -> Data
  • A encryptor for the latest data format. If compatibility with other RNCryptor implementations is required, you may wish to use the specific encryptor version rather than accepting latest.

    See more

    Declaration

    Swift

    public final class Encryptor: RNCryptorType
  • Password-based decryptor that can handle any supported format.

    See more

    Declaration

    Swift

    public final class Decryptor : RNCryptorType
  • V3 format settings

    See more

    Declaration

    Swift

    public final class FormatV3
  • Format version 3 encryptor. Use this to ensure a specific format verison or when using keys (which are inherrently versions-specific). To use the latest encryptor with a password, use Encryptor instead.

    See more

    Declaration

    Swift

    public final class EncryptorV3 : RNCryptorType
  • Format version 3 decryptor. This is required in order to decrypt using keys (since key configuration is version-specific). For password decryption, Decryptor is generally preferred, and will call this if appropriate.

    See more

    Declaration

    Swift

    public final class DecryptorV3: VersionedDecryptorType