MCPcopy Create free account
hub / github.com/AGWA/git-crypt / load_legacy

Method load_legacy

key.cpp:105–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103}
104
105void Key_file::Entry::load_legacy (uint32_t arg_version, std::istream& in)
106{
107 version = arg_version;
108
109 // First comes the AES key
110 in.read(reinterpret_cast<char*>(aes_key), AES_KEY_LEN);
111 if (in.gcount() != AES_KEY_LEN) {
112 throw Malformed();
113 }
114
115 // Then the HMAC key
116 in.read(reinterpret_cast<char*>(hmac_key), HMAC_KEY_LEN);
117 if (in.gcount() != HMAC_KEY_LEN) {
118 throw Malformed();
119 }
120
121 if (in.peek() != -1) {
122 // Trailing data is a good indication that we are not actually reading a
123 // legacy key file. (This is important to check since legacy key files
124 // did not have any sort of file header.)
125 throw Malformed();
126 }
127}
128
129void Key_file::Entry::store (std::ostream& out) const
130{

Callers 2

load_keyFunction · 0.80
migrate_keyFunction · 0.80

Calls 1

MalformedClass · 0.85

Tested by

no test coverage detected