sogo/SoObjects/SOGo/NSString+Crypto.h
Ludovic Marcotte 08230b33bb See ChangeLog
Monotone-Parent: 747fe8c2134a990c1cdf3b494c2b7776021cb736
Monotone-Revision: 3c4baa92c5634d4da061da739a9b544d04c44586

Monotone-Author: ludovic@Sophos.ca
Monotone-Date: 2012-05-31T13:24:32
2012-05-31 13:24:32 +00:00

64 lines
2 KiB
Objective-C

/* NSString+Crypto.h - this file is part of SOGo
*
* Copyright (C) 2012 Nicolas Höft
* Copyright (C) 2012 Inverse inc.
*
* Author: Nicolas Höft
* Inverse inc.
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef NSSTRING_CRYPTO_H
#define NSSTRING_CRYPTO_H
#import <Foundation/NSData.h>
#import <Foundation/NSString.h>
typedef enum {
encDefault, //!< default encoding, let the algorithm decide
encPlain, //!< the data is plain text, simply convert to string
encHex, //!< the data is hex encoded
encBase64, //!< base64 encoding
} keyEncoding;
@class NSObject;
@interface NSString (SOGoCryptoExtension)
- (BOOL) isEqualToCrypted: (NSString *) cryptedPassword
withDefaultScheme: (NSString *) theScheme;
- (NSString *) asCryptedPassUsingScheme: (NSString *) passwordScheme
withSalt: (NSData *) theSalt
andEncoding: (keyEncoding) encoding;
// this method uses the default encoding (base64, plain, hex)
// and generates a salt when necessary
- (NSString *) asCryptedPassUsingScheme: (NSString *) passwordScheme;
- (NSArray *) splitPasswordWithDefaultScheme: (NSString *) defaultScheme;
- (NSString *) asSHA1String;
- (NSString *) asMD5String;
+ (keyEncoding) getDefaultEncodingForScheme: (NSString *) passwordScheme;
@end
#endif /* NSSTRING_CRYPTO_H */