MCPcopy Create free account
hub / github.com/ashkulz/NppFTP / SetDefaultKey

Method SetDefaultKey

src/Encryption.cpp:73–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71}
72
73int Encryption::SetDefaultKey(const char * defKey, int size) {
74 if (size == -1)
75 size = strlen(defKey);
76 if (size == 0) {
77 _IsDefaultKey = true;
78 defKey = defaultString; //cannot allow empty strings
79 size = 8;
80 } else {
81 _IsDefaultKey = false;
82 }
83 if ((size_t)size > KeySize)
84 size = KeySize;
85
86 memcpy(_DefaultKey, defKey, size);
87 for(size_t i = size; i < KeySize; i++) {
88 _DefaultKey[i] = 0; //fill rest with zeroes
89 }
90 return 0;
91}
92
93const char* Encryption::GetDefaultKey() {
94 return _DefaultKey;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected