MYCrypto+Cocoa.m
author Jens Alfke <jens@mooseyard.com>
Sat Jun 06 15:01:28 2009 -0700 (2009-06-06)
changeset 21 2c300b15b381
parent 8 4c0eafa7b233
permissions -rw-r--r--
* Created class MYCertificateRequest, factored out of MYCertificateInfo.
* Added method to create a MYIdentity directly from a MYCertificateRequest.
* Added raw modulus+exponent accessor and initializer for MYPublicKey.
* Removed obsolete MYCertGen code, and the MYPrivateKey identity-creation method that used it.
snej@8
     1
//
snej@8
     2
//  MYCrypto+Cocoa.m
snej@8
     3
//  MYCrypto
snej@8
     4
//
snej@8
     5
//  Created by Jens Alfke on 4/10/09.
snej@8
     6
//  Copyright 2009 Jens Alfke. All rights reserved.
snej@8
     7
//
snej@8
     8
snej@8
     9
#import "MYCrypto+Cocoa.h"
snej@8
    10
#import "MYCrypto_Private.h"
snej@8
    11
#import "MYIdentity.h"
snej@8
    12
snej@8
    13
snej@8
    14
@implementation SFChooseIdentityPanel (MYCrypto)
snej@8
    15
snej@8
    16
snej@8
    17
- (NSInteger)my_runModalForIdentities:(NSArray *)identities 
snej@8
    18
                              message:(NSString *)message
snej@8
    19
{
snej@8
    20
    NSMutableArray *identityRefs = $marray();
snej@8
    21
    for (MYIdentity *ident in identities)
snej@8
    22
        [identityRefs addObject: (id)ident.identityRef];
snej@8
    23
    return [self runModalForIdentities: identityRefs message: message];
snej@8
    24
}
snej@8
    25
snej@8
    26
- (void)my_beginSheetForWindow:(NSWindow *)docWindow 
snej@8
    27
                 modalDelegate:(id)delegate 
snej@8
    28
                didEndSelector:(SEL)didEndSelector
snej@8
    29
                   contextInfo:(void *)contextInfo 
snej@8
    30
                    identities:(NSArray *)identities 
snej@8
    31
                       message:(NSString *)message
snej@8
    32
{
snej@8
    33
    NSMutableArray *identityRefs = $marray();
snej@8
    34
    for (MYIdentity *ident in identities)
snej@8
    35
        [identityRefs addObject: (id)ident.identityRef];
snej@8
    36
    [self beginSheetForWindow:docWindow 
snej@8
    37
                modalDelegate:delegate 
snej@8
    38
               didEndSelector:didEndSelector
snej@8
    39
                  contextInfo:contextInfo 
snej@8
    40
                   identities:identityRefs
snej@8
    41
                      message:message];
snej@8
    42
}
snej@8
    43
snej@8
    44
- (MYIdentity*) my_identity {
snej@8
    45
    return [MYIdentity identityWithIdentityRef: [self identity]];
snej@8
    46
}
snej@8
    47
snej@8
    48
@end
snej@14
    49
snej@14
    50
snej@14
    51
snej@14
    52
/*
snej@14
    53
 Copyright (c) 2009, Jens Alfke <jens@mooseyard.com>. All rights reserved.
snej@14
    54
 
snej@14
    55
 Redistribution and use in source and binary forms, with or without modification, are permitted
snej@14
    56
 provided that the following conditions are met:
snej@14
    57
 
snej@14
    58
 * Redistributions of source code must retain the above copyright notice, this list of conditions
snej@14
    59
 and the following disclaimer.
snej@14
    60
 * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
snej@14
    61
 and the following disclaimer in the documentation and/or other materials provided with the
snej@14
    62
 distribution.
snej@14
    63
 
snej@14
    64
 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
snej@14
    65
 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 
snej@14
    66
 FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRI-
snej@14
    67
 BUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
snej@14
    68
 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
snej@14
    69
  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
snej@14
    70
 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 
snej@14
    71
 THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
snej@14
    72
 */