1

I'd like to create a Base16 encoder and decoder for Lion's new Security.framework to complement kSecBase32Encoding and kSecBase64Encoding. Apple's documentation shows how to write a custom transform (Caesar cipher) using SecTransformRegister. As far as I can tell, custom transforms registered this way have to operate symmetrically on the data and can't be used to encode and decode data differently. Does anyone know if writing a custom encoder/decoder is possible, and if so, how?

4

1 回答 1

0

我看不到将自定义编码器绑定到 的方法SecEncodeTransformCreate(),这是kSecBase32Encoding和其他编码器所基于的。但是很容易创建一个接受“编码”布尔值的转换,并利用它来决定是编码还是解码。在 CaesarTransform 示例中,它们附加了一个名为keywith的属性SecTransformSetAttribute()。你会做同样的事情,但使用 bool encode

当然,您可以只创建一个编码转换和一个解码转换。

于 2012-06-28T04:48:08.597 回答