Install asn1c library in Xcode 5 to confirm receipt in ios7

I hit my head about checking a check.

I am in the phase where I am checking if the certificate is valid and I need to parse the ASN1 file.

Apple suggests using asn1c, for example:

 #include "Payload.h" /* This header file is generated by asn1c. */

 void *pld = NULL;
 size_t pld_sz;

 Payload_t *payload = NULL;
 asn_dec_rval_t rval;

 rval = asn_DEF_Payload.ber_decoder(NULL, &asn_DEF_Payload, (void **)&payload, pld, pld_sz, 0);

I already download asn1c-master.zip from: https://github.com/vlm/asn1c

Now I do not know how to install this library in Xcode, and if I need more work, or can I run the apple example after installing asn1c?

Thanks for the help.

EDIT:

I follow the instructions in the INSTALL file: in the asn1c-master file I run in the terminal:

./configure
make
make check
make install

After that, I create a folder in a separate file receipt.asn1and add this text to it:

 ReceiptModule DEFINITIONS ::=
 BEGIN

 ReceiptAttribute ::= SEQUENCE {
     type    INTEGER,
     version INTEGER,
     value   OCTET STRING
 }

 Payload ::= SET OF ReceiptAttribute

 END

After that I launched

asn1c -fnative-types receipt.ans1

But I exit from:

-fnative-types: Deprecated option
ASN.1 grammar parse error near line 1 (token "{"): syntax error, unexpected '{', expecting TOK_typereference or TOK_capitalreference
Cannot parse "receipt.asn1"
+4
1

http://github.com/vlm/asn1c/blob/master/INSTALL

( Mac OS X):

# Terminal command line from: https://developer.apple.com/library/ios/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateLocally.html#//apple_ref/doc/uid/TP40010573-CH1-SW3
asn1c -fnative-types receipt.ans1
# the file receipt.ans1 has contents from Listing 1-1 in the above URL

# converter-sample.c has a main. Don't want that!
rm converter-sample.c

rm Makefile.am.sample

.c .h Xcode, Mac , .c .h . , , .

+3

Source: https://habr.com/ru/post/1533743/


All Articles