Re: ASN.1 "INTEGER"?

From: Bruce Stephens (bruce+usenet_at_cenderis.demon.co.uk)
Date: 07/28/04


Date: Wed, 28 Jul 2004 19:03:38 +0100

Tom St Denis <tomstdenis@iahu.ca> writes:

[...]

> What I am having a problem with is figuring out ASN.1's "INTEGER"
> type. I looked up section 18.4 of one of the freely available ITU
> documents and it only specifies the grammar for writing ASN.1
> syntax.
>
> So in PKCS #1 when it specifies that a private key has "n INTEGER"
> how is that actually stored in memory? I assume you use OS2IP but
> how does the interpretter know how large the modulus is [and
> therefore how much to read in per int?].

The ASN.1 syntax on its own doesn't tell you what the bytes are going
to be, you also need to know the encoding rules. In this case, you
want DER (although BER might also work, if you're lucky---DER is
safer, though).

This page probably has enough details:
<http://luca.ntop.org/Teaching/Appunti/asn1.html>

You could also look at code which does stuff, like dumpasn1, snacc (or
its libraries), or openssl.

Doubtless there's Java code out there, too.



Relevant Pages

  • Re: Natural size: int
    ... expr2) is a signed integer type that can hold values ... the syntax for suffixed literals is becoming unwieldy ... that 456P32U specifies an unsigned 32-bit constant with the value 456. ... literal is the immediate operand of a cast to a numeric type, ...
    (comp.lang.c)
  • Systax question in MessageDlg
    ... My question is what is the syntax to use for the buttons. ... TmsgDlgbuttons and TmsgDlgBtn. ... three button message box, use the syntax containing Button1, Button2, ... HelpCtx specifies the context ID for the help topic that should appear ...
    (alt.comp.lang.borland-delphi)
  • Re: Use CONTINUE not NEXT SENTENCE was Re: Avoiding Logic Error?
    ... The standard ... specifies by its syntax that NEXT SENTENCE and END-IF cannot be in the ... The committee have clarified that the syntax has ... You assert that this contrived usage was _intended_ to be allowed, ...
    (comp.lang.cobol)
  • Re: Help With An ASM Instruction
    ... Phil Carmody wrote: ... > be in AT&T syntax!). ... That's how AT&T specifies the ... translation you mentioned. ...
    (alt.lang.asm)