-
Notifications
You must be signed in to change notification settings - Fork 22
/
SFPasswordAssistant.h
57 lines (49 loc) · 1.92 KB
/
SFPasswordAssistant.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
* Released into the public domain.
*
* Written by Anders Bergh <anders1@gmail.com> in 2013.
*/
#ifndef SFPASSWORDASSISTANT_H
#define SFPASSWORDASSISTANT_H
#include <CoreFoundation/CoreFoundation.h>
typedef struct SFPWAContext *SFPWAContextRef;
typedef enum {
kSFPWAAlgorithmMemorable = 0,
kSFPWAAlgorithmRandom = 1,
kSFPWAAlgorithmLetters = 2, /* FIPS-181 compliant */
kSFPWAAlgorithmAlphanumeric = 3,
kSFPWAAlgorithmNumbers = 4
} SFPWAAlgorithm;
// bool SFPWAStdStringInDictionary(SFPWAContextRef ctx, std::string s);
bool SFPWACStringInDictionary(SFPWAContextRef ctx, const char *string);
SFPWAContextRef SFPWAContextCreate(void);
SFPWAContextRef SFPWAContextCreateWithDefaults(void);
void SFPWAContextLoadDictionaries(SFPWAContextRef ctx, CFArrayRef langs,
bool unknown);
void SFPWAContextRelease(SFPWAContextRef ctx);
/* Example:
*
* SFPWAPasswordEvaluator(ctx, CFSTR("password"), 0, policy) ->
* {
* "Entropy": "123.4567",
* "Quality": 80,
* "Variety": 3,
* "Errors": [
* { "Value": "-27099", "Message": "Mix upper and lower case, punctuation,
* and numbers" }
* ]
* }
*/
CFDictionaryRef SFPWAPasswordEvaluator(SFPWAContextRef ctx,
CFStringRef password, int unknown,
CFDictionaryRef policy);
CFMutableArrayRef SFPWAPasswordSuggest(SFPWAContextRef ctx,
CFDictionaryRef policy, int length,
int unknown, int count,
SFPWAAlgorithm algorithm);
CFPropertyListRef SFPWAPolicyCopyDefault(void);
CFPropertyListRef SFPWAPolicyCopyFromFile(const char *path);
CFArrayRef SFPWAPolicyLanguages(CFDictionaryRef policy);
void SFPWAPolicyParse(SFPWAContextRef ctx, CFDictionaryRef policy);
CFStringRef SFPWARandomWord(SFPWAContextRef ctx, unsigned int length);
#endif /* SFPASSWORDASSISTANT_H */