md.update( time.toByteArray() );
md.update( ownerPassword.getBytes() );
md.update( userPassword.getBytes() );
md.update( document.getDocument().toString().getBytes() );
byte[] id = md.digest( this.toString().getBytes() );
COSString idString = new COSString();
idString.append( id );
idArray.add( idString );
idArray.add( idString );
document.getDocument().setDocumentID( idArray );
}
catch( NoSuchAlgorithmException e )
{
throw new CryptographyException( e );
}
catch(IOException e )
{
throw new CryptographyException( e );
}
}
COSString id = (COSString)idArray.getObject( 0 );
byte[] o = computeOwnerPassword(
ownerPassword.getBytes("ISO-8859-1"),
userPassword.getBytes("ISO-8859-1"), revision, length);
byte[] u = computeUserPassword(
userPassword.getBytes("ISO-8859-1"),
o, permissionInt, id.getBytes(), revision, length);
encryptionKey = computeEncryptedKey(
userPassword.getBytes("ISO-8859-1"), o, permissionInt, id.getBytes(), revision, length);
encryptionDictionary.setOwnerKey(o);
encryptionDictionary.setUserKey(u);
document.setEncryptionDictionary( encryptionDictionary );