Base64

public struct Base64

There is no Base64 instances. Base64 exists to provide a namespace. It contains static functions for Base64 encoding and decoding.

Static Methods

  • PEM encodes a byte array

    Declaration

    Swift

    public static func pemEncode(_ input: Bytes, _ pem: String) -> String

    Parameters

    input

    Bytes to encode

    pem

    The PEM header- and footer string

    Return Value

    The Base64 PEM encoding of input

  • PEM decodes a string

    Throws

    A base64 exception or a pemStructure exception if the input is malformed

    Declaration

    Swift

    public static func pemDecode(_ input: String, _ pem: String) throws -> Bytes

    Parameters

    input

    String to decode

    pem

    The expected PEM header- and footer string

    Return Value

    The Base64 PEM decoding of input

  • Base64 encodes a byte array

    Declaration

    Swift

    public static func encode(_ input: Bytes, _ linesize: Int = 76) -> String

    Parameters

    input

    Bytes to encode

    linesize

    Number of characters per line - 76 is default

    Return Value

    The Base64 encoding of input

  • Base64 decodes a string

    Throws

    A base64 exception if the input is malformed

    Declaration

    Swift

    public static func decode(_ input: String) throws -> Bytes

    Parameters

    input

    String to decode

    Return Value

    The Base64 decoding of input