asn.1

ASN.1 compiler error token “SYNTAX” unexpected

ⅰ亾dé卋堺 提交于 2019-12-20 07:21:24
问题 I'm currently trying to compile a snippet of ASN.1 code. It looks as follows: RFC1213-MIB DEFINITIONS ::= BEGIN IMPORTS experimental FROM RFC1155-SMI OBJECT-TYPE FROM RFC-1212; mypersonaltest OBJECT IDENTIFIER ::= { experimental 1 } tester OBJECT-TYPE SYNTAX INTEGER ACCESS read-write STATUS optional DESCRIPTION "This is a test" ::= { mypersonaltest 1 } END Now I'm always getting an error on the line SYNTAX INTEGER : ASN.1 grammar parse error near line 9 (token "SYNTAX"): syntax error,

Parsing PDOL for GET PROCESSING OPTIONS command in EMV transaction

社会主义新天地 提交于 2019-12-19 06:57:34
问题 I am trying to build a correctly formatted GET PROCESSING OPTIONS command to be sent to a contactless EMV card. This post has been very helpful but I just need to know a little more detail. When parsing the PDOL, is it safe to assume that each tag is 2 bytes in length, followed by the size of the data expected in return? For example, the PDOL 9F66049F02069F37049F1A02 is broken into 9F66 04 , 9F02 06 , etc. each with 2 byte tags and 1 byte for the expected length of the data value. Is it safe

Certificate subject X.509

不想你离开。 提交于 2019-12-17 21:41:01
问题 According to the X.509, a certificate has an attribute subject. C=US, ST=Maryland, L=Pasadena, O=Brent Baccala, OU=FreeSoft, CN=www.freesoft.org/emailAddress=baccala@freesoft.org This is the typical subject value. The question is what are the types(or tags) of those attributes(C, ST, L, O, OU, CN) and what is their format? 回答1: IETF PKIX (latest version RFC 5280) is a well accepted profile for certificates. From section 4.1.2.4, the following fields must be supported (I've added between

How to determine at run-time if app is for development, app store or ad hoc distribution?

家住魔仙堡 提交于 2019-12-17 17:21:23
问题 Is there a way to determine programmatically if the currently running app was built and signed for development only or whether it was built for distribution? And can one determine if was build for app store or ad hoc distribution? Is it e.g. possibly to access the code signature and get the information from there? Or are there certain files present in one of variants that don't exist in the other ones? Is part of the bundle info? Or can it be derived from the executable file? Any hints are

How do I decode a DER encoded string in Java?

限于喜欢 提交于 2019-12-17 16:08:02
问题 I'm trying to read a custom extension from a digital certificate. I know the value is a GeneralString encoded in DER. Is there an easy way to correctly decode it and get a Java String? I tried the following, but 's' includes some of the encoding metadata as junk characters at the start of the string. byte[] ext = cert.getExtensionValue("1.2.3.4"); String s= new String(ext); System.out.println(s); Is there a quick and easy way to do this? Or do I really need to use some full fledged ASN.1

What's the best way to serialize data in a language-independent binary format?

℡╲_俬逩灬. 提交于 2019-12-17 15:44:45
问题 I'm looking into a mechanism for serialize data to be passed over a socket or shared-memory in a language-independent mechanism. I'm reluctant to use XML since this data is going to be very structured, and encoding/decoding speed is vital. Having a good C API that's liberally licensed is important, but ideally there should be support for a ton of other languages. I've looked at google's protocol buffers and ASN.1. Am I on the right track? Is there something better? Should I just implement my

Problem in compiling C code generated by osmocom asn1c

萝らか妹 提交于 2019-12-13 17:03:53
问题 I have installed the osmocom asn1c compiler, the aper-prefix branch, to obtain an implementation of the TCAP protocol. I have used the respective script to compile the ".asn" files. The C files are generated successfully, but when compiling the obtained C code, an error is raised, which is related to this line of code: #include <EXTERNAL.h> In fact, the file EXTERNAL.h is missing (seemingly, the EXTERNAL type is not supported by this compiler). Is anyone aware of this problem and a possible

Send asn1 data from client to server with socket

微笑、不失礼 提交于 2019-12-13 06:49:50
问题 I wrote this code in the C client to get an int number , encode it and send it through socket int clientNumber; printf("Enter a number :\n "); scanf("%d",&clientNumber); Message01_t *message1; message1 = calloc(1, sizeof(Message01_t)); message1->number= clientNumber; char buffer[BUFFERSIZE]; size_t bufferLen = sizeof(buffer); der_encode_to_buffer(&asn_DEF_Message01, message1, buffer, bufferLen); xer_fprint(stdout, &asn_DEF_Message01, message1); if( send( to_server_socket, &message1, sizeof(

Pyasn1 how do decoder.decode works?

故事扮演 提交于 2019-12-13 01:49:05
问题 I have this little part of code: from pyasn1.type import univ from pyasn1.codec.ber import decoder decoder.decode(binary_file.read(5)) my binary_file variable it's a particular binary file encoded (CDR) if i try to decode the readed part it gives me this error: pyasn1.error.PyAsn1Error: [128:0:0]+[128:32:79] not in asn1Spec: None how can i fix? 回答1: Unless you are decoding a data structure that only contains base ASN.1 types (such as INTEGER, SEQUENCE etc.), you need to pass your top-level