| 71 | } |
| 72 | |
| 73 | int 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 | |
| 93 | const char* Encryption::GetDefaultKey() { |
| 94 | return _DefaultKey; |
nothing calls this directly
no outgoing calls
no test coverage detected