1. 程式人生 > >iOS 加密算法匯總

iOS 加密算法匯總

fish ons b-s status lai 匯總 nal blog oss

CCCryptorStatus CCCryptorCreate(

CCOperation op, /* kCCEncrypt, etc. */

CCAlgorithm alg, /* kCCAlgorithmDES, etc. */

CCOptions options, /* kCCOptionPKCS7Padding, etc. */

const void *key, /* raw key material */

size_t keyLength,

const void *iv, /* optional initialization vector */

CCCryptorRef *cryptorRef) /* RETURNED */

enum {

kCCEncrypt = 0,

kCCDecrypt,

};

typedef uint32_t CCOperation;

enum {

/* options for block ciphers */

kCCOptionPKCS7Padding = 0x0001,

kCCOptionECBMode = 0x0002

/* stream ciphers currently have no options */

};

typedef uint32_t CCOptions;

enum {

kCCAlgorithmAES128 = 0,

kCCAlgorithmAES = 0,

kCCAlgorithmDES,

kCCAlgorithm3DES,

kCCAlgorithmCAST,

kCCAlgorithmRC4,

kCCAlgorithmRC2,

kCCAlgorithmBlowfish

};

typedef uint32_t CCAlgorithm;

OSStatus SecKeyEncrypt(

SecKeyRef key,

SecPadding padding,

const uint8_t *plainText,

size_t plainTextLen,

uint8_t *cipherText,

size_t *cipherTextLen)

__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_2_0);

iOS 加密算法匯總