Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

函数

func getGlobalCryptoKit()

public func getGlobalCryptoKit(): CryptoKit

功能:获取当前全局使用的加密套件。

返回值:

  • CryptoKit - 当前全局使用的加密套件。

异常:

示例:

import stdx.crypto.common.*

// 导入stdx.crypto.kit包,将使用默认全局加密套件
import stdx.crypto.kit.*

main() {
    // 没有设置全局加密套件将会抛出异常
    let cryptoKit = getGlobalCryptoKit()
    return 0
}

func setGlobalCryptoKit(CryptoKit)

public func setGlobalCryptoKit(kit: CryptoKit): Unit

功能:设置全局使用的加密套件。

参数:

示例:

import stdx.crypto.common.*
import stdx.crypto.kit.*

main() {
    // 创建一个默认的加密套件
    let defaultKit = DefaultCryptoKit()

    // 设置全局加密套件
    setGlobalCryptoKit(defaultKit)
    return 0
}