MYASN1Object.h
author Jens Alfke <jens@mooseyard.com>
Tue Jun 02 13:16:28 2009 -0700 (2009-06-02)
changeset 16 c409dbc4f068
child 19 f6c91b9da05b
permissions -rw-r--r--
* Added ASN.1 / BER / DER utilities, to be used in generating and parsing X.509 certs.
* Added Keychain user-interaction-allowed setter. Added doc comments to MYSymmetricKey.
     1 //
     2 //  MYASN1Object.h
     3 //  MYCrypto-iPhone
     4 //
     5 //  Created by Jens Alfke on 5/28/09.
     6 //  Copyright 2009 Jens Alfke. All rights reserved.
     7 //
     8 
     9 #import <Foundation/Foundation.h>
    10 
    11 
    12 /** A generic ASN.1 data value. The BER parser instantiates these to represent parsed values that
    13     it doesn't know how to represent otherwise. */
    14 @interface MYASN1Object : NSObject
    15 {
    16     @private
    17     uint32_t _tag;
    18     uint8_t _tagClass;
    19     BOOL _constructed;
    20     NSData *_value;
    21     NSArray *_components;
    22 }
    23 
    24 - (id) initWithTag: (uint32_t)tag
    25            ofClass: (uint8_t)tagClass 
    26        constructed: (BOOL)constructed
    27              value: (NSData*)value;
    28 - (id) initWithTag: (uint32_t)tag
    29            ofClass: (uint8_t)tagClass 
    30         components: (NSArray*)components;
    31 
    32 @property (readonly) uint32_t tag;
    33 @property (readonly) uint8_t tagClass;
    34 @property (readonly) BOOL constructed;
    35 @property (readonly) NSData *value;
    36 @property (readonly) NSArray *components;
    37 
    38 + (NSString*) dump: (id)object;
    39 
    40 @end
    41 
    42 
    43 /** An ASN.1 "big" (arbitrary-length) integer.
    44     The value contains the bytes of the integer, in big-endian order. */
    45 @interface MYASN1BigInteger : MYASN1Object
    46 @end
    47 
    48 
    49 /** An ordered string of bits, as used in ASN.1.
    50     This differs from NSData in that it need not occupy a whole number of bytes;
    51     that is, the number of bits need not be a multiple of 8. */
    52 @interface MYBitString : NSObject 
    53 {
    54     NSData *_bits;
    55     NSUInteger _bitCount;
    56 }
    57 
    58 - (id)initWithBits: (NSData*)bits count: (NSUInteger)bitCount;
    59 
    60 @property (readonly, nonatomic) NSData *bits;
    61 @property (readonly, nonatomic) NSUInteger bitCount;
    62 
    63 @end