int keySize = builder.getHeader().getKeySize()/8;\r
int hashSize = builder.getHeader().getHashAlgorithmEx().hashSize;\r
\r
- byte[] verifierSalt = new byte[blockSize]\r
- , verifier = new byte[blockSize]\r
- , keySalt = new byte[blockSize]\r
- , keySpec = new byte[keySize]\r
- , integritySalt = new byte[hashSize];\r
- r.nextBytes(verifierSalt); // blocksize\r
- r.nextBytes(verifier); // blocksize\r
- r.nextBytes(keySalt); // blocksize\r
- r.nextBytes(keySpec); // keysize\r
- r.nextBytes(integritySalt); // hashsize\r
+ byte[] newVerifierSalt = new byte[blockSize]\r
+ , newVerifier = new byte[blockSize]\r
+ , newKeySalt = new byte[blockSize]\r
+ , newKeySpec = new byte[keySize]\r
+ , newIntegritySalt = new byte[hashSize];\r
+ r.nextBytes(newVerifierSalt); // blocksize\r
+ r.nextBytes(newVerifier); // blocksize\r
+ r.nextBytes(newKeySalt); // blocksize\r
+ r.nextBytes(newKeySpec); // keysize\r
+ r.nextBytes(newIntegritySalt); // hashsize\r
\r
- confirmPassword(password, keySpec, keySalt, verifierSalt, verifier, integritySalt);\r
+ confirmPassword(password, newKeySpec, newKeySalt, newVerifierSalt, newVerifier, newIntegritySalt);\r
}\r
\r
public void confirmPassword(String password, byte keySpec[], byte keySalt[], byte verifier[], byte verifierSalt[], byte integritySalt[]) {\r
* 0xa0, 0x67, 0x7f, 0x02, 0xb2, 0x2c, 0x84, and 0x33.\r
* 7. Assign the encryptedHmacValue attribute to the base64-encoded form of the result of step 6. \r
*/\r
- this.integritySalt = integritySalt;\r
+ this.integritySalt = integritySalt.clone();\r
\r
try {\r
byte vec[] = CryptoFunctions.generateIv(hashAlgo, header.getKeySalt(), kIntegrityKeyBlock, header.getBlockSize());\r
Cipher cipher = getCipher(secretKey, ver.getCipherAlgorithm(), ver.getChainingMode(), vec, Cipher.ENCRYPT_MODE);\r
- byte filledSalt[] = getBlock0(integritySalt, getNextBlockSize(integritySalt.length, blockSize));\r
+ byte filledSalt[] = getBlock0(this.integritySalt, getNextBlockSize(this.integritySalt.length, blockSize));\r
byte encryptedHmacKey[] = cipher.doFinal(filledSalt);\r
header.setEncryptedHmacKey(encryptedHmacKey);\r
\r
* Builds a Picture object for a Picture stored in the
* DataStream
*/
- public Picture( int dataBlockStartOfsset, byte[] _dataStream,
- boolean fillBytes )
- {
+ public Picture( int dataBlockStartOfsset, byte[] _dataStream, boolean fillBytes ) { // NOSONAR
_picfAndOfficeArtData = new PICFAndOfficeArtData( _dataStream,
dataBlockStartOfsset );
_picf = _picfAndOfficeArtData.getPicf();
*/
public void writeImageContent( OutputStream out ) throws IOException
{
- byte[] content = getContent();
- if ( content != null && content.length > 0 )
+ byte[] c = getContent();
+ if ( c != null && c.length > 0 )
{
- out.write( content, 0, content.length );
+ out.write( c, 0, c.length );
}
}