// // overrides // #region BeginObject(string name) /// <summary> /// Overrides the default implementation to push state of encryption data onto a stack before returning the base implementations object /// </summary> /// <param name="name"></param> /// <returns></returns> public override PDFObjectRef BeginObject(string name) { PDFObjectRef oref = base.BeginObject(name); PDFObjectEncryptionStream enc = new PDFObjectEncryptionStream(oref); _encrypters.Push(enc); return(oref); }
/// <summary> /// Overrides the base implementation to write strings that are encrypted if they are not a part of an object stream /// </summary> /// <param name="value"></param> /// <param name="encoding"></param> public override void WriteStringLiteral(string value, Scryber.FontEncoding encoding) { PDFObjectEncryptionStream encrypting = this.AssertEncrypterStream; if (encrypting.InsideStream == false) { //If we are not in an object stream, then we want to encrypt the text if (encrypting.HasEncrypter == false) { encrypting.Encrypter = this.CreateEncryptionFilter(encrypting.ObjectRef); } byte[] all = GetStringBytes(value, encoding); all = encrypting.Encrypter.FilterStream(all); this.WriteStringHex(all); } else { //We are in an object stream so don't do any encryption now - wait until we close the indirect object base.WriteStringLiteral(value, encoding); } }