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?
I’d like to create a Base16 encoder and decoder for Lion’s new Security.framework to
Share
I don’t see a way to tie custom encoders into
SecEncodeTransformCreate(), which is whatkSecBase32Encodingand the others are based on. But it’s easy to create a transform that accepts a “encoding” bool and makes use of that to decide whether to encode or decode. In the CaesarTransform example, they attach an attribute calledkeywithSecTransformSetAttribute(). You’d do the same thing, but with a boolencode.And of course you could just create an encoding transform and a decoding transform.