| 94 | |
| 95 | template <class BC, class H, class Info> |
| 96 | void DataEncryptor<BC,H,Info>::FirstPut(const byte *) |
| 97 | { |
| 98 | SecByteBlock salt(DIGESTSIZE), keyCheck(DIGESTSIZE); |
| 99 | H hash; |
| 100 | |
| 101 | // use hash(passphrase | time | clock) as salt |
| 102 | hash.Update(m_passphrase, m_passphrase.size()); |
| 103 | time_t t=time(0); |
| 104 | hash.Update((byte *)&t, sizeof(t)); |
| 105 | clock_t c=clock(); |
| 106 | hash.Update((byte *)&c, sizeof(c)); |
| 107 | hash.Final(salt); |
| 108 | |
| 109 | // use hash(passphrase | salt) as key check |
| 110 | hash.Update(m_passphrase, m_passphrase.size()); |
| 111 | hash.Update(salt, SALTLENGTH); |
| 112 | hash.Final(keyCheck); |
| 113 | |
| 114 | AttachedTransformation()->Put(salt, SALTLENGTH); |
| 115 | |
| 116 | // mash passphrase and salt together into key and IV |
| 117 | SecByteBlock key(KEYLENGTH); |
| 118 | SecByteBlock IV(BLOCKSIZE); |
| 119 | GenerateKeyIV<BC,H,Info>(m_passphrase, m_passphrase.size(), salt, SALTLENGTH, ITERATIONS, key, IV); |
| 120 | |
| 121 | m_cipher.SetKeyWithIV(key, key.size(), IV); |
| 122 | SetFilter(new StreamTransformationFilter(m_cipher)); |
| 123 | |
| 124 | m_filter->Put(keyCheck, BLOCKSIZE); |
| 125 | } |
| 126 | |
| 127 | template <class BC, class H, class Info> |
| 128 | void DataEncryptor<BC,H,Info>::LastPut(const byte *inString, size_t length) |
nothing calls this directly
no test coverage detected