IVとキーを作成するために、AESデコーダーを実装しています。アルゴリズムは次のようになります
IVキーの16バイト:ProductID.getBytes("UTF-8")の最初の16バイト
(If there are no enough bytes,
make up to 16 bytes at right by 0x32)
パディングのための私のコード
- (char*)paddedStringFromString:(NSString *)string withLength:(NSUInteger)length{
const char *stringC = [string UTF8String];
char * output;
output = malloc(length+1);
for (NSInteger i = 0; i < length; i++) {
if (i < string.length) output[i] = stringC[i];
else output[i] = 0x32;
}
return output;
}
しかし、私は正しい結果を得ていません。パディングに対する私のアプローチは正しいですか。助けてください