The TYPE_UNKNOWN
is an initial type value
The min value equivalent to zero. If absolute value less then ZERO it considered as zero.
The values of transformation matrix
The transformation type
Multiply matrix of two AffineTransform objects
@param t1 - the AffineTransform object is a multiplicand
@param t2 - the AffineTransform object is a multiplier
@return an AffineTransform object that is a result of t1 multiplied by matrix t2.
Gets the name of the resultant PDF file.
This name will be passed to makePdf
, assertPdf
and comparePdf
methods.
@return
Gets the name of the compare PDF file.
This name will be passed to comparePdf
method.
@return
An Anchor can be a reference or a destination of a reference.
An Anchor is a special kind of .
It is constructed in the same way.
A Phrase is a series of Chunks.
A Phrase has a main Font, but some chunks
within the phrase can have a Font that differs from the
main Font. All the Chunks in a Phrase
have the same leading.
// When no parameters are passed, the default leading = 16
Phrase phrase0 = new Phrase();
Phrase phrase1 = new Phrase("this is a phrase");
// In this example the leading is passed as a parameter
Phrase phrase2 = new Phrase(16, "this is a phrase with leading 16");
// When a Font is passed (explicitely or embedded in a chunk), the default leading = 1.5 * size of the font
Phrase phrase3 = new Phrase("this is a phrase with a red, normal font Courier, size 12", FontFactory.GetFont(FontFactory.COURIER, 12, Font.NORMAL, new Color(255, 0, 0)));
Phrase phrase4 = new Phrase(new Chunk("this is a phrase"));
Phrase phrase5 = new Phrase(18, new Chunk("this is a phrase", FontFactory.GetFont(FontFactory.HELVETICA, 16, Font.BOLD, new Color(255, 0, 0)));
Interface for a text element to which other objects can be added.
Interface for a text element.
Processes the element by adding it (or the different parts) to an
IElementListener.
an IElementListener
true if the element was processed successfully
Checks if this element is a content object.
If not, it's a metadata object.
@since iText 2.0.8
@return true if this is a 'content' element; false if this is a 'medadata' element
Checks if this element is nestable.
@since iText 2.0.8
@return true if this element can be nested inside other elements.
Gets the content of the text element.
the content of the text element
Gets the type of the text element.
a type
Gets all the chunks in this element.
an ArrayList
Adds an object to the TextElementArray.
an object that has to be added
true if the addition succeeded; false otherwise
This is the leading of this phrase.
The text leading that is multiplied by the biggest font size in the line.
This is the font of this phrase.
Null, unless the Phrase has to be hyphenated.
@since 2.1.2
Predefined tab position and properties(alignment, leader and etc.);
@since 5.4.1
Constructs a Phrase without specifying a leading.
Has nine overloads.
Copy constructor for Phrase
.
Constructs a Phrase with a certain leading.
the leading
Constructs a Phrase with a certain Chunk.
a Chunk
Constructs a Phrase with a certain Chunk and a certain leading.
the leading
a Chunk
Constructs a Phrase with a certain string.
a string
Constructs a Phrase with a certain string and a certain Font.
a string
a Font
Constructs a Phrase with a certain leading and a certain string.
the leading
a string
Processes the element by adding it (or the different parts) to an
.
an IElementListener
true if the element was processed successfully
@see com.lowagie.text.Element#isContent()
@since iText 2.0.8
@see com.lowagie.text.Element#isNestable()
@since iText 2.0.8
Adds a Chunk, an Anchor or another Phrase
to this Phrase.
index at which the specified element is to be inserted
an object of type Chunk, Anchor, or Phrase
Adds a String
to this Phrase
.
@param s a string
@return a boolean
@since 5.0.1
Adds a Chunk, Anchor or another Phrase
to this Phrase.
an object of type Chunk, Anchor or Phrase
a bool
Adds a collection of Chunks
to this Phrase.
a collection of Chunks, Anchors and Phrases.
true if the action succeeded, false if not.
Adds a Chunk.
This method is a hack to solve a problem I had with phrases that were split between chunks
in the wrong place.
a Chunk
a bool
Adds a Object to the Paragraph.
the object to add.
Checks is this Phrase contains no or 1 empty Chunk.
false if the Phrase
contains more than one or more non-emptyChunks.
Constructs a Phrase that can be used in the static GetInstance() method.
@param dummy a dummy parameter
Gets a special kind of Phrase that changes some characters into corresponding symbols.
@param string
@return a newly constructed Phrase
Gets a special kind of Phrase that changes some characters into corresponding symbols.
@param leading
@param string
@return a newly constructed Phrase
Gets a special kind of Phrase that changes some characters into corresponding symbols.
@param leading
@param string
@param font
@return a newly constructed Phrase
Gets the type of the text element.
a type
Gets all the chunks in this element.
an ArrayList
Gets/sets the leading of this phrase.
the linespacing
Gets the total leading.
This method is based on the assumption that the
font of the Paragraph is the font of all the elements
that make part of the paragraph. This isn't necessarily
true.
@return the total leading (fixed and multiplied)
Gets the font of the first Chunk that appears in this Phrase.
a Font
Returns the content as a String object.
This method differs from toString because toString will return an ArrayList with the toString value of the Chunks in this Phrase.
Setter/getter for the hyphenation.
@param hyphenation a HyphenationEvent instance
@since 2.1.2
Setter/getter for the tabSettings.
@param tabSettings a TabSettings instance
@since 5.4.1
This is the name of the Anchor.
This is the reference of the Anchor.
Constructs an Anchor without specifying a leading.
Has nine overloads.
Constructs an Anchor with a certain leading.
the leading
Constructs an Anchor with a certain Chunk.
a Chunk
Constructs an Anchor with a certain string.
a string
Constructs an Anchor with a certain string
and a certain Font.
a string
a Font
Constructs an Anchor with a certain Chunk
and a certain leading.
the leading
a Chunk
Constructs an Anchor with a certain leading
and a certain string.
the leading
a string
Constructs an Anchor with a certain leading,
a certain string and a certain Font.
the leading
a string
a Font
Constructs an Anchor
with a certain Phrase
.
@param phrase a Phrase
Processes the element by adding it (or the different parts) to an
an IElementListener
true if the element was processed successfully
Applies the properties of the Anchor to a Chunk.
@param chunk the Chunk (part of the Anchor)
@param notGotoOK if true, this chunk will determine the local destination
@param localDestination true if the chunk is a local goto and the reference a local destination
@return the value of notGotoOK or false, if a previous Chunk was used to determine the local destination
Gets all the chunks in this element.
an ArrayList
Gets the type of the text element.
a type
Name of this Anchor.
reference of this Anchor.
reference of this Anchor.
an Uri
An Annotation is a little note that can be added to a page
on a document.
This is a possible annotation type.
This is a possible annotation type.
This is a possible annotation type.
This is a possible annotation type.
This is a possible annotation type.
This is a possible annotation type.
This is a possible annotation type.
This is a possible annotation type.
This is a possible attribute.
This is a possible attribute.
This is a possible attribute.
This is a possible attribute.
This is a possible attribute.
This is a possible attribute.
This is a possible attribute.
This is a possible attribute.
This is a possible attribute.
This is a possible attribute.
This is a possible attribute.
This is a possible attribute.
This is a possible attribute.
This is a possible attribute.
This is a possible attribute.
This is a possible attribute.
This is the type of annotation.
This is the title of the Annotation.
This is the lower left x-value
This is the lower left y-value
This is the upper right x-value
This is the upper right y-value
Constructs an Annotation with a certain title and some text.
the lower left x-value
the lower left y-value
the upper right x-value
the upper right y-value
Constructs an Annotation with a certain title and some text.
the title of the annotation
the content of the annotation
Constructs an Annotation with a certain title and some text.
the title of the annotation
the content of the annotation
the lower left x-value
the lower left y-value
the upper right x-value
the upper right y-value
Constructs an Annotation.
the lower left x-value
the lower left y-value
the upper right x-value
the upper right y-value
the external reference
Constructs an Annotation.
the lower left x-value
the lower left y-value
the upper right x-value
the upper right y-value
the external reference
Constructs an Annotation.
the lower left x-value
the lower left y-value
the upper right x-value
the upper right y-value
an external PDF file
the destination in this file
Creates a Screen anotation to embed media clips
the lower left x-value
the lower left y-value
the upper right x-value
the upper right y-value
path to the media clip file
mime type of the media
if true play on display of the page
Constructs an Annotation.
the lower left x-value
the lower left y-value
the upper right x-value
the upper right y-value
an external PDF file
a page number in this file
Constructs an Annotation.
the lower left x-value
the lower left y-value
the upper right x-value
the upper right y-value
a named destination in this file
Has nine overloads.
Constructs an Annotation.
the lower left x-value
the lower left y-value
the upper right x-value
the upper right y-value
an external application
parameters to pass to this application
the operation to pass to this application
the default directory to run this application in
Processes the element by adding it (or the different parts) to an
IElementListener.
an IElementListener
true if the element was process successfully
Sets the dimensions of this annotation.
the lower left x-value
the lower left y-value
the upper right x-value
the upper right y-value
Returns the lower left x-value.
a value
Returns the lower left y-value.
a value
Returns the uppper right x-value.
a value
Returns the uppper right y-value.
a value
Returns the lower left x-value.
the default value
a value
Returns the lower left y-value.
the default value
a value
Returns the upper right x-value.
the default value
a value
Returns the upper right y-value.
the default value
a value
@see com.lowagie.text.Element#isContent()
@since iText 2.0.8
@see com.lowagie.text.Element#isNestable()
@since iText 2.0.8
Gets the type of the text element
Gets all the chunks in this element.
an ArrayList
Returns the type of this Annotation.
a type
Returns the title of this Annotation.
a name
Gets the content of this Annotation.
a reference
Gets the content of this Annotation.
a reference
Signals an attempt to create an Element that hasn't got the right form.
Signals that an error has occurred in a Document.
Constructs a new DocumentException
Has two overloads.
Construct a new DocumentException
error message
Constructs a DocumentException with a message and a Exception.
a message describing the exception
an exception that has to be turned into a DocumentException
Base class for Color, serves as wrapper class for
to allow extension.
Construct a new BaseColor.
@param red the value for the red gamma
@param green the value for the green gamma
@param blue the value for the blue gamma
@param alpha the value for the alpha gamma
@param red
@param green
@param blue
Construct a BaseColor with float values.
@param red
@param green
@param blue
@param alpha
Construct a BaseColor with float values.
@param red
@param green
@param blue
Construct a BaseColor by setting the combined value.
@param argb
Construct a BaseColor by System.Drawing.Color.
@param color
Make this BaseColor brighter. Factor used is 0.7.
@return the new BaseColor
Make this color darker. Factor used is 0.7
@return the new BaseColor
@return the combined color value
@return the value for red
@return the value for green
@return the value for blue
@return the value for the alpha channel
A Chapter is a special Section.
A chapter number has to be created using a Paragraph as title
and an int as chapter number. The chapter number is shown be
default. If you don't want to see the chapter number, you have to set the
numberdepth to 0.
Paragraph title2 = new Paragraph("This is Chapter 2", FontFactory.GetFont(FontFactory.HELVETICA, 18, Font.BOLDITALIC, new BaseColor(0, 0, 255)));
Chapter chapter2 = new Chapter(title2, 2);
chapter2.SetNumberDepth(0);
Paragraph someText = new Paragraph("This is some text");
chapter2.Add(someText);
Paragraph title21 = new Paragraph("This is Section 1 in Chapter 2", FontFactory.GetFont(FontFactory.HELVETICA, 16, Font.BOLD, new BaseColor(255, 0, 0)));
Section section1 = chapter2.AddSection(title21);
Paragraph someSectionText = new Paragraph("This is some silly paragraph in a chapter and/or section. It contains some text to test the functionality of Chapters and Section.");
section1.Add(someSectionText);
A Section is a part of a Document containing
other Sections, Paragraphs, List
and/or Tables.
You can not construct a Section yourself.
You will have to ask an instance of Section to the
Chapter or Section to which you want to
add the new Section.
Paragraph title2 = new Paragraph("This is Chapter 2", FontFactory.GetFont(FontFactory.HELVETICA, 18, Font.BOLDITALIC, new Color(0, 0, 255)));
Chapter chapter2 = new Chapter(title2, 2);
Paragraph someText = new Paragraph("This is some text");
chapter2.Add(someText);
Paragraph title21 = new Paragraph("This is Section 1 in Chapter 2", FontFactory.GetFont(FontFactory.HELVETICA, 16, Font.BOLD, new Color(255, 0, 0)));
Section section1 = chapter2.AddSection(title21);
Paragraph someSectionText = new Paragraph("This is some silly paragraph in a chapter and/or section. It contains some text to test the functionality of Chapters and Section.");
section1.Add(someSectionText);
Paragraph title211 = new Paragraph("This is SubSection 1 in Section 1 in Chapter 2", FontFactory.GetFont(FontFactory.HELVETICA, 14, Font.BOLD, new Color(255, 0, 0)));
Section section11 = section1.AddSection(40, title211, 2);
section11.Add(someSectionText);strong>
Interface implemented by Element objects that can potentially consume
a lot of memory. Objects implementing the LargeElement interface can
be added to a Document more than once. If you have invoked setCompleted(false),
they will be added partially and the content that was added will be
removed until you've invoked setCompleted(true);
@since iText 2.0.8
Flushes the content that has been added.
If you invoke setCompleted(false), you indicate that the content
of the object isn't complete yet; it can be added to the document
partially, but more will follow. If you invoke setCompleted(true),
you indicate that you won't add any more data to the object.
@since iText 2.0.8
@param complete false if you'll be adding more data after
adding the object to the document.
Objects implementing Indentable allow to set indentation left and right.
Sets the indentation on the left side.
@param indentation the new indentation
Sets the indentation on the right side.
@param indentation the new indentation
Get the attribute of accessible element (everything in A
dictionary + Lang
, Alt
, ActualText
, E
).
@param key
@return
Set the attribute of accessible element (everything in A
dictionary + Lang
, Alt
, ActualText
, E
).
@param key
@param value
Gets all the properties of accessible element.
@return
Role propherty of the accessible element.
Note that all child elements won't also be tagged.
@return
A possible number style. The default number style: "1.2.3."
@since iText 2.0.8
A possible number style. For instance: "1.2.3"
@since iText 2.0.8
This is the title of this section.
This is the number of sectionnumbers that has to be shown before the section title.
The style for sectionnumbers.
@since iText 2.0.8
The indentation of this section on the left side.
The indentation of this section on the right side.
The additional indentation of the content of this section.
This is the number of subsections.
This is the complete list of sectionnumbers of this section and the parents of this section.
Indicates if the Section will be complete once added to the document.
@since iText 2.0.8
Indicates if the Section was added completely to the document.
@since iText 2.0.8
Indicates if this is the first time the section was added.
@since iText 2.0.8
false if the bookmark children are not visible
true if the section has to trigger a new page
The bookmark title if different from the content title
Constructs a new Section.
Has 2 overloads.
Constructs a new Section.
a Paragraph
the numberDepth
Sets the number of this section.
the number of this section
an ArrayList, containing the numbers of the Parent
Processes the element by adding it (or the different parts) to an
IElementListener.
the IElementListener
true if the element was processed successfully
@see com.lowagie.text.Element#isContent()
@since iText 2.0.8
@see com.lowagie.text.Element#isNestable()
@since iText 2.0.8
Adds a Paragraph, List or Table
to this Section.
index at which the specified element is to be inserted
an object of type Paragraph, List or Table
Adds a Paragraph, List, Table or another Section
to this Section.
an object of type Paragraph, List, Table or another Section
a bool
Adds a collection of Elements
to this Section.
a collection of Paragraphs, Lists and/or Tables
true if the action succeeded, false if not.
Creates a Section, adds it to this Section and returns it.
the indentation of the new section
the title of the new section
the numberDepth of the section
the newly added Section
Creates a Section, adds it to this Section and returns it.
the indentation of the new section
the title of the new section
the newly added Section
Creates a Section, add it to this Section and returns it.
the title of the new section
the numberDepth of the section
the newly added Section
Adds a marked section. For use in class MarkedSection only!
Creates a Section, adds it to this Section and returns it.
the title of the new section
the newly added Section
Adds a Section to this Section and returns it.
@param indentation the indentation of the new section
@param title the title of the new section
@param numberDepth the numberDepth of the section
Adds a Section to this Section and returns it.
the indentation of the new section
the title of the new section
the numberDepth of the section
the newly added Section
Adds a Section to this Section and returns it.
@param title the title of the new section
@param numberDepth the numberDepth of the section
Adds a Section to this Section and returns it.
the title of the new section
the numberDepth of the section
the newly added Section
Adds a Section to this Section and returns it.
the indentation of the new section
the title of the new section
the newly added Section
Adds a Section to this Section and returns it.
the title of the new section
the newly added Section
Constructs a Paragraph that will be used as title for a Section or Chapter.
@param title the title of the section
@param numbers a list of sectionnumbers
@param numberDepth how many numbers have to be shown
@param numberStyle the numbering style
@return a Paragraph object
@since iText 2.0.8
Checks if this object is a Chapter.
true if it is a Chapter,
false if it is a Section
Checks if this object is a Section.
true if it is a Section,
false if it is a Chapter.
Gets the bookmark title.
@return the bookmark title
Changes the Chapter number.
@since iText 2.0.8
@see com.lowagie.text.LargeElement#flushContent()
Adds a new page to the section.
@since 2.1.1
Gets the type of the text element.
a type
Gets all the chunks in this element.
an ArrayList
Get/set the title of this section
a Paragraph
Sets the style for numbering sections.
Possible values are NUMBERSTYLE_DOTTED: 1.2.3. (the default)
or NUMBERSTYLE_DOTTED_WITHOUT_FINAL_DOT: 1.2.3
@since iText 2.0.8
Get/set the numberdepth of this Section.
a int
Get/set the indentation of this Section on the left side.
the indentation
Get/set the indentation of this Section on the right side.
the indentation
Get/set the indentation of the content of this Section.
the indentation
Returns the depth of this section.
the depth
Get/set the bookmark
a bool
Sets the bookmark title. The bookmark title is the same as the section title but
can be changed with this method.
@param bookmarkTitle the bookmark title
Indicates if this is the first time the section is added.
@since iText2.0.8
@return true if the section wasn't added yet
@see com.lowagie.text.LargeElement#isAddedCompletely()
@since iText 2.0.8
@since iText 2.0.8
@see com.lowagie.text.LargeElement#isComplete()
Constructs a new Chapter
.
@param number the Chapter number
Constructs a new Chapter.
the Chapter title (as a Paragraph)
the Chapter number
Has three overloads.
Constructs a new Chapter.
the Chapter title (as a string)
the Chapter number
Has three overloads.
@see com.lowagie.text.Element#isNestable()
@since iText 2.0.8
Gets the type of the text element.
a type
Chapter with auto numbering.
@author Michael Niedermair
Is the chapter number already set?
@since 2.1.4
Create a new object.
@param para the Chapter title (as a Paragraph
)
Create a new objet.
@param title the Chapter title (as a String
)
Create a new section for this chapter and ad it.
@param title the Section title (as a String
)
@return Returns the new section.
Create a new section for this chapter and add it.
@param title the Section title (as a Paragraph
)
@return Returns the new section.
Changes the Chapter number.
@param number the new chapter number
@since 2.1.4
This is the smallest significant part of text that can be added to a document.
Most elements can be divided in one or more Chunks.
A chunk is a string with a certain Font.
all other layoutparameters should be defined in the object to which
this chunk of text is added.
Chunk chunk = new Chunk("Hello world", FontFactory.GetFont(FontFactory.COURIER, 20, Font.ITALIC, new BaseColor(255, 0, 0)));
document.Add(chunk);
The character stand in for an image or a separator.
Key for drawInterface of the Separator.
@since 2.1.2
Key for drawInterface of the tab.
@since 2.1.2
Key for tab stops of the tab.
@since 5.4.1
Key for text horizontal scaling.
Key for underline.
Key for sub/basescript.
Key for text skewing.
Key for background.
Key for text rendering mode.
Key for split character.
Key for hyphenation.
Key for remote goto.
Key for local goto.
Key for local destination.
Key for generic tag.
Key for line-height (alternative for leading in Phrase).
Key for image.
Key for Action.
Key for newpage.
Key for annotation.
Key for color.
Key for encoding.
Key for character spacing.
Key for word spacing.
This is a Chunk containing a newline.
This is a Chunk containing a newpage.
This is the content of this chunk of text.
This is the Font of this chunk of text.
Contains some of the attributes for this Chunk.
Empty constructor.
Has six overloads.
A Chunk
copy constructor.
@param ck the Chunk
to be copied
Constructs a chunk of text with a certain content and a certain Font.
the content
the font
Constructs a chunk of text with a certain content, without specifying a Font.
the content
Constructs a chunk of text with a char and a certain Font
.
@param c the content
@param font the font
Constructs a chunk of text with a char, without specifying a Font
.
@param c the content
Constructs a chunk containing an Image.
the image
the image offset in the x direction
the image offset in the y direction
Creates a separator Chunk.
Note that separator chunks can't be used in combination with tab chunks!
@param separator the drawInterface to use to draw the separator.
@since 2.1.2
Creates a separator Chunk.
Note that separator chunks can't be used in combination with tab chunks!
@param separator the drawInterface to use to draw the separator.
@param vertical true if this is a vertical separator
@since 2.1.2
Creates a tab Chunk.
Note that separator chunks can't be used in combination with tab chunks!
@param separator the drawInterface to use to draw the tab.
@param tabPosition an X coordinate that will be used as start position for the next Chunk.
@since 2.1.2
Creates a tab Chunk.
Note that separator chunks can't be used in combination with tab chunks!
@param separator the drawInterface to use to draw the tab.
@param tabPosition an X coordinate that will be used as start position for the next Chunk.
@param newline if true, a newline will be added if the tabPosition has already been reached.
@since 2.1.2
Creates a tab Chunk.
@param tabInterval an interval that will be used if tab stops are omitted.
@param isWhitespace if true, the current tab is treated as white space.
@since 5.4.1
Constructs a chunk containing an Image.
the image
the image offset in the x direction
the image offset in the y direction
true if the leading has to be adapted to the image
Processes the element by adding it (or the different parts) to an
IElementListener.
an IElementListener
true if the element was processed successfully
appends some text to this Chunk.
a string
a StringBuilder
Checks is this Chunk is empty.
false if the Chunk contains other characters than space.
Gets the width of the Chunk in points.
@return a width in points
Checks the attributes of this Chunk.
false if there aren't any.
Checks the accessible attributes of this Chunk
.
@return false if there aren't any.
Sets an arbitrary attribute.
the key for the attribute
the value of the attribute
this Chunk
Sets the text horizontal scaling. A value of 1 is normal and a value of 0.5f
shrinks the text to half it's width.
@param scale the horizontal scaling factor
@return this Chunk
Sets an horizontal line that can be an underline or a strikethrough.
Actually, the line can be anywhere vertically and has always the
Chunk
width. Multiple call to this method will
produce multiple lines.
@param thickness the absolute thickness of the line
@param yPosition the absolute y position relative to the baseline
@return this Chunk
Sets an horizontal line that can be an underline or a strikethrough.
Actually, the line can be anywhere vertically and has always the
Chunk
width. Multiple call to this method will
produce multiple lines.
@param color the color of the line or null
to follow
the text color
@param thickness the absolute thickness of the line
@param thicknessMul the thickness multiplication factor with the font size
@param yPosition the absolute y position relative to the baseline
@param yPositionMul the position multiplication factor with the font size
@param cap the end line cap. Allowed values are
PdfContentByte.LINE_CAP_BUTT, PdfContentByte.LINE_CAP_ROUND and
PdfContentByte.LINE_CAP_PROJECTING_SQUARE
@return this Chunk
Sets the text displacement relative to the baseline. Positive values rise the text,
negative values lower the text.
It can be used to implement sub/basescript.
the displacement in points
this Chunk
Skews the text to simulate italic and other effects.
Try alpha=0
and beta=12
.
@param alpha the first angle in degrees
@param beta the second angle in degrees
@return this Chunk
Sets the color of the background Chunk.
the color of the background
this Chunk
Sets the color and the size of the background Chunk
.
@param color the color of the background
@param extraLeft increase the size of the rectangle in the left
@param extraBottom increase the size of the rectangle in the bottom
@param extraRight increase the size of the rectangle in the right
@param extraTop increase the size of the rectangle in the top
@return this Chunk
Sets the text rendering mode. It can outline text, simulate bold and make
text invisible.
@param mode the text rendering mode. It can be PdfContentByte.TEXT_RENDER_MODE_FILL
,
PdfContentByte.TEXT_RENDER_MODE_STROKE
, PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE
and PdfContentByte.TEXT_RENDER_MODE_INVISIBLE
.
@param strokeWidth the stroke line width for the modes PdfContentByte.TEXT_RENDER_MODE_STROKE
and
PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE
.
@param strokeColor the stroke color or null
to follow the text color
@return this Chunk
Sets the split characters.
the SplitCharacter interface
this Chunk
sets the hyphenation engine to this Chunk.
the hyphenation engine
this Chunk
Sets a goto for a remote destination for this Chunk.
the file name of the destination document
the name of the destination to go to
this Chunk
Sets a goto for a remote destination for this Chunk.
the file name of the destination document
the page of the destination to go to. First page is 1
this Chunk
Sets a local goto for this Chunk.
There must be a local destination matching the name.
the name of the destination to go to
this Chunk
Sets a local destination for this Chunk.
the name for this destination
this Chunk
Sets the generic tag Chunk.
The text for this tag can be retrieved with PdfPageEvent.
the text for the tag
this Chunk
Sets a line height tag.
@return this Chunk
Returns the image.
an Image
Sets an action for this Chunk.
the action
this Chunk
Sets an anchor for this Chunk.
the Uri to link to
this Chunk
Sets an anchor for this Chunk.
the url to link to
this Chunk
Sets a new page tag.
this Chunk
Sets a generic annotation to this Chunk.
the annotation
this Chunk
@see com.lowagie.text.Element#isContent()
@since iText 2.0.8
@see com.lowagie.text.Element#isNestable()
@since iText 2.0.8
Returns the hyphenation (if present).
@param hyphenation a HyphenationEvent instance
@since 2.1.2
Sets the character spacing.
@param charSpace the character spacing value
@return this Chunk
Gets the character spacing.
@return a value in float
Sets the word spacing.
@param wordSpace the word spacing value
@return this Chunk
Gets the word spacing.
@return a value in float
Sets the textual expansion of the abbreviation or acronym.
It is highly recommend to set textuual expansion when generating PDF/UA documents.
@param value
Gets the type of the text element.
a type
Gets all the chunks in this element.
an ArrayList
Get/set the font of this Chunk.
a Font
Returns the content of this Chunk.
a string
Sets/Gets the attributes for this Chunk.
It may be null.
a Hashtable
Gets the horizontal scaling.
@return a percentage in float
A generic Document class.
All kinds of Text-elements can be added to a HTMLDocument.
The Document signals all the listeners when an element
has been added.
Once a document is created you can add some meta information.
You can also set the headers/footers.
You have to open the document before you can write content.
You can only write content (no more meta-formation!) once a document is opened.
When you change the header/footer on a certain page, this will be effective starting on the next page.
Ater closing the document, every listener (as well as its OutputStream) is closed too.
// creation of the document with a certain size and certain margins
Document document = new Document(PageSize.A4, 50, 50, 50, 50);
try {
// creation of the different writers
HtmlWriter.GetInstance(document, System.out);
PdfWriter.GetInstance(document, new FileOutputStream("text.pdf"));
// we add some meta information to the document
document.AddAuthor("Bruno Lowagie");
document.AddSubject("This is the result of a Test.");
// we define a header and a footer
HeaderFooter header = new HeaderFooter(new Phrase("This is a header."), false);
HeaderFooter footer = new HeaderFooter(new Phrase("This is page "), new Phrase("."));
footer.SetAlignment(Element.ALIGN_CENTER);
document.SetHeader(header);
document.SetFooter(footer);
// we open the document for writing
document.Open();
document.Add(new Paragraph("Hello world"));
}
catch (DocumentException de) {
Console.Error.WriteLine(de.Message);
}
document.Close();
A class that implements DocListener will perform some
actions when some actions are performed on a Document.
A class that implements ElementListener will perform some
actions when an Element is added.
Signals that an Element was added to the Document.
Element added
true if the element was added, false if not.
Signals that the Document has been opened and that
Elements can be added.
Signals that the Document was closed and that no other
Elements will be added.
The output stream of every writer implementing IDocListener will be closed.
Signals that an new page has to be started.
true if the page was added, false if not.
Sets the pagesize.
the new pagesize
a boolean
Sets the margins.
the margin on the left
the margin on the right
the margin on the top
the margin on the bottom
Parameter that allows you to do margin mirroring (odd/even pages)
@param marginMirroring
@return true if succesfull
Parameter that allows you to do top/bottom margin mirroring (odd/even pages)
@param marginMirroringTopBottom
@return true if successful
@since 2.1.6
Sets the page number to 0.
Sets the page number.
the new page number
Allows the pdf documents to be produced without compression for debugging purposes.
Scales the WMF font size. The default value is 0.86.
The IDocListener.
Is the document open or not?
Has the document already been closed?
The size of the page.
margin in x direction starting from the left
margin in x direction starting from the right
margin in y direction starting from the top
margin in y direction starting from the bottom
mirroring of the top/bottom margins
@since 2.1.6
Content of JavaScript onLoad function
Content of JavaScript onUnLoad function
Style class in HTML body tag
Current pagenumber
This is a chapter number in case ChapterAutoNumber is used.
Constructs a new Document-object.
Has three overloads.
Constructs a new Document-object.
the pageSize
Constructs a new Document-object.
the pageSize
the margin on the left
the margin on the right
the margin on the top
the margin on the bottom
Adds a IDocListener to the Document.
the new IDocListener
Removes a IDocListener from the Document.
the IDocListener that has to be removed.
Adds an Element to the Document.
the Element to add
true if the element was added, false if not
Opens the document.
Once the document is opened, you can't write any Header- or Meta-information
anymore. You have to open the document before you can begin to add content
to the body of the document.
Opens the document.
Version for languages that are not case-dependant.
Once the document is opened, you can't write any Header- or Meta-information
anymore. You have to open the document before you can begin to add content
to the body of the document.
Sets the pagesize.
the new pagesize
a bool
Sets the margins.
the margin on the left
the margin on the right
the margin on the top
the margin on the bottom
Signals that an new page has to be started.
true if the page was added, false if not.
Sets the page number to 0.
Closes the document.
Once all the content has been written in the body, you have to close
the body. After that nothing can be written to the body anymore.
Closes the document.
Version for languages that are not case-dependant.
Once all the content has been written in the body, you have to close
the body. After that nothing can be written to the body anymore.
Adds a user defined header to the document.
the name of the header
the content of the header
true if successful, false otherwise
Adds the title to a Document.
the title
true if successful, false otherwise
Adds the subject to a Document.
the subject
true if successful, false otherwise
Adds the keywords to a Document.
keywords to add
true if successful, false otherwise
Adds the author to a Document.
the name of the author
true if successful, false otherwise
Adds the creator to a Document.
the name of the creator
true if successful, false otherwise
Adds the producer to a Document.
true if successful, false otherwise
Adds a language to th document. Required for PDF/UA compatible documents.
@param language
@return true
if successfull, false
otherwise
Adds the current date and time to a Document.
true if successful, false otherwise
Returns the lower left x-coordinate considering a given margin.
a margin
the lower left x-coordinate
Returns the upper right x-coordinate, considering a given margin.
a margin
the upper right x-coordinate
Returns the upper right y-coordinate, considering a given margin.
a margin
the upper right y-coordinate
Returns the lower left y-coordinate, considering a given margin.
a margin
the lower left y-coordinate
Checks if the document is open.
true if the document is open
Gets the margin mirroring flag.
@return the margin mirroring flag
Sets the page number.
an int
Returns the current page number.
an int
Returns the left margin.
the left margin
Return the right margin.
the right margin
Returns the top margin.
the top margin
Returns the bottom margin.
the bottom margin
Returns the lower left x-coordinate.
the lower left x-coordinate
Returns the upper right x-coordinate.
the upper right x-coordinate.
Returns the upper right y-coordinate.
the upper right y-coordinate.
Returns the lower left y-coordinate.
the lower left y-coordinate.
Gets the pagesize.
the page size
Gets the JavaScript onLoad command.
the JavaScript onLoad command.
Gets the JavaScript onUnLoad command.
the JavaScript onUnLoad command
Gets the style class of the HTML body tag
the style class of the HTML body tag
An abstract Writer class for documents.
DocWriter is the abstract class of several writers such
as PdfWriter and HtmlWriter.
A DocWriter can be added as a DocListener
to a certain Document by getting an instance (see method
GetInstance() in the specific writer-classes).
Every Element added to the original Document
will be written to the stream of the listening
DocWriter.
This is some byte that is often used.
This is some byte that is often used.
This is some byte that is often used.
This is some byte that is often used.
This is some byte that is often used.
This is some byte that is often used.
This is some byte that is often used.
This is some byte that is often used.
The pageSize.
This is the document that has to be written.
The stream of this writer.
Is the writer open for writing?
Do we have to pause all writing actions?
Closes the stream on document close
Constructs a DocWriter.
The Document that has to be written
The Stream the writer has to write to.
Signals that an Element was added to the Document.
This method should be overriden in the specific DocWriter classes
derived from this abstract class.
false
Signals that the Document was opened.
Sets the pagesize.
the new pagesize
a boolean
Sets the margins.
This does nothing. Has to be overridden if needed.
the margin on the left
the margin on the right
the margin on the top
the margin on the bottom
Signals that an new page has to be started.
This does nothing. Has to be overridden if needed.
true if the page was added, false if not.
Sets the page number to 0.
This method should be overriden in the specific DocWriter classes
derived from this abstract class if they actually support the use of
pagenumbers.
Signals that the Document was closed and that no other
Elements will be added.
Converts a string into a Byte array
according to the ISO-8859-1 codepage.
the text to be converted
the conversion result
Let the writer know that all writing has to be paused.
Checks if writing is paused.
@return true
if writing temporarely has to be paused, false
otherwise.
Let the writer know that writing may be resumed.
Flushes the Stream.
Writes a string to the stream.
the string to write
Writes a number of tabs.
the number of tabs to add
Writes a key-value pair to the stream.
the name of an attribute
the value of an attribute
Writes a starttag to the stream.
the name of the tag
Writes an endtag to the stream.
the name of the tag
Writes an endtag to the stream.
Writes the markup attributes of the specified MarkupAttributes
object to the stream.
the MarkupAttributes to write.
@see com.lowagie.text.DocListener#setMarginMirroring(boolean)
@since 2.1.6
Sets the page number.
This method should be overriden in the specific DocWriter classes
derived from this abstract class if they actually support the use of
pagenumbers.
Interface for a text element.
This is a possible type of Element.
This is a possible type of Element.
This is a possible type of Element.
This is a possible type of Element.
This is a possible type of Element.
This is a possible type of Element.
This is a possible type of Element.
This is a possible type of Element.
This is a possible type of Element.
This is a possible type of Element.
This is a possible type of Element.
This is a possible type of Element.
This is a possible type of Element
This is a possible type of Element
This is a possible type of Element
This is a possible type of Element
This is a possible type of Element
This is a possible type of Element.
This is a possible type of Element.
This is a possible type of Element.
This is a possible type of Element.
This is a possible type of Element
.
This is a possible type of Element.
This is a possible type of Element.
This is a possible type of Element
.
@since 2.1.5
This is a possible type of Element
.
@since 5.3.0
This is a possible type of Element
.
This is a possible type of Element
.
@since 2.1.2
This is an element thats not an element.
@see WritableDirectElement
A possible value for paragraph Element. This
specifies that the text is aligned to the left
indent and extra whitespace should be placed on
the right.
A possible value for paragraph Element. This
specifies that the text is aligned to the left
indent and extra whitespace should be placed on
the right.
A possible value for paragraph Element. This
specifies that the text is aligned to the center
and extra whitespace should be placed equally on
the left and right.
A possible value for paragraph Element. This
specifies that the text is aligned to the right
indent and extra whitespace should be placed on
the left.
A possible value for paragraph Element. This
specifies that extra whitespace should be spread
out through the rows of the paragraph with the
text lined up with the left and right indent
except on the last line which should be aligned
to the left.
A possible value for vertical Element.
A possible value for vertical Element.
A possible value for vertical Element.
A possible value for vertical Element.
Does the same as ALIGN_JUSTIFIED but the last line is also spread out.
Pure two-dimensional encoding (Group 4)
Pure one-dimensional encoding (Group 3, 1-D)
Mixed one- and two-dimensional encoding (Group 3, 2-D)
A flag indicating whether 1-bits are to be interpreted as black pixels
and 0-bits as white pixels,
A flag indicating whether the filter expects extra 0-bits before each
encoded line so that the line begins on a byte boundary.
A flag indicating whether end-of-line bit patterns are required to be
present in the encoding.
A flag indicating whether the filter expects the encoded data to be
terminated by an end-of-block pattern, overriding the Rows
parameter. The use of this flag will set the key /EndOfBlock to false.
Localizes error messages. The messages are located in the package
com.lowagie.text.error_messages in the form language_country.lng.
The internal file encoding is UTF-8 without any escape chars, it's not a
normal property file. See en.lng for more information on the internal format.
@author Paulo Soares (psoares@glintt.com)
Get a message without parameters.
@param key the key to the message
@return the message
Get a message with parameters. The parameters will replace the strings
"{1}", "{2}", ..., "{n}" found in the message.
@param key the key to the message
@param p the variable parameter
@return the message
Sets the language to be used globally for the error messages. The language
is a two letter lowercase country designation like "en" or "pt". The country
is an optional two letter uppercase code like "US" or "PT".
@param language the language
@param country the country
@return true if the language was found, false otherwise
@throws IOException on error
Sets the error messages directly from a Reader.
@param r the Reader
@throws IOException on error
Typed exception used when opening an existing PDF document.
Gets thrown when the document isn't a valid PDF document.
@since 2.1.5 It was written for iText 2.0.8, but moved to another package
Creates an exception saying the user password was incorrect.
Typed exception used when creating PDF syntax that isn't valid.
@since 2.1.6
Creates an exception saying the PDF syntax isn't correct.
@param message some extra info about the exception
RuntimeException to indicate that the provided Image is invalid/corrupted.
Should only be thrown/not caught when ignoring invalid images.
@since 5.4.2
Typed exception used when opening an existing PDF document.
Gets thrown when the document isn't a valid PDF document.
@since 2.1.5
Creates an instance of with a message and no cause
@param message the reason why the document isn't a PDF document according to iText.
Creates an exception with a message and a cause
@param message the reason why the document isn't a PDF document according to iText.
@param cause the cause of the exception, if any
Typed exception used when opening an existing PDF document.
Gets thrown when the document isn't a valid PDF document according to iText,
but it's different from the InvalidPdfException in the sense that it may
be an iText limitation (most of the times it isn't but you might have
bumped into something that has been added to the PDF specs, but that isn't
supported in iText yet).
@since 2.1.5
Creates an instance of an UnsupportedPdfException.
@param message the reason why the document isn't a PDF document according to iText.
This class can produce String combinations representing a number built with
Greek letters (from alpha to omega, then alpha alpha, alpha beta, alpha gamma).
We are aware of the fact that the original Greek numbering is different;
See http://www.cogsci.indiana.edu/farg/harry/lan/grknum.htm#ancient
but this isn't implemented yet; the main reason being the fact that we
need a font that has the obsolete Greek characters qoppa and sampi.
Changes an int into a lower case Greek letter combination.
@param index the original number
@return the letter combination
Changes an int into a lower case Greek letter combination.
@param index the original number
@return the letter combination
Changes an int into a upper case Greek letter combination.
@param index the original number
@return the letter combination
Changes an int into a Greek letter combination.
@param index the original number
@return the letter combination
This class can produce String combinations representing a number.
"a" to "z" represent 1 to 26, "AA" represents 27, "AB" represents 28,
and so on; "ZZ" is followed by "AAA".
Translates a positive integer (not equal to zero)
into a String using the letters 'a' to 'z';
1 = a, 2 = b, ..., 26 = z, 27 = aa, 28 = ab,...
Translates a positive integer (not equal to zero)
into a String using the letters 'a' to 'z';
1 = a, 2 = b, ..., 26 = z, 27 = aa, 28 = ab,...
Translates a positive integer (not equal to zero)
into a String using the letters 'A' to 'Z';
1 = A, 2 = B, ..., 26 = Z, 27 = AA, 28 = AB,...
Translates a positive integer (not equal to zero)
into a String using the letters 'a' to 'z'
(a = 1, b = 2, ..., z = 26, aa = 27, ab = 28,...).
This class can produce String combinations representing a roman number.
Array with Roman digits.
Changes an int into a lower case roman number.
@param index the original number
@return the roman number (lower case)
Changes an int into a lower case roman number.
@param index the original number
@return the roman number (lower case)
Changes an int into an upper case roman number.
@param index the original number
@return the roman number (lower case)
Changes an int into a roman number.
@param index the original number
@return the roman number (lower case)
Helper class for Roman Digits
part of a roman number
value of the roman digit
can the digit be used as a prefix
Constructs a roman digit
@param digit the roman digit
@param value the value
@param pre can it be used as a prefix
Contains all the specifications of a font: fontfamily, size, style and color.
Paragraph p = new Paragraph("This is a paragraph",
new Font(Font.HELVETICA, 18, Font.BOLDITALIC, new BaseColor(0, 0, 255)));
this is a possible style.
this is a possible style.
this is a possible style.
this is a possible style.
this is a possible style.
this is a possible style.
the value of an undefined attribute.
the value of the default size.
the value of the fontfamily.
the value of the fontsize.
the value of the style.
the value of the color.
the external font
Copy constructor of a Font
@param other the font that has to be copied
Constructs a Font.
the family to which this font belongs
the size of this font
the style of this font
the BaseColor of this font.
Constructs a Font.
the external font
the size of this font
the style of this font
the BaseColor of this font.
Constructs a Font.
the external font
the size of this font
the style of this font
Constructs a Font.
the external font
the size of this font
Constructs a Font.
the external font
Constructs a Font.
the family to which this font belongs
the size of this font
the style of this font
Constructs a Font.
the family to which this font belongs
the size of this font
Constructs a Font.
the family to which this font belongs
Constructs a Font.
Has nine overloads.
Compares this Font with another
the other Font
a value
Sets the family using a String ("Courier",
"Helvetica", "Times New Roman", "Symbol" or "ZapfDingbats").
A String representing a certain font-family.
Translates a string-value of a certain family
into the index that is used for this family in this class.
A string representing a certain font-family
the corresponding index
Gets the leading that can be used with this font.
@param multipliedLeading
a certain multipliedLeading
@return the height of a line
checks if this font is Bold.
a boolean
checks if this font is Bold.
a boolean
checks if this font is underlined.
a boolean
checks if the style of this font is STRIKETHRU.
a boolean
Sets the style using a String containing one of
more of the following values: normal, bold, italic, underline, strike.
A String representing a certain style.
Sets the style.
@param style the style.
Translates a string-value of a certain style
into the index value is used for this style in this class.
a string
the corresponding value
Sets the color.
the red-value of the new color
the green-value of the new color
the blue-value of the new color
Gets the BaseFont
this class represents.
For the built-in fonts a BaseFont
is calculated.
@param specialEncoding true
to use the special encoding for Symbol and ZapfDingbats,
false
to always use Cp1252
@return the BaseFont
this class represents
Checks if the properties of this font are undefined or null.
If so, the standard should be used.
a boolean
Gets the family of this font.
the value of the family
Gets the familyname as a string.
the familyname
Get/set the size of this font.
the size of this font
Gets the size that can be used with the calculated BaseFont
.
@return the size that can be used with the calculated BaseFont
Gets the style of this font.
the style of this font
Gets the style that can be used with the calculated BaseFont
.
@return the style that can be used with the calculated BaseFont
Get/set the color of this font.
the color of this font
Gets the BaseFont inside this object.
the BaseFont
If you are using True Type fonts, you can declare the paths of the different ttf- and ttc-files
to this static class first and then create fonts in your code using one of the static getFont-method
without having to enter a path as parameter.
This is a possible value of a base 14 type 1 font
This is a possible value of a base 14 type 1 font
This is a possible value of a base 14 type 1 font
This is a possible value of a base 14 type 1 font
This is a possible value of a base 14 type 1 font
This is a possible value of a base 14 type 1 font
This is a possible value of a base 14 type 1 font
This is a possible value of a base 14 type 1 font
This is a possible value of a base 14 type 1 font
This is a possible value of a base 14 type 1 font
This is a possible value of a base 14 type 1 font
This is a possible value of a base 14 type 1 font
This is a possible value of a base 14 type 1 font
This is a possible value of a base 14 type 1 font
This is a possible value of a base 14 type 1 font
This is the default encoding to use.
This is the default value of the embedded variable.
Creates new FontFactory
Constructs a Font-object.
the name of the font
the encoding of the font
true if the font is to be embedded in the PDF
the size of this font
the style of this font
the BaseColor of this font
a Font object
Constructs a Font-object.
the name of the font
the encoding of the font
true if the font is to be embedded in the PDF
the size of this font
the style of this font
the BaseColor of this font
true if the font comes from the cache or is added to the cache if new, false if the font is always created new
a Font object
Constructs a Font-object.
the name of the font
the encoding of the font
true if the font is to be embedded in the PDF
the size of this font
the style of this font
a Font object
Constructs a Font-object.
the name of the font
the encoding of the font
true if the font is to be embedded in the PDF
the size of this font
Constructs a Font-object.
the name of the font
the encoding of the font
true if the font is to be embedded in the PDF
a Font object
Constructs a Font-object.
the name of the font
the encoding of the font
the size of this font
the style of this font
the BaseColor of this font
a Font object
Constructs a Font-object.
the name of the font
the encoding of the font
the size of this font
the style of this font
a Font object
Constructs a Font-object.
the name of the font
the encoding of the font
the size of this font
a Font object
Constructs a Font-object.
the name of the font
the encoding of the font
a Font object
Constructs a Font-object.
the name of the font
the size of this font
the style of this font
the BaseColor of this font
a Font object
Constructs a Font-object.
the name of the font
the size of this font
the BaseColor of this font
a Font object
Constructs a Font-object.
the name of the font
the size of this font
the style of this font
a Font object
Constructs a Font-object.
the name of the font
the size of this font
a Font object
Constructs a Font-object.
the name of the font
a Font object
Register a font by giving explicitly the font family and name.
@param familyName the font family
@param fullName the font name
@param path the font path
Register a ttf- or a ttc-file.
the path to a ttf- or ttc-file
Register a ttf- or a ttc-file and use an alias for the font contained in the ttf-file.
the path to a ttf- or ttc-file
the alias you want to use for the font
Register all the fonts in a directory.
@param dir the directory
@return the number of fonts registered
Register fonts in some probable directories. It usually works in Windows,
Linux and Solaris.
@return the number of fonts registered
Checks whether the given font is contained within the object
the name of the font
true if font is contained within the object
Checks if a certain font is registered.
the name of the font that has to be checked
true if the font is found
Gets a set of registered fontnames.
a set of registered fontnames
Gets a set of registered font families.
a set of registered font families
If you are using True Type fonts, you can declare the paths of the different ttf- and ttc-files
to this class first and then create fonts in your code using one of the getFont method
without having to enter a path as parameter.
These two methods are used by FactoryProperties (for HTMLWorker).
It's implemented by FontFactoryImp.
@since iText 5.0
Checks if a certain font is registered.
@param fontname the name of the font that has to be checked.
@return true if the font is found
Constructs a Font
-object.
@param fontname the name of the font
@param encoding the encoding of the font
@param embedded true if the font is to be embedded in the PDF
@param size the size of this font
@param style the style of this font
@param color the BaseColor
of this font.
@return the Font constructed based on the parameters
This is a map of postscriptfontnames of True Type fonts and the path of their ttf- or ttc-file.
This is a map of fontfamilies.
This is the default encoding to use.
This is the default value of the embedded variable.
Creates new FontFactory
Constructs a Font-object.
the name of the font
the encoding of the font
true if the font is to be embedded in the PDF
the size of this font
the style of this font
the BaseColor of this font
a Font object
Constructs a Font-object.
the name of the font
the encoding of the font
true if the font is to be embedded in the PDF
the size of this font
the style of this font
the BaseColor of this font
true if the font comes from the cache or is added to the cache if new, false if the font is always created new
a Font object
Constructs a Font-object.
the name of the font
the encoding of the font
true if the font is to be embedded in the PDF
the size of this font
the style of this font
a Font object
Constructs a Font-object.
the name of the font
the encoding of the font
true if the font is to be embedded in the PDF
the size of this font
Constructs a Font-object.
the name of the font
the encoding of the font
true if the font is to be embedded in the PDF
a Font object
Constructs a Font-object.
the name of the font
the encoding of the font
the size of this font
the style of this font
the BaseColor of this font
a Font object
Constructs a Font-object.
the name of the font
the encoding of the font
the size of this font
the style of this font
a Font object
Constructs a Font-object.
the name of the font
the encoding of the font
the size of this font
a Font object
Constructs a Font-object.
the name of the font
the encoding of the font
a Font object
Constructs a Font-object.
the name of the font
the size of this font
the style of this font
the BaseColor of this font
a Font object
Constructs a Font-object.
the name of the font
the size of this font
the BaseColor of this font
a Font object
Constructs a Font-object.
the name of the font
the size of this font
the style of this font
a Font object
Constructs a Font-object.
the name of the font
the size of this font
a Font object
Constructs a Font-object.
the name of the font
a Font object
Register a font by giving explicitly the font family and name.
@param familyName the font family
@param fullName the font name
@param path the font path
Register a ttf- or a ttc-file.
the path to a ttf- or ttc-file
Register a ttf- or a ttc-file and use an alias for the font contained in the ttf-file.
the path to a ttf- or ttc-file
the alias you want to use for the font
Register all the fonts in a directory.
@param dir the directory
@return the number of fonts registered
Register fonts in windows
@return the number of fonts registered
Checks if a certain font is registered.
the name of the font that has to be checked
true if the font is found
Gets a set of registered fontnames.
a set of registered fontnames
Gets a set of registered font families.
a set of registered font families
A special-version of LIST
whitch use greek-letters.
@see com.lowagie.text.List
A List contains several ListItems.
Example 1:
List list = new List(true, 20);
list.Add(new ListItem("First line"));
list.Add(new ListItem("The second line is longer to see what happens once the end of the line is reached. Will it start on a new line?"));
list.Add(new ListItem("Third line"));
The result of this code looks like this:
-
First line
-
The second line is longer to see what happens once the end of the line is reached. Will it start on a new line?
-
Third line
Example 2:
List overview = new List(false, 10);
overview.Add(new ListItem("This is an item"));
overview.Add("This is another item");
The result of this code looks like this:
-
This is an item
-
This is another item
a possible value for the numbered parameter
a possible value for the numbered parameter
a possible value for the lettered parameter
a possible value for the lettered parameter
a possible value for the lettered parameter
a possible value for the lettered parameter
This is the ArrayList containing the different ListItems.
Indicates if the list has to be numbered.
Indicates if the listsymbols are numerical or alphabetical.
Indicates if the listsymbols are lowercase or uppercase.
Indicates if the indentation has to be set automatically.
Indicates if the indentation of all the items has to be aligned.
This variable indicates the first number of a numbered list.
This is the listsymbol of a list that is not numbered.
In case you are using numbered/lettered lists, this String is added before the number/letter.
@since iText 2.1.1
In case you are using numbered/lettered lists, this String is added after the number/letter.
@since iText 2.1.1
The indentation of this list on the left side.
The indentation of this list on the right side.
The indentation of the listitems.
Constructs a List
.
Constructs a List
with a specific symbol indentation.
@param symbolIndent the symbol indentation
@since iText 2.0.8
Constructs a List
.
@param numbered a bool
Constructs a List
.
@param numbered a bool
@param lettered has the list to be 'numbered' with letters
Constructs a List.
the parameter symbolIndent is important for instance when
generating PDF-documents; it indicates the indentation of the listsymbol.
a bool
the indentation that has to be used for the listsymbol
Constructs a List.
a bool
a bool
the indentation that has to be used for the listsymbol
Processes the element by adding it (or the different parts) to an
IElementListener.
an IElementListener
true if the element was processed successfully
Adds an Object to the List.
the object to add
true is successful
Makes sure all the items in the list have the same indentation.
Sets the listsymbol.
This is a shortcut for SetListSymbol(Chunk symbol).
a string
@see com.lowagie.text.Element#isContent()
@since iText 2.0.8
@see com.lowagie.text.Element#isNestable()
@since iText 2.0.8
Returns true
if the list is empty.
@return true
if the list is empty
Returns the String that is after a number or letter in the list symbol.
@return the String that is after a number or letter in the list symbol
@since iText 2.1.1
Gets the type of the text element.
a type
Gets all the chunks in this element.
an ArrayList
Alias for VB.NET compatibility.
Get/set the first number
an int
Sets the symbol
a Chunk
Get/set the indentation of this paragraph on the left side.
the indentation
Get/set the indentation of this paragraph on the right side.
the indentation
Gets the symbol indentation.
the symbol indentation
Gets all the items in the list.
an ArrayList containing ListItems
Gets the size of the list.
a size
Gets the leading of the first listitem.
a leading
Get/set the symbol indentation.
a Chunk
Sets the String that has to be added after a number or letter in the list symbol.
@since iText 2.1.1
@param postSymbol the String that has to be added after a number or letter in the list symbol.
Sets the String that has to be added before a number or letter in the list symbol.
@since iText 2.1.1
@param preSymbol the String that has to be added before a number or letter in the list symbol.
Initialization
@param symbolIndent indent
Initialisierung
@param symbolIndent indent
Initialisierung
@param greeklower greek-char in lowercase
@param symbolIndent indent
change the font to SYMBOL
Adds an Object
to the List
.
@param o the object to add.
@return true if adding the object succeeded
This is an Element that contains
some userdefined meta information about the document.
Header header = new Header("inspired by", "William Shakespeare");
This is an Element that contains
some meta information about the document.
An object of type Meta can not be constructed by the user.
Userdefined meta information should be placed in a Header-object.
Meta is reserved for: Subject, Keywords, Author, Title, Producer
and Creationdate information.
The possible value of an alignment attribute.
@since 5.0.6 (moved from ElementTags)
The possible value of an alignment attribute.
@since 5.0.6 (moved from ElementTags)
The possible value of an alignment attribute.
@since 5.0.6 (moved from ElementTags)
The possible value of an alignment attribute.
@since 5.0.6 (moved from ElementTags)
The possible value of an alignment attribute.
@since 5.0.6 (moved from ElementTags)
The possible value of an alignment attribute.
@since 5.0.6 (moved from ElementTags)
The possible value of an alignment attribute.
@since 5.0.6 (moved from ElementTags)
This is the type of Meta-information this object contains.
This is the content of the Meta-information.
Constructs a Meta.
the type of meta-information
the content
Constructs a Meta.
the tagname of the meta-information
the content
Processes the element by adding it (or the different parts) to a
IElementListener.
the IElementListener
true if the element was processed successfully
@see com.lowagie.text.Element#isContent()
@since iText 2.0.8
@see com.lowagie.text.Element#isNestable()
@since iText 2.0.8
appends some text to this Meta.
a string
a StringBuilder
Returns the name of the meta information.
name to match
a string
Gets the type of the text element.
a type
Gets all the chunks in this element.
an ArrayList
Returns the content of the meta information.
a string
Returns the name of the meta information.
a string
This is the content of this chunk of text.
Constructs a Header.
the name of the meta-information
the content
Returns the name of the meta information.
a string
List with the HTML translation of all the characters.
Set containing tags that trigger a new line.
@since iText 5.0.6
Converts a String
to the HTML-format of this String
.
@param string The String
to convert
@return a String
Converts a BaseColor
into a HTML representation of this BaseColor
.
@param color the BaseColor
that has to be converted.
@return the HTML representation of this BaseColor
Translates the alignment value.
@param alignment the alignment value
@return the translated value
Returns true if the tag causes a new line like p, br etc.
@since iText 5.0.6
Static final values of supported HTML tags and attributes.
@since 5.0.6
@deprecated since 5.5.2
name of a tag.
@since 5.0.6 (reorganized all constants)
name of a tag
name of a tag
name of a tag.
@since 5.0.6 (reorganized all constants)
name of a tag.
@since 5.0.6 (reorganized all constants)
name of a tag
name of a tag
name of a tag
name of a tag.
@since 5.0.6 (reorganized all constants)
name of a tag.
@since 5.0.6 (reorganized all constants)
name of a tag.
@since 5.0.6 (reorganized all constants)
name of a tag.
@since 5.0.6 (reorganized all constants)
name of a tag.
@since 5.0.6 (reorganized all constants)
name of a tag.
@since 5.0.6 (reorganized all constants)
name of a tag.
@since 5.0.6 (reorganized all constants)
name of a tag
name of a tag.
@since 5.0.6 (reorganized all constants)
name of a tag.
@since 5.0.6 (reorganized all constants)
name of a tag.
@since 5.0.6 (reorganized all constants)
name of a tag.
@since 5.0.6 (reorganized all constants)
name of a tag
name of a tag
name of a tag
name of a tag.
@since 5.0.6 (reorganized all constants)
name of a tag
name of a tag
name of a tag
name of a tag
name of a tag.
@since 5.0.6 (reorganized all constants)
name of a tag.
@since 5.0.6 (reorganized all constants)
name of a tag.
@since 5.0.6 (reorganized all constants)
name of a tag
name of a tag.
@since 5.0.6 (reorganized all constants)
name of an attribute
name of an attribute
@since 5.0.6
name of an attribute
@since 5.0.6
name of an attribute
name of an attribute
name of an attribute
@since 5.0.6
name of an attribute
@since 5.0.6
name of an attribute
@since 5.0.6
Name of an attribute.
@since 5.0.6
Name of an attribute.
@since 5.0.6
Name of an attribute.
@since 5.0.6
Name of an attribute.
@since 5.0.6
Name of an attribute.
@since 5.0.6
Name of an attribute.
@since 5.0.6
name of an attribute
name of an attribute
Name of an attribute.
@since 5.0.6
Name of an attribute.
@since 5.0.6
name of an attribute
the possible value of an alignment attribute
the possible value of an alignment attribute
the possible value of an alignment attribute
The possible value of an alignment attribute.
@since 5.0.6
The possible value of an alignment attribute.
@since 5.0.6
the possible value of an alignment attribute
the possible value of an alignment attribute
the possible value of an alignment attribute
the possible value of an alignment attribute
This is used for inline css style information
Attribute for specifying externally defined CSS class.
@since 5.0.6
the CSS tag for text color
The CSS tag for the font size.
@since 5.0.6
The CSS tag for the font size.
@since 5.0.6
The CSS tag for the font size.
@since 5.0.6
The CSS tag for the font size.
@since 5.0.6
The CSS tag for the font size.
@since 5.0.6
The CSS tag for the font size.
@since 5.0.6
The CSS tag for the font size.
@since 5.0.6
The CSS tag for the font size.
@since 5.0.6
the CSS tag for text decorations
a CSS value for text decoration
@since 5.0.6
a CSS value for text decoration
@since 5.0.6
a CSS value for text decoration
@since 5.0.6
a CSS value for text decoration
@since 5.0.6
a CSS value for text decoration
@since 5.0.6
a CSS value for text decoration
@since 5.0.6
A possible attribute.
@since 5.0.6
A possible attribute.
@since 5.0.6
Stores the hierarchy of tags along with the attributes of each tag.
@since 5.0.6 renamed from ChainedProperties
@deprecated since 5.5.2
A list of chained properties representing the tag hierarchy.
Creates a new instance of ChainedProperties
Walks through the hierarchy (bottom-up) looking for
a property key. Returns true as soon as a match is
found or false if the key can't be found.
@param key the key of the property
@return true if the key is found
Adds a tag and its corresponding properties to the chain.
@param tag the tags that needs to be added to the chain
@param props the tag's attributes
If the properties contain a font size, the size may need to
be adjusted based on font sizes higher in the hierarchy.
@param attrs the attributes that may have to be updated
@since 5.0.6 (renamed)
Walks through the hierarchy (bottom-up) looking for
a property key. Returns a value as soon as a match
is found or null if the key can't be found.
@param key the key of the property
@return the value of the property
Class that stores the info about one tag in the chain.
A possible tag
The styles corresponding with the tag
Constructs a chained property.
@param tag an XML/HTML tag
@param attrs the tag's attributes
Old iText class that allows you to convert HTML to PDF.
We've completely rewritten HTML to PDF conversion and we made it a separate project named XML Worker.
@deprecated since 5.5.2; please switch to XML Worker instead (this is a separate project)
The handler for the events fired by SimpleXMLParser
.
@author Paulo Soares
Called when a start tag is found.
@param tag the tag name
@param h the tag's attributes
Called when an end tag is found.
@param tag the tag name
Called when the document starts to be parsed.
Called after the document is parsed.
Called when a text element is found.
@param str the text element, probably a fragment.
Key used to store the image provider in the providers map.
@since 5.0.6
Key used to store the image processor in the providers map.
@since 5.0.6
Key used to store the image store in the providers map.
@since 5.0.6
Key used to store the image baseurl provider in the providers map.
@since 5.0.6
Key used to store the font provider in the providers map.
@since 5.0.6
Key used to store the link provider in the providers map.
@since 5.0.6
DocListener that will listen to the Elements
produced by parsing the HTML.
This can be a com.lowagie.text.Document adding
the elements to a Document directly, or an
HTMLWorker instance strong the objects in a List
The map with all the supported tags.
@since 5.0.6
The object defining all the styles.
Creates a new instance of HTMLWorker
@param document A class that implements DocListener
Creates a new instance of HTMLWorker
@param document A class that implements DocListener
@param tags A map containing the supported tags
@param style A StyleSheet
@since 5.0.6
Sets the map with supported tags.
@param tags
@since 5.0.6
Setter for the StyleSheet
@param style the StyleSheet
Parses content read from a java.io.Reader object.
@param reader the content
@throws IOException
Stack with the Elements that already have been processed.
@since iText 5.0.6 (private => protected)
Keeps the content of the current paragraph
@since iText 5.0.6 (private => protected)
The current hierarchy chain of tags.
@since 5.0.6
@see com.itextpdf.text.xml.simpleparser.SimpleXMLDocHandler#startDocument()
@see com.itextpdf.text.xml.simpleparser.SimpleXMLDocHandler#startElement(java.lang.String, java.util.Dictionary)
@see com.itextpdf.text.xml.simpleparser.SimpleXMLDocHandler#text(java.lang.String)
@see com.itextpdf.text.xml.simpleparser.SimpleXMLDocHandler#endElement(java.lang.String)
@see com.itextpdf.text.xml.simpleparser.SimpleXMLDocHandler#endDocument()
Adds a new line to the currentParagraph.
@since 5.0.6
Flushes the current paragraph, indicating that we're starting
a new block.
If the stack is empty, the paragraph is added to the document.
Otherwise the Paragraph is added to the stack.
@since 5.0.6
Stacks the current paragraph, indicating that we're starting
a new span.
@since 5.0.6
Pushes an element to the Stack.
@param element
@since 5.0.6
Updates the chain with a new tag and new attributes.
@param tag the new tag
@param attrs the corresponding attributes
@since 5.0.6
Updates the chain by removing a tag.
@param tag the new tag
@since 5.0.6
IDictionary containing providers such as a FontProvider or ImageProvider.
@since 5.0.6 (renamed from interfaceProps)
Setter for the providers.
If a FontProvider is added, the ElementFactory is updated.
@param providers a IDictionary with different providers
@since 5.0.6
Factory that is able to create iText Element objects.
@since 5.0.6
Creates a Chunk using the factory.
@param content the content of the chunk
@return a Chunk with content
@since 5.0.6
Creates a Paragraph using the factory.
@return a Paragraph without any content
@since 5.0.6
Creates a List object.
@param tag should be "ol" or "ul"
@return a List object
@since 5.0.6
Creates a ListItem object.
@return a ListItem object
@since 5.0.6
Creates a LineSeparator object.
@param attrs properties of the LineSeparator
@return a LineSeparator object
@since 5.0.6
Creates an Image object.
@param attrs properties of the Image
@return an Image object (or null if the Image couldn't be found)
@throws DocumentException
@throws IOException
@since 5.0.6
Creates a Cell.
@param tag the tag
@return a CellWrapper object
@since 5.0.6
Adds a link to the current paragraph.
@since 5.0.6
Fetches the List from the Stack and adds it to
the TextElementArray on top of the Stack,
or to the Document if the Stack is empty.
@throws DocumentException
@since 5.0.6
Looks for the List object on the Stack,
and adds the ListItem to the List.
@throws DocumentException
@since 5.0.6
Processes an Image.
@param img
@param attrs
@throws DocumentException
@since 5.0.6
Processes the Table.
@throws DocumentException
@since 5.0.6
Gets the TableWrapper from the Stack and adds a new row.
@since 5.0.6
Stack to keep track of table tags.
Boolean to keep track of TR tags.
Boolean to keep track of TD and TH tags
Boolean to keep track of LI tags
Boolean to keep track of PRE tags
@since 5.0.6 renamed from isPRE
Indicates if text needs to be skipped.
@since iText 5.0.6 (private => protected)
Pushes the values of pendingTR and pendingTD
to a state stack.
@since 5.0.6
Pops the values of pendingTR and pendingTD
from a state stack.
@since 5.0.6
@return the pendingTR
@since 5.0.6
@param pendingTR the pendingTR to set
@since 5.0.6
@return the pendingTD
@since 5.0.6
@param pendingTD the pendingTD to set
@since 5.0.6
@return the pendingLI
@since 5.0.6
@param pendingLI the pendingLI to set
@since 5.0.6
@return the insidePRE
@since 5.0.6
@param insidePRE the insidePRE to set
@since 5.0.6
@return the skipText
@since 5.0.6
@param skipText the skipText to set
@since 5.0.6
The resulting list of elements.
Parses an HTML source to a List of Element objects
@param reader the HTML source
@param style a StyleSheet object
@return a List of Element objects
@throws IOException
Parses an HTML source to a List of Element objects
@param reader the HTML source
@param style a StyleSheet object
@param providers map containing classes with extra info
@return a List of Element objects
@throws IOException
Parses an HTML source to a List of Element objects
@param reader the HTML source
@param style a StyleSheet object
@param tags a map containing supported tags and their processors
@param providers map containing classes with extra info
@return a List of Element objects
@throws IOException
@since 5.0.6
@see com.itextpdf.text.ElementListener#add(com.itextpdf.text.Element)
@see com.itextpdf.text.DocListener#close()
@see com.itextpdf.text.DocListener#newPage()
@see com.itextpdf.text.DocListener#open()
@see com.itextpdf.text.DocListener#resetPageCount()
@see com.itextpdf.text.DocListener#setMarginMirroring(bool)
@see com.itextpdf.text.DocListener#setMarginMirroring(bool)
@since 2.1.6
@see com.itextpdf.text.DocListener#setMargins(float, float, float, float)
@see com.itextpdf.text.DocListener#setPageSize(com.itextpdf.text.Rectangle)
Sets the providers.
@deprecated use SetProviders() instead
Gets the providers
@deprecated use GetProviders() instead
@see com.itextpdf.text.DocListener#setPageCount(int)
@deprecated since 5.5.2
Old class to define styles for HTMLWorker.
We've completely rewritten HTML to PDF functionality; see project XML Worker.
XML Worker is able to parse CSS files and "style" attribute values.
@deprecated since 5.5.2
IDictionary storing tags and their corresponding styles.
@since 5.0.6 (changed Dictionary => IDictionary)
IDictionary storing possible names of the "class" attribute
and their corresponding styles.
@since 5.0.6 (changed Dictionary => IDictionary)
Creates a new instance of StyleSheet
Associates a IDictionary containing styles with a tag.
@param tag the name of the HTML/XML tag
@param attrs a map containing styles
Adds an extra style key-value pair to the styles IDictionary
of a specific tag
@param tag the name of the HTML/XML tag
@param key the key specifying a specific style
@param value the value defining the style
Associates a IDictionary containing styles with a class name.
@param className the value of the class attribute
@param attrs a map containing styles
Adds an extra style key-value pair to the styles IDictionary
of a specific tag
@param className the name of the HTML/XML tag
@param key the key specifying a specific style
@param value the value defining the style
Resolves the styles based on the tag name and the value
of the class attribute.
@param tag the tag that needs to be resolved
@param attrs existing style map that will be updated
Method contributed by Lubos Strapko
@param h
@param chain
@since 2.1.3
This class is a HashMap that contains the names of colors as a key and the
corresponding Color as value. (Source: Wikipedia
http://en.wikipedia.org/wiki/Web_colors )
@author blowagie
@deprecated since 5.5.2
A web color string without the leading # will be 3 or 6 characters long
and all those characters will be hex digits. NOTE: colStr must be all
lower case or the current hex letter test will fail.
@param colStr
A non-null, lower case string that might describe an RGB color
in hex.
@return Is this a web color hex string without the leading #?
@since 5.0.6
Gives you a BaseColor based on a name.
@param name
a name such as black, violet, cornflowerblue or #RGB or
#RRGGBB or RGB or RRGGBB or rgb(R,G,B)
@return the corresponding BaseColor object. Never returns null.
@throws IllegalArgumentException
if the String isn't a know representation of a color.
An Image is the representation of a graphic element (JPEG, PNG or GIF)
that has to be inserted into the document
A Rectangle is the representation of a geometric figure.
This is the value that will be used as undefined.
This represents one side of the border of the Rectangle.
This represents one side of the border of the Rectangle.
This represents one side of the border of the Rectangle.
This represents one side of the border of the Rectangle.
This represents a rectangle without borders.
This represents a type of border.
the lower left x-coordinate.
the lower left y-coordinate.
the upper right x-coordinate.
the upper right y-coordinate.
This represents the status of the 4 sides of the rectangle.
This is the width of the border around this rectangle.
This is the color of the border of this rectangle.
The color of the left border of this rectangle.
The color of the right border of this rectangle.
The color of the top border of this rectangle.
The color of the bottom border of this rectangle.
The width of the left border of this rectangle.
The width of the right border of this rectangle.
The width of the top border of this rectangle.
The width of the bottom border of this rectangle.
Whether variable width borders are used.
This is the color of the background of this rectangle.
This is the rotation value of this rectangle.
Constructs a Rectangle-object.
lower left x
lower left y
upper right x
upper right y
Constructs a Rectangle
-object.
@param llx lower left x
@param lly lower left y
@param urx upper right x
@param ury upper right y
@param rotation the rotation (0, 90, 180, or 270)
@since iText 5.0.6
Constructs a Rectangle-object starting from the origin (0, 0).
upper right x
upper right y
Constructs a Rectangle
-object starting from the origin
(0, 0) and with a specific rotation (valid values are 0, 90, 180, 270).
@param urx upper right x
@param ury upper right y
@param rotation the rotation of the rectangle
@since iText 5.0.6
Constructs a Rectangle-object.
another Rectangle
Constructs a Rectangle
-object based on a com.itextpdf.awt.geom.Rectangle
object
@param rect com.itextpdf.awt.geom.Rectangle
Copies all of the parameters from a Rectangle
object
except the position.
@param rect
Rectangle
to copy from
Copies all of the parameters from a Rectangle
object
except the position.
@param rect
Rectangle
to copy from
Processes the element by adding it (or the different parts) to an
IElementListener.
an IElementListener
true if the element was processed successfully
@see com.lowagie.text.Element#isContent()
@since iText 2.0.8
@see com.lowagie.text.Element#isNestable()
@since iText 2.0.8
Switches lowerleft with upperright
Gets a Rectangle that is altered to fit on the page.
the top position
the bottom position
a Rectangle
Swaps the values of urx and ury and of lly and llx in order to rotate the rectangle.
a Rectangle
Enables the border on the specified side.
@param side
the side to enable. One of LEFT, RIGHT, TOP, BOTTOM
Disables the border on the specified side.
@param side
the side to disable. One of LEFT, RIGHT, TOP, BOTTOM
Returns the lower left x-coordinate, considering a given margin.
a margin
the lower left x-coordinate
Returns the upper right x-coordinate, considering a given margin.
a margin
the upper right x-coordinate
Returns the upper right y-coordinate, considering a given margin.
a margin
the upper right y-coordinate
Returns the lower left y-coordinate, considering a given margin.
a margin
the lower left y-coordinate
Indicates if the table has borders.
a bool
Indicates if the table has a some type of border.
the type of border
a bool
Updates the border flag for a side based on the specified width. A width
of 0 will disable the border on that side. Any other width enables it.
@param width
width of border
@param side
border side constant
Gets the type of the text element.
a type
Gets all the chunks in this element.
an ArrayList
Get/set the upper right y-coordinate.
a float
Get/set the border
a int
Get/set the grayscale of the rectangle.
a float
Get/set the lower left x-coordinate.
a float
Get/set the upper right x-coordinate.
a float
Get/set the lower left y-coordinate.
a float
Returns the width of the rectangle.
a width
Returns the height of the rectangle.
a height
Get/set the borderwidth.
a float
Gets the color of the border.
@return a value
Get/set the color of the border.
a BaseColor
Gets the backgroundcolor.
@return a value
Get/set the backgroundcolor.
a BaseColor
Set/gets the rotation
a int
Sets a parameter indicating if the rectangle has variable borders
@param useVariableBorders
indication if the rectangle has variable borders
Objects implementing Spaceable allow setting spacing before and after.
Sets the spacing before.
@param spacing the new spacing
Sets the spacing after.
@param spacing the new spacing
Interface providing alternate description for accessible elements.
this is a kind of image Element.
this is a kind of image Element.
this is a kind of image Element.
this is a kind of image Element.
this is a kind of image Element.
this is a kind of image Element.
This represents a coordinate in the transformation matrix.
This represents a coordinate in the transformation matrix.
This represents a coordinate in the transformation matrix.
This represents a coordinate in the transformation matrix.
This represents a coordinate in the transformation matrix.
This represents a coordinate in the transformation matrix.
This represents a coordinate in the transformation matrix.
This represents a coordinate in the transformation matrix.
type of image
type of image
type of image
type of image
type of image
type of image
type of image
type of image
type of image
@since 2.1.5
Image color inversion
The imagetype.
The URL of the image.
The raw data of the image.
The template to be treated as an image.
The alignment of the Image.
Text that can be shown instead of the image.
This is the absolute X-position of the image.
This is the absolute Y-position of the image.
This is the width of the image without rotation.
This is the width of the image without rotation.
This is the scaled width of the image taking rotation into account.
This is the original height of the image taking rotation into account.
The compression level of the content streams.
@since 2.1.3
This is the rotation of the image.
this is the colorspace of a jpeg-image.
this is the bits per component of the raw image. It also flags a CCITT image.
this is the transparency information of the raw image
the indentation to the left.
the indentation to the right.
Holds value of property dpiX.
Holds value of property dpiY.
Holds value of property interpolation.
if the annotation is not null the image will be clickable.
ICC Profile attached
Holds value of property deflated.
Holds value of property smask.
Holds value of property XYRatio.
Holds value of property originalType.
Holds value of property originalData.
The spacing before the image.
The spacing after the image.
Holds value of property widthPercentage.
Holds value of property initialRotation.
Constructs an Image-object, using an url.
the URL where the image can be found.
Constructs an Image object duplicate.
another Image object.
Gets an instance of an Image.
an Image
an object of type Gif, Jpeg or Png
Gets an instance of an Image.
an URL
an object of type Gif, Jpeg or Png
Gets an instance of an Image.
an URL
an object of type Gif, Jpeg or Png
Gets an instance of an Image.
a byte array
an object of type Gif, Jpeg or Png
Gets an instance of an Image from a System.Drwaing.Image.
the System.Drawing.Image to convert
if different from null the transparency
pixels are replaced by this color
if true the image is treated as black and white
an object of type ImgRaw
Converts a .NET image to a Native(PNG, JPG, GIF, WMF) image
Gets an instance of an Image from a System.Drawing.Image.
the System.Drawing.Image to convert
if different from null the transparency
pixels are replaced by this color
an object of type ImgRaw
Gets an instance of an Image.
a filename
an object of type Gif, Jpeg or Png
Gets an instance of an Image in raw mode.
the width of the image in pixels
the height of the image in pixels
1,3 or 4 for GrayScale, RGB and CMYK
bits per component
the image data
an object of type ImgRaw
Creates a JBIG2 Image.
@param width the width of the image
@param height the height of the image
@param data the raw image data
@param globals JBIG2 globals
@since 2.1.5
Reuses an existing image.
@param ref the reference to the image dictionary
@throws BadElementException on error
@return the image
Gets an instance of an Image in raw mode.
Gets an instance of an Image in raw mode.
the width of the image in pixels
the height of the image in pixels
Gets an instance of an Image in raw mode.
the width of the image in pixels
the height of the image in pixels
1,3 or 4 for GrayScale, RGB and CMYK
bits per component
the image data
transparency information in the Mask format of the
image dictionary
an object of type ImgRaw
Sets the absolute position of the Image.
Scale the image to the dimensions of the rectangle
dimensions to scale the Image
Scale the image to an absolute width and an absolute height.
the new width
the new height
Scale the image to an absolute width.
the new width
Scale the image to an absolute height.
the new height
Scale the image to a certain percentage.
the scaling percentage
Scale the width and height of an image to a certain percentage.
the scaling percentage of the width
the scaling percentage of the height
Scales the images to the dimensions of the rectangle.
the dimensions to fit
Scales the image so that it fits a certain width and height.
the width to fit
the height to fit
Gets the current image rotation in radians.
@return the current image rotation in radians
Checks if the Images has to be added at an absolute position.
a bool
Checks if the Images has to be added at an absolute X position.
a bool
@see com.lowagie.text.Element#isNestable()
@since iText 2.0.8
Returns true if the image is a Jpeg-object.
a bool
Returns true if the image is a ImgRaw-object.
a bool
Returns true if the image is an ImgTemplate-object.
a bool
Returns the transformation matrix of the image.
an array [AX, AY, BX, BY, CX, CY, DX, DY]
Returns the transformation matrix of the image.
@return an array [AX, AY, BX, BY, CX, CY, DX, DY]
generates new serial id
Sets the dots per inch value
@param dpiX
dpi for x coordinates
@param dpiY
dpi for y coordinates
Returns true if this Image has the
requisites to be a mask.
true if this Image can be a mask
Make this Image a mask.
Returns true if this Image is a mask.
true if this Image is a mask
Checks is the image has an ICC profile.
@return the ICC profile or null
Indicates if the image should be scaled to fit the line
when the image exceeds the available width.
@since iText 5.0.6
Indicates if the image should be scaled to fit
when the image exceeds the available height.
@since iText 5.4.2
Replaces CalRGB and CalGray colorspaces with DeviceRGB and DeviceGray.
Sets the rotation of the image in radians.
rotation in radians
Sets the rotation of the image in degrees.
rotation in degrees
Get/set the annotation.
the Annotation
Gets the bpc for the image.
this only makes sense for Images of the type RawImage.
a bpc value
Gets the raw data for the image.
this only makes sense for Images of the type RawImage.
the raw data
Get/set the template to be used as an image.
this only makes sense for Images of the type ImgTemplate.
the template
Returns the absolute X position.
a position
Returns the absolute Y position.
a position
Returns the type.
a type
Gets the string-representation of the reference to the image.
a string
Get/set the alignment for the image.
a value
Get/set the alternative text for the image.
a string
Gets the scaled width of the image.
a value
Gets the scaled height of the image.
a value
Gets the colorspace for the image.
this only makes sense for Images of the type Jpeg.
a colorspace value
Returns the transparency.
the transparency
Gets the plain width of the image.
a value
Gets the plain height of the image.
a value
returns serial id for this object
Gets the dots-per-inch in the X direction. Returns 0 if not available.
the dots-per-inch in the X direction
Gets the dots-per-inch in the Y direction. Returns 0 if not available.
the dots-per-inch in the Y direction
Get/set the explicit masking.
the explicit masking
Inverts the meaning of the bits of a mask.
true to invert the meaning of the bits of a mask
Sets the image interpolation. Image interpolation attempts to
produce a smooth transition between adjacent sample values.
New value of property interpolation.
Tags this image with an ICC profile.
@param profile the profile
Gets and sets the value of scaleToFitHeight.
@return true if the image size has to scale to the available height
@since iText 5.4.2
Some image formats, like TIFF may present the images rotated that have
to be compensated.
Sets the compression level to be used if the image is written as a compressed stream.
@param compressionLevel a value between 0 (best speed) and 9 (best compression)
@since 2.1.3
CCITT Image data that has to be inserted into the document
@see Element
@see Image
@author Paulo Soares
CCITT Image data that has to be inserted into the document
Creats an Image in CCITT mode.
the exact width of the image
the exact height of the image
reverses the bits in data.
Bit 0 is swapped with bit 7 and so on
the type of compression in data. It can be
CCITTG4, CCITTG31D, CCITTG32D
parameters associated with this stream. Possible values are
CCITT_BLACKIS1, CCITT_ENCODEDBYTEALIGN, CCITT_ENDOFLINE and CCITT_ENDOFBLOCK or a
combination of them
the image data
Support for JBIG2 images.
@since 2.1.5
JBIG2 globals
A unique hash
Copy contstructor.
@param image another Image
Empty constructor.
Actual constructor for ImgJBIG2 images.
@param width the width of the image
@param height the height of the image
@param data the raw image data
@param globals JBIG2 globals
Getter for the JBIG2 global data.
@return an array of bytes
Getter for the unique hash.
@return an array of bytes
Raw Image data that has to be inserted into the document
Creats an Image in raw mode.
the exact width of the image
the exact height of the image
1,3 or 4 for GrayScale, RGB and CMYK
bits per component. Must be 1,2,4 or 8
data the image data
PdfTemplate that has to be inserted into the document
Creats an Image from a PdfTemplate.
the Image
Creats an Image from a PdfTemplate.
the PdfTemplate
An ImgWMF is the representation of a windows metafile
that has to be inserted into the document
@see Element
@see Image
@see Gif
@see Png
An ImgWMF is the representation of a windows metafile
that has to be inserted into the document
Constructs an ImgWMF-object
a Image
Constructs an ImgWMF-object, using an url.
the URL where the image can be found
Constructs an ImgWMF-object, using a filename.
a string-representation of the file that contains the image.
Constructs an ImgWMF-object from memory.
the memory image
This method checks if the image is a valid WMF and processes some parameters.
Reads the WMF into a template.
the template to read to
A RandomAccessSource that is based on an underlying byte array
@since 5.3.5
Represents an abstract source that bytes can be read from. This class forms the foundation for all byte input in iText.
Implementations do not keep track of a current 'position', but rather provide absolute get methods. Tracking position
should be handled in classes that use RandomAccessSource internally (via composition).
@since 5.3.5
Gets a byte at the specified position
@param position
@return the byte, or -1 if EOF is reached
Gets an array at the specified position. If the number of bytes requested cannot be read, the bytes that can be
read will be placed in bytes and the number actually read will be returned.
@param position the position in the RandomAccessSource to read from
@param bytes output buffer
@param off offset into the output buffer where results will be placed
@param len the number of bytes to read
@return the number of bytes actually read, or -1 if the file is at EOF
Closes this source. The underlying data structure or source (if any) will also be closed
@throws IOException
@return the length of this source
@since 5.3.5
The source
Constructs a new OffsetRandomAccessSource
@param source the source
{@inheritDoc}
{@inheritDoc}
{@inheritDoc}
{@inheritDoc}
A RandomAccessSource that is based on a set of underlying sources, treating the sources as if they were a contiguous block of data.
@since 5.3.5
The underlying sources (along with some meta data to quickly determine where each source begins and ends)
Cached value to make multiple reads from the same underlying source more efficient
Cached size of the underlying channel
Constructs a new {@link GroupedRandomAccessSource} based on the specified set of sources
@param sources the sources used to build this group
For a given offset, return the index of the source that contains the specified offset.
This is an optimization feature to help optimize the access of the correct source without having to iterate
through every single source each time. It is safe to always return 0, in which case the full set of sources will be searched.
Subclasses should override this method if they are able to compute the source index more efficiently (for example {@link FileChannelRandomAccessSource} takes advantage of fixed size page buffers to compute the index)
@param offset the offset
@return the index of the input source that contains the specified offset, or 0 if unknown
Returns the SourceEntry that contains the byte at the specified offset
sourceReleased is called as a notification callback so subclasses can take care of cleanup when the source is no longer the active source
@param offset the offset of the byte to look for
@return the SourceEntry that contains the byte at the specified offset
@throws IOException if there is a problem with IO (usually the result of the sourceReleased() call)
Called when a given source is no longer the active source. This gives subclasses the abilty to release resources, if appropriate.
@param source the source that is no longer the active source
@throws IOException if there are any problems
Called when a given source is about to become the active source. This gives subclasses the abilty to retrieve resources, if appropriate.
@param source the source that is about to become the active source
@throws IOException if there are any problems
{@inheritDoc}
The source that contains the byte at position is retrieved, the correct offset into that source computed, then the value
from that offset in the underlying source is returned.
{@inheritDoc}
{@inheritDoc}
Closes all of the underlying sources
{@inheritDoc}
Used to track each source, along with useful meta data
The underlying source
The first byte (in the coordinates of the GroupedRandomAccessSource) that this source contains
The last byte (in the coordinates of the GroupedRandomAccessSource) that this source contains
The index of this source in the GroupedRandomAccessSource
Standard constructor
@param index the index
@param source the source
@param offset the offset of the source in the GroupedRandomAccessSource
Given an absolute offset (in the GroupedRandomAccessSource coordinates), calculate the effective offset in the underlying source
@param absoluteOffset the offset in the parent GroupedRandomAccessSource
@return the effective offset in the underlying source
A RandomAccessSource that is wraps another RandomAccessSouce but does not propagate close(). This is useful when
passing a RandomAccessSource to a method that would normally close the source.
@since 5.3.5
The source
Constructs a new OffsetRandomAccessSource
@param source the source
{@inheritDoc}
{@inheritDoc}
Does nothing - the underlying source is not closed
{@inheritDoc}
A RandomAccessSource that uses a {@link RandomAccessFile} as it's source
Note: Unlike most of the RandomAccessSource implementations, this class is not thread safe
The source
The length of the underling RAF. Note that the length is cached at construction time to avoid the possibility
of IOExceptions when reading the length.
Creates this object
@param raf the source for this RandomAccessSource
@throws IOException if the RAF can't be read
{@inheritDoc}
{@inheritDoc}
Closes the underlying RandomAccessFile
{@inheritDoc}
Note: the length is determined when the {@link RAFRandomAccessSource} is constructed. If the file length changes
after construction, that change will not be reflected in this call.
Factory to create {@link RandomAccessSource} objects based on various types of sources
@since 5.3.5
whether the full content of the source should be read into memory at construction
Whether {@link RandomAccessFile} should be used instead of a {@link FileChannel}, where applicable
Whether the underlying file should have a RW lock on it or just an R lock
Creates a factory that will give preference to accessing the underling data source using memory mapped files
Determines whether the full content of the source will be read into memory
@param forceRead true if the full content will be read, false otherwise
@return this object (this allows chaining of method calls)
Creates a {@link RandomAccessSource} based on a byte array
@param data the byte array
@return the newly created {@link RandomAccessSource}
Creates a {@link RandomAccessSource} based on a URL. The data available at the URL is read into memory and used
as the source for the {@link RandomAccessSource}
@param url the url to read from
@return the newly created {@link RandomAccessSource}
Creates a {@link RandomAccessSource} based on an {@link InputStream}. The full content of the InputStream is read into memory and used
as the source for the {@link RandomAccessSource}
@param is the stream to read from
@return the newly created {@link RandomAccessSource}
Creates a {@link RandomAccessSource} based on a filename string.
If the filename describes a URL, a URL based source is created
If the filename describes a file on disk, the contents may be read into memory (if forceRead is true), opened using memory mapped file channel (if usePlainRandomAccess is false), or opened using {@link RandomAccessFile} access (if usePlainRandomAccess is true)
This call will automatically failover to using {@link RandomAccessFile} if the memory map operation fails
@param filename the name of the file or resource to create the {@link RandomAccessSource} for
@return the newly created {@link RandomAccessSource}
Creates a new {@link RandomAccessSource} by reading the specified file/resource into memory
@param filename the name of the resource to read
@return the newly created {@link RandomAccessSource}
@throws IOException if reading the underling file or stream fails
Creates a new {@link RandomAccessSource} by reading the specified file/resource into memory
@param filename the name of the resource to read
@return the newly created {@link RandomAccessSource}
@throws IOException if reading the underling file or stream fails
An input stream that uses a RandomAccessSource as it's underlying source
@since 5.3.5
The source
The current position in the source
Creates an input stream based on the source
@param source the source
Utility class with commonly used stream operations
@since 5.3.5
Reads the full content of a stream and returns them in a byte array
@param is the stream to read
@return a byte array containing all of the bytes from the stream
@throws IOException if there is a problem reading from the input stream
Gets the font resources.
@param key the name of the resource
@return the Stream
to get the resource or
null
if not found
A RandomAccessSource that wraps another RandomAccessSouce and provides a window of it at a specific offset and over
a specific length. Position 0 becomes the offset position in the underlying source.
@since 5.3.5
The source
The amount to offset the source by
The length
Constructs a new OffsetRandomAccessSource that extends to the end of the underlying source
@param source the source
@param offset the amount of the offset to use
Constructs a new OffsetRandomAccessSource with an explicit length
@param source the source
@param offset the amount of the offset to use
@param length the number of bytes to be included in this RAS
{@inheritDoc}
Note that the position will be adjusted to read from the corrected location in the underlying source
{@inheritDoc}
Note that the position will be adjusted to read from the corrected location in the underlying source
{@inheritDoc}
{@inheritDoc}
Note that the length will be adjusted to read from the corrected location in the underlying source
The RTF jar depends on the iText jar, but the iText jar may not
depend on the RTF jar. This interface offers a temporary solution
until we find a more elegant way to solve this.
Interface for customizing the split character.
An Jpeg is the representation of a graphic element (JPEG)
that has to be inserted into the document
This is a type of marker.
This is a type of marker.
This is a type of marker.
This is a type of marker.
Marker value for Photoshop IRB
Acceptable Jpeg markers.
Unsupported Jpeg markers.
Jpeg markers without additional parameters.
sequence preceding Photoshop resolution data
Construct a Jpeg-object, using a Image
a Image
Constructs a Jpeg-object, using an Uri.
Deprecated, use Image.GetInstance(...) to create an Image
the Uri where the image can be found
Constructs a Jpeg-object from memory.
the memory image
Constructs a Jpeg-object from memory.
the memory image.
the width you want the image to have
the height you want the image to have
Reads a short from the Stream.
the Stream
an int
Reads an inverted short from the Stream.
the Stream
an int
Returns a type of marker.
an int
a type: VALID_MARKER, UNSUPPORTED_MARKER or NOPARAM_MARKER
This method checks if the image is a valid JPEG and processes some parameters.
An Jpeg2000
is the representation of a graphic element (JPEG)
that has to be inserted into the document
@see Element
@see Image
Constructs a Jpeg2000
-object, using an url.
@param url the URL
where the image can be found
@throws BadElementException
@throws IOException
Constructs a Jpeg2000
-object from memory.
@param img the memory image
@throws BadElementException
@throws IOException
Constructs a Jpeg2000
-object from memory.
@param img the memory image.
@param width the width you want the image to have
@param height the height you want the image to have
@throws BadElementException
@throws IOException
This method checks if the image is a valid JPEG and processes some parameters.
@throws BadElementException
@throws IOException
@return true
if the image is JP2, false
if a codestream.
A ListItem is a Paragraph
that can be added to a List.
Example 1:
List list = new List(true, 20);
list.Add(new ListItem("First line"));
list.Add(new ListItem("The second line is longer to see what happens once the end of the line is reached. Will it start on a new line?"));
list.Add(new ListItem("Third line"));
The result of this code looks like this:
-
First line
-
The second line is longer to see what happens once the end of the line is reached. Will it start on a new line?
-
Third line
Example 2:
List overview = new List(false, 10);
overview.Add(new ListItem("This is an item"));
overview.Add("This is another item");
The result of this code looks like this:
-
This is an item
-
This is another item
A Paragraph is a series of Chunks and/or Phrases.
A Paragraph has the same qualities of a Phrase, but also
some additional layout-parameters:
the indentation
the alignment of the text
Paragraph p = new Paragraph("This is a paragraph",
FontFactory.GetFont(FontFactory.HELVETICA, 18, Font.BOLDITALIC, new BaseColor(0, 0, 255)));
The alignment of the text.
The indentation of this paragraph on the left side.
The indentation of this paragraph on the right side.
Holds value of property firstLineIndent.
The spacing before the paragraph.
The spacing after the paragraph.
Holds value of property extraParagraphSpace.
Does the paragraph has to be kept together on 1 page.
Constructs a Paragraph.
Constructs a Paragraph with a certain leading.
the leading
Constructs a Paragraph with a certain Chunk.
a Chunk
Constructs a Paragraph with a certain Chunk
and a certain leading.
the leading
a Chunk
Constructs a Paragraph with a certain string.
a string
Constructs a Paragraph with a certain string
and a certain Font.
a string
a Font
Constructs a Paragraph with a certain string
and a certain leading.
the leading
a string
Constructs a Paragraph with a certain leading, string
and Font.
the leading
a string
a Font
Constructs a Paragraph with a certain Phrase.
a Phrase
Creates a shallow clone of the Paragraph.
@return
Creates a shallow clone of the Paragraph.
@return
Breaks this Paragraph up in different parts, separating paragraphs, lists and tables from each other.
@return
Breaks this Paragraph up in different parts, separating paragraphs, lists and tables from each other.
@return
Adds an Object to the Paragraph.
the object to add
a bool
Gets the type of the text element.
a type
Get/set the alignment of this paragraph.
a integer
Get/set the indentation of this paragraph on the left side.
a float
Get/set the indentation of this paragraph on the right side.
a float
Set/get if this paragraph has to be kept together on one page.
a bool
this is the symbol that wil proceed the listitem.
Constructs a ListItem.
Constructs a ListItem with a certain leading.
the leading
Constructs a ListItem with a certain Chunk.
a Chunk
Constructs a ListItem with a certain string.
a string
Constructs a ListItem with a certain string
and a certain Font.
a string
a string
Constructs a ListItem with a certain Chunk
and a certain leading.
the leading
a Chunk
Constructs a ListItem with a certain string
and a certain leading.
the leading
a string
Constructs a ListItem with a certain leading, string
and Font.
@param leading the leading
@param string a string
@param font a Font
Constructs a ListItem with a certain leading, string
and Font.
the leading
a string
a Font
Constructs a ListItem with a certain Phrase.
a Phrase
Sets the indentation of this paragraph on the left side.
@param indentation the new indentation
Changes the font of the list symbol to the font of the first chunk
in the list item.
@since 5.0.6
Gets the type of the text element.
a type
Get/set the listsymbol.
a Chunk
Factory that creates a counter for every reader or writer class.
You can implement your own counter and declare it like this:
CounterFactory.getInstance().setCounter(new SysoCounter());
SysoCounter is just an example of a Counter implementation.
It writes info about files being read and written to the System.out.
This functionality can be used to create metrics in a SaaS context.
The singleton instance.
The current counter implementation.
The empty constructor.
Returns the singleton instance of the factory.
Returns a counter factory.
Getter for the counter.
Setter for the counter.
Implementation of the Counter interface that doesn't do anything.
Interface that can be implemented if you want to count the number of documents
that are being processed by iText.
Implementers may use this method to record actual system usage for licensing purposes
(e.g. count the number of documents or the volumne in bytes in the context of a SaaS license).
Gets a Counter instance for a specific class.
This method gets triggered if a file is read.
@param l the length of the file that was written
This method gets triggered if a file is written.
@param l the length of the file that was written
@param klass
@return this Counter implementation
@see com.itextpdf.text.log.Counter#getCounter(java.lang.Class)
@see com.itextpdf.text.log.Counter#read(long)
@see com.itextpdf.text.log.Counter#written(long)
Implementation of the Counter interface that doesn't do anything.
@param klass The Class asking for the Counter
@return the Counter instance
@see com.itextpdf.text.log.Counter#getCounter(java.lang.Class)
@see com.itextpdf.text.log.Counter#read(long)
@see com.itextpdf.text.log.Counter#written(long)
The name of the class for which the Counter was created
(or iText if no name is available)
Empty SysoCounter constructor.
Constructs a SysoCounter for a specific class.
@param klass
@see com.itextpdf.text.log.Counter#getCounter(java.lang.Class)
@see com.itextpdf.text.log.Counter#read(long)
@see com.itextpdf.text.log.Counter#written(long)
Wrapper that allows to add properties to 'basic building block' objects.
Before iText 1.5 every 'basic building block' implemented the MarkupAttributes interface.
By setting attributes, you could add markup to the corresponding XML and/or HTML tag.
This functionality was hardly used by anyone, so it was removed, and replaced by
the MarkedObject functionality.
@deprecated since 5.5.9. This class is no longer used.
The element that is wrapped in a MarkedObject.
Contains extra markupAttributes
This constructor is for internal use only.
Creates a MarkedObject.
Processes the element by adding it (or the different parts) to an
ElementListener
.
@param listener an ElementListener
@return true
if the element was processed successfully
@see com.lowagie.text.Element#isContent()
@since iText 2.0.8
@see com.lowagie.text.Element#isNestable()
@since iText 2.0.8
Gets all the chunks in this element.
@return an ArrayList
Gets the type of the text element.
@return a type
@return the markupAttributes
Wrapper that allows to add properties to a Chapter/Section object.
Before iText 1.5 every 'basic building block' implemented the MarkupAttributes interface.
By setting attributes, you could add markup to the corresponding XML and/or HTML tag.
This functionality was hardly used by anyone, so it was removed, and replaced by
the MarkedObject functionality.
@deprecated since 5.5.9. This class is no longer used.
This is the title of this section.
Creates a MarkedObject with a Section or Chapter object.
@param section the marked section
Adds a Paragraph
, List
or Table
to this Section
.
@param index index at which the specified element is to be inserted
@param o an object of type Paragraph
, List
or Table
=
@throws ClassCastException if the object is not a Paragraph
, List
or Table
Adds a Paragraph
, List
, Table
or another Section
to this Section
.
@param o an object of type Paragraph
, List
, Table
or another Section
@return a bool
@throws ClassCastException if the object is not a Paragraph
, List
, Table
or Section
Processes the element by adding it (or the different parts) to an
ElementListener
.
@param listener an ElementListener
@return true
if the element was processed successfully
Adds a collection of Element
s
to this Section
.
@param collection a collection of Paragraph
s, List
s and/or Table
s
@return true
if the action succeeded, false
if not.
@throws ClassCastException if one of the objects isn't a Paragraph
, List
, Table
Creates a Section
, adds it to this Section
and returns it.
@param indentation the indentation of the new section
@param numberDepth the numberDepth of the section
@return a new Section object
Creates a Section
, adds it to this Section
and returns it.
@param indentation the indentation of the new section
@return a new Section object
Creates a Section
, add it to this Section
and returns it.
@param numberDepth the numberDepth of the section
@return a new Section object
Creates a Section
, adds it to this Section
and returns it.
@return a new Section object
Adds a new page to the section.
@since 2.1.1
Sets the title of this section.
@param title the new title
Sets the indentation of this Section
on the left side.
@param indentation the indentation
Sets the indentation of this Section
on the right side.
@param indentation the indentation
Sets the indentation of the content of this Section
.
@param indentation the indentation
Setter for property bookmarkOpen.
@param bookmarkOpen false if the bookmark children are not
visible.
Setter for property triggerNewPage.
@param triggerNewPage true if a new page has to be triggered.
Sets the bookmark title. The bookmark title is the same as the section title but
can be changed with this method.
@param bookmarkTitle the bookmark title
The PageSize-object contains a number of read only rectangles representing the most common paper sizes.
This is the letter format
This is the note format
This is the legal format
This is the tabloid format
This is the executive format
This is the postcard format
This is the a0 format
This is the a1 format
This is the a2 format
This is the a3 format
This is the a4 format
This is the a5 format
This is the a6 format
This is the a7 format
This is the a8 format
This is the a9 format
This is the a10 format
This is the b0 format
This is the b1 format
This is the b2 format
This is the b3 format
This is the b4 format
This is the b5 format
This is the b6 format
This is the b7 format
This is the b8 format
This is the b9 format
This is the b10 format
This is the archE format
This is the archD format
This is the archC format
This is the archB format
This is the archA format
This is the American Foolscap format
This is the European Foolscap format
This is the halfletter format
This is the 11x17 format
This is the ISO 7810 ID-1 format (85.60 x 53.98 mm or 3.370 x 2.125 inch)
This is the ISO 7810 ID-2 format (A7 rotated)
This is the ISO 7810 ID-3 format (B7 rotated)
This is the ledger format
This is the Crown Quarto format
This is the Large Crown Quarto format
This is the Demy Quarto format.
This is the Royal Quarto format.
This is the Crown Octavo format
This is the Large Crown Octavo format
This is the Demy Octavo format
This is the Royal Octavo format.
This is the small paperback format.
This is the Pengiun small paperback format.
This is the Penguin large paparback format.
This is the letter format
@since iText 5.0.6
This is the legal format
@since iText 5.0.6
This is the a4 format
@since iText 5.0.6
This method returns a Rectangle based on a String.
Possible values are the the names of a constant in this class
(for instance "A4", "LETTER",...) or a value like "595 842"
Query and change fields in existing documents either by method
calls or by FDF merging.
@author Paulo Soares
A field type invalid or not found.
A field type.
A field type.
A field type.
A field type.
A field type.
A field type.
A field type.
Holds value of property generateAppearances.
Gets the list of appearance names. Use it to get the names allowed
with radio and checkbox fields. If the /Opt key exists the values will
also be included. The name 'Off' may also be valid
even if not returned in the list.
For Comboboxes it will return an array of display values. To extract the
export values of a Combobox, please refer to {@link AcroFields#getListOptionExport(String)}
@param fieldName the fully qualified field name
@return the list of names or null
if the field does not exist
Gets the list of export option values from fields of type list or combo.
If the field doesn't exist or the field type is not list or combo it will return
null
.
@param fieldName the field name
@return the list of export option values from fields of type list or combo
Gets the list of display option values from fields of type list or combo.
If the field doesn't exist or the field type is not list or combo it will return
null
.
@param fieldName the field name
@return the list of export option values from fields of type list or combo
Export the fields as a FDF.
@param writer the FDF writer
Renames a field. Only the last part of the name can be renamed. For example,
if the original field is "ab.cd.ef" only the "ef" part can be renamed.
@param oldName the old field name
@param newName the new field name
@return true
if the renaming was successful, false
otherwise
Retrieve the rich value for the given field
@param name
@return The rich value if present, or null.
@since 5.0.6
Gets the field value.
@param name the fully qualified field name
@return the field value
Gets the field values of a Choice field.
@param name the fully qualified field name
@return the field value
@since 2.1.3
Merges an XML data structure into this form.
@param n the top node of the data structure
@throws java.io.IOException on error
@throws com.lowagie.text.DocumentException o error
Sets the fields by FDF merging.
@param fdf the FDF form
@throws IOException on error
@throws DocumentException on error
Sets the fields by XFDF merging.
@param xfdf the XFDF form
@throws IOException on error
@throws DocumentException on error
Regenerates the field appearance.
This is usefull when you change a field property, but not its value,
for instance form.SetFieldProperty("f", "bgcolor", BaseColor.BLUE, null);
This won't have any effect, unless you use RegenerateField("f") after changing
the property.
@param name the fully qualified field name or the partial name in the case of XFA forms
@throws IOException on error
@throws DocumentException on error
@return true
if the field was found and changed,
false
otherwise
Sets the field value.
@param name the fully qualified field name or the partial name in the case of XFA forms
@param value the field value
@throws IOException on error
@throws DocumentException on error
@return true
if the field was found and changed,
false
otherwise
Sets the field value.
@param name the fully qualified field name or the partial name in the case of XFA forms
@param value the field value
@param saveAppearance save the current appearance of the field or not
@throws IOException on error
@throws DocumentException on error
@return true
if the field was found and changed,
false
otherwise
Sets the rich value for the given field. See PDF Reference chapter
12.7.3.4 (Rich Text) and 12.7.4.3 (Text Fields) for further details. Note that iText doesn't create an appearance for Rich Text fields.
So you either need to use XML Worker to create an appearance (/N entry in the /AP dictionary), or you need to use setGenerateAppearances(false) to tell the viewer
that iText didn't create any appearances.
@param name Field name
@param richValue html markup
@return success/failure (will fail if the field isn't found, isn't a text field, or doesn't support rich text)
@throws DocumentException
@throws IOException
@since 5.0.6
Sets the field value and the display string. The display string
is used to build the appearance in the cases where the value
is modified by Acrobat with JavaScript and the algorithm is
known.
@param name the fully qualified field name or the partial name in the case of XFA forms
@param value the field value
@param display the string that is used for the appearance. If null
the value
parameter will be used
@return true
if the field was found and changed,
false
otherwise
@throws IOException on error
@throws DocumentException on error
Sets the field value and the display string. The display string
is used to build the appearance in the cases where the value
is modified by Acrobat with JavaScript and the algorithm is
known.
@param name the fully qualified field name or the partial name in the case of XFA forms
@param value the field value
@param display the string that is used for the appearance. If null
the value
parameter will be used
@param saveAppearance save the current appearance of the field or not
@return true
if the field was found and changed,
false
otherwise
@throws IOException on error
@throws DocumentException on error
Sets different values in a list selection.
No appearance is generated yet; nor does the code check if multiple select is allowed.
@param name the name of the field
@param value an array with values that need to be selected
@return true only if the field value was changed
@since 2.1.4
Gets the field structure.
@param name the name of the field
@return the field structure or null
if the field
does not exist
Gets the long XFA translated name.
@param name the name of the field
@return the long field name
Gets the field box positions in the document. The return is an array of float
multiple of 5. For each of this groups the values are: [page, llx, lly, urx,
ury]. The coordinates have the page rotation in consideration.
@param name the field name
@return the positions or null
if field does not exist
Removes all the fields from page
.
@param page the page to remove the fields from
@return true
if any field was removed, false otherwise
Removes a field from the document. If page equals -1 all the fields with this
name
are removed from the document otherwise only the fields in
that particular page are removed.
@param name the field name
@param page the page to remove the field from or -1 to remove it from all the pages
@return true
if the field exists, false otherwise
Removes a field from the document.
@param name the field name
@return true
if the field exists, false otherwise
Clears a signed field.
@param name the field name
@return true if the field was signed, false if the field was not signed or not found
@since 5.0.5
Gets the field names that have signatures and are signed.
@return the field names that have signatures and are signed
Gets the field names that have blank signatures.
@return the field names that have blank signatures
Gets the signature dictionary, the one keyed by /V.
@param name the field name
@return the signature dictionary keyed by /V or null
if the field is not
a signature
Gets a reference to the normal appearance of a field.
@param name the field name
@return a reference to the /N entry of the /AP dictionary or null
if the field is not found
Checks is the signature covers the entire document or just part of it.
@param name the signature field name
@return true
if the signature covers the entire document,
false
otherwise
Gets this field
revision.
@param field the signature field name
@return the revision or zero if it's not a signature field
Extracts a revision from the document.
@param field the signature field name
@return an Stream
covering the revision. Returns null
if
it's not a signature field
@throws IOException on error
Sets extra margins in text fields to better mimic the Acrobat layout.
@param extraMarginLeft the extra marging left
@param extraMarginTop the extra margin top
Adds a substitution font to the list. The fonts in this list will be used if the original
font doesn't contain the needed glyphs.
@param font the font
Holds value of property fieldCache.
Removes the XFA stream from the document.
Creates a new pushbutton from an existing field. If there are several pushbuttons with the same name
only the first one is used. This pushbutton can be changed and be used to replace
an existing one, with the same name or other name, as long is it is in the same document. To replace an existing pushbutton
call {@link #replacePushbuttonField(String,PdfFormField)}.
@param field the field name that should be a pushbutton
@return a new pushbutton or null
if the field is not a pushbutton
Creates a new pushbutton from an existing field. This pushbutton can be changed and be used to replace
an existing one, with the same name or other name, as long is it is in the same document. To replace an existing pushbutton
call {@link #replacePushbuttonField(String,PdfFormField,int)}.
@param field the field name that should be a pushbutton
@param order the field order in fields with same name
@return a new pushbutton or null
if the field is not a pushbutton
Replaces the first field with a new pushbutton. The pushbutton can be created with
{@link #getNewPushbuttonFromField(String)} from the same document or it can be a
generic PdfFormField of the type pushbutton.
@param field the field name
@param button the PdfFormField
representing the pushbutton
@return true
if the field was replaced, false
if the field
was not a pushbutton
Replaces the designated field with a new pushbutton. The pushbutton can be created with
{@link #getNewPushbuttonFromField(String,int)} from the same document or it can be a
generic PdfFormField of the type pushbutton.
@param field the field name
@param button the PdfFormField
representing the pushbutton
@param order the field order in fields with same name
@return true
if the field was replaced, false
if the field
was not a pushbutton
Checks whether a name exists as a signature field or not. It checks both signed fields and blank signatures.
@param name String
@return boolean does the signature field exist
@since 5.5.1
Gets all the fields. The fields are keyed by the fully qualified field name and
the value is an instance of AcroFields.Item
.
@return all the fields
Sets the option to generate appearances. Not generating apperances
will speed-up form filling but the results can be
unexpected in Acrobat. Don't use it unless your environment is well
controlled. The default is true
.
@param generateAppearances the option to generate appearances
Gets the total number of revisions this document has.
@return the total number of revisions
Sets a list of substitution fonts. The list is composed of BaseFont
and can also be null
. The fonts in this list will be used if the original
font doesn't contain the needed glyphs.
@param substitutionFonts the list
Gets the XFA form processor.
@return the XFA form processor
The field representations for retrieval and modification.
writeToAll
constant.
@since 2.1.5
writeToAll
and markUsed
constant.
@since 2.1.5
writeToAll
and markUsed
constant.
@since 2.1.5
This function writes the given key/value pair to all the instances
of merged, widget, and/or value, depending on the writeFlags
setting
@since 2.1.5
@param key you'll never guess what this is for.
@param value if value is null, the key will be removed
@param writeFlags ORed together WRITE_* flags
Mark all the item dictionaries used matching the given flags
@since 2.1.5
@param writeFlags WRITE_MERGED is ignored
An array of PdfDictionary
where the value tag /V
is present.
An array of PdfDictionary
with the widgets.
An array of PdfDictionary
with the widget references.
An array of PdfDictionary
with all the field
and widget tags merged.
An array of Integer
with the page numbers where
the widgets are displayed.
An array of Integer
with the tab order of the field in the page.
Remove the given instance from this item. It is possible to
remove all instances using this function.
@since 2.1.5
@param killIdx
Retrieve the value dictionary of the given instance
@since 2.1.5
@param idx instance index
@return dictionary storing this instance's value. It may be shared across instances.
Add a value dict to this Item
@since 2.1.5
@param value new value dictionary
Retrieve the widget dictionary of the given instance
@since 2.1.5
@param idx instance index
@return The dictionary found in the appropriate page's Annot array.
Add a widget dict to this Item
@since 2.1.5
@param widget
Retrieve the reference to the given instance
@since 2.1.5
@param idx instance index
@return reference to the given field instance
Add a widget ref to this Item
@since 2.1.5
@param widgRef
Retrieve the merged dictionary for the given instance. The merged
dictionary contains all the keys present in parent fields, though they
may have been overwritten (or modified?) by children.
Example: a merged radio field dict will contain /V
@since 2.1.5
@param idx instance index
@return the merged dictionary for the given instance
Adds a merged dictionary to this Item.
@since 2.1.5
@param mergeDict
Retrieve the page number of the given instance
@since 2.1.5
@param idx
@return remember, pages are "1-indexed", not "0-indexed" like field instances.
Adds a page to the current Item.
@since 2.1.5
@param pg
forces a page value into the Item.
@since 2.1.5
@param idx
Gets the tabOrder.
@since 2.1.5
@param idx
@return tab index of the given field instance
Adds a tab order value to this Item.
@since 2.1.5
@param order
Preferred method of determining the number of instances
of a given field.
@since 2.1.5
@return number of instances
A class representing a field position
@since 5.0.2
@author Paulo Soares
Constructs an extended color of a certain type and a certain color.
@param type
@param red
@param green
@param blue
@param alpha
Shape arabic characters. This code was inspired by an LGPL'ed C library:
Pango ( see http://www.pango.com/ ). Note that the code of this is the
original work of Paulo Soares. Hence it is perfectly justifiable to distribute
it under the MPL.
@author Paulo Soares
Digit shaping option: Replace European digits (U+0030...U+0039) by Arabic-Indic digits.
Digit shaping option: Replace Arabic-Indic digits by European digits (U+0030...U+0039).
Digit shaping option:
Replace European digits (U+0030...U+0039) by Arabic-Indic digits
if the most recent strongly directional character
is an Arabic letter (its Bidi direction value is RIGHT_TO_LEFT_ARABIC).
The initial state at the start of the text is assumed to be not an Arabic,
letter, so European digits at the start of the text will not change.
Compare to DIGITS_ALEN2AN_INIT_AL.
Digit shaping option:
Replace European digits (U+0030...U+0039) by Arabic-Indic digits
if the most recent strongly directional character
is an Arabic letter (its Bidi direction value is RIGHT_TO_LEFT_ARABIC).
The initial state at the start of the text is assumed to be an Arabic,
letter, so European digits at the start of the text will change.
Compare to DIGITS_ALEN2AN_INT_LR.
Not a valid option value.
Bit mask for digit shaping options.
Digit type option: Use Arabic-Indic digits (U+0660...U+0669).
Digit type option: Use Eastern (Extended) Arabic-Indic digits (U+06f0...U+06f9).
Bit mask for digit type options.
Some fonts do not implement ligaturized variations on Arabic characters
e.g. Simplified Arabic has got code point 0xFEED but not 0xFEEE
Arabic is written from right to left.
@return true
@see com.itextpdf.text.pdf.languages.LanguageProcessor#isRTL()
Signals that a bad PDF format has been used to construct a PdfObject
.
@see PdfException
@see PdfBoolean
@see PdfNumber
@see PdfString
@see PdfName
@see PdfDictionary
@see PdfFont
Base class containing properties and methods commom to all
barcode types.
@author Paulo Soares
A type of barcode
A type of barcode
A type of barcode
A type of barcode
A type of barcode
A type of barcode
A type of barcode
A type of barcode
A type of barcode
A type of barcode
A type of barcode
A type of barcode
The minimum bar width.
The bar multiplier for wide bars or the distance between
bars for Postnet and Planet.
The text font. null
if no text.
The size of the text or the height of the shorter bar
in Postnet.
If positive, the text distance under the bars. If zero or negative,
the text distance above the bars.
The height of the bars.
The text Element. Can be Element.ALIGN_LEFT
,
Element.ALIGN_CENTER
or Element.ALIGN_RIGHT
.
The optional checksum generation.
Shows the generated checksum in the the text.
Show the start and stop character '*' in the text for
the barcode 39 or 'ABCD' for codabar.
Generates extended barcode 39.
The code to generate.
Show the guard bars for barcode EAN.
The code type.
The ink spreading.
Creates a template with the barcode.
@param cb the PdfContentByte
to create the template. It
serves no other use
@param barColor the color of the bars. It can be null
@param textColor the color of the text. It can be null
@return the template
@see #placeBarcode(PdfContentByte cb, BaseColor barColor, BaseColor textColor)
Creates an Image
with the barcode.
@param cb the PdfContentByte
to create the Image
. It
serves no other use
@param barColor the color of the bars. It can be null
@param textColor the color of the text. It can be null
@return the Image
@see #placeBarcode(PdfContentByte cb, BaseColor barColor, BaseColor textColor)
The alternate text to be used, if present.
Gets the minimum bar width.
@return the minimum bar width
Gets the bar multiplier for wide bars.
@return the bar multiplier for wide bars
Gets the text font. null
if no text.
@return the text font. null
if no text
Gets the size of the text.
@return the size of the text
Gets the text baseline.
If positive, the text distance under the bars. If zero or negative,
the text distance above the bars.
@return the baseline.
Gets the height of the bars.
@return the height of the bars
Gets the text Element. Can be Element.ALIGN_LEFT
,
Element.ALIGN_CENTER
or Element.ALIGN_RIGHT
.
@return the text alignment
The property for the optional checksum generation.
Sets the property to show the generated checksum in the the text.
@param checksumText new value of property checksumText
Gets the property to show the start and stop character '*' in the text for
the barcode 39.
@param startStopText new value of property startStopText
Sets the property to generate extended barcode 39.
@param extended new value of property extended
Gets the code to generate.
@return the code to generate
Sets the property to show the guard bars for barcode EAN.
@param guardBars new value of property guardBars
Gets the code type.
@return the code type
Gets the maximum area that the barcode and the text, if
any, will occupy. The lower left corner is always (0, 0).
@return the size the barcode occupies.
Sets the alternate text. If present, this text will be used instead of the
text derived from the supplied code.
@param altText the alternate text
The charset code change.
The charset code change.
The charset code change.
The code for UCC/EAN-128.
The start code.
The start code.
The start code.
The bars to generate the code.
The stop bars.
Creates new Barcode128
Removes the FNC1 codes in the text.
@param code the text to clean
@return the cleaned text
Gets the human readable text of a sequence of AI.
@param code the text
@return the human readable text
Returns true
if the next numDigits
starting from index textIndex
are numeric skipping any FNC1.
@param text the text to check
@param textIndex where to check from
@param numDigits the number of digits to check
@return the check result
Packs the digits for charset C also considering FNC1. It assumes that all the parameters
are valid.
@param text the text to pack
@param textIndex where to pack from
@param numDigits the number of digits to pack. It is always an even number
@return the packed digits, two digits per character
Converts the human readable text to the characters needed to
create a barcode using the specified code set.
@param text the text to convert
@param ucc true
if it is an UCC/EAN-128. In this case
the character FNC1 is added
@param codeSet forced code set, or AUTO for optimized barcode.
@return the code ready to be fed to getBarsCode128Raw()
Converts the human readable text to the characters needed to
create a barcode. Some optimization is done to get the shortest code.
@param text the text to convert
@param ucc true
if it is an UCC/EAN-128. In this case
the character FNC1 is added
@return the code ready to be fed to getBarsCode128Raw()
Generates the bars. The input has the actual barcodes, not
the human readable text.
@param text the barcode
@return the bars
Gets the maximum area that the barcode and the text, if
any, will occupy. The lower left corner is always (0, 0).
@return the size the barcode occupies.
Implements the code 39 and code 39 extended. The default parameters are:
x = 0.8f;
n = 2;
font = BaseFont.CreateFont("Helvetica", "winansi", false);
size = 8;
baseline = size;
barHeight = size * 3;
textint= Element.ALIGN_CENTER;
generateChecksum = false;
checksumText = false;
startStopText = true;
extended = false;
@author Paulo Soares
The index chars to BARS
.
The character combinations to make the code 39 extended.
The bars to generate the code.
Creates a new Barcode39.
Creates the bars.
@param text the text to create the bars. This text does not include the start and
stop characters
@return the bars
Converts the extended text into a normal, escaped text,
ready to generate bars.
@param text the extended text
@return the escaped text
Calculates the checksum.
@param text the text
@return the checksum
Gets the maximum area that the barcode and the text, if
any, will occupy. The lower left corner is always (0, 0).
@return the size the barcode occupies.
Implements the code codabar. The default parameters are:
x = 0.8f;
n = 2;
font = BaseFont.CreateFont("Helvetica", "winansi", false);
size = 8;
baseline = size;
barHeight = size * 3;
textAlignment = Element.ALIGN_CENTER;
generateChecksum = false;
checksumText = false;
startStopText = false;
@author Paulo Soares
The index chars to BARS
.
The bars to generate the code.
Creates a new BarcodeCodabar.
Creates the bars.
@param text the text to create the bars
@return the bars
Gets the maximum area that the barcode and the text, if
any, will occupy. The lower left corner is always (0, 0).
@return the size the barcode occupies.
No error.
The text is too big for the symbology capabilities.
The dimensions given for the symbol are illegal.
An error while parsing an extension.
The best encodation will be used.
ASCII encodation.
C40 encodation.
TEXT encodation.
Binary encodation.
X21 encodation.
X12 encodation.
@deprecated Use {@link BarcodeDataMatrix#DM_X12} instead.
EDIFACT encodation.
No encodation needed. The bytes provided are already encoded.
Allows extensions to be embedded at the start of the text.
Doesn't generate the image but returns all the other information.
Creates an instance of this class.
Gets an Image
with the barcode. A successful call to the method generate()
before calling this method is required.
@return the barcode Image
@throws BadElementException on error
Creates a java.awt.Image
. A successful call to the method generate()
before calling this method is required.
@param foreground the color of the bars
@param background the color of the background
@return the image
Gets the generated image. The image is represented as a stream of bytes, each byte representing
8 pixels, 0 for white and 1 for black, with the high-order bit of each byte first. Each row
is aligned at byte boundaries. The dimensions of the image are defined by height and width
plus 2 * ws.
@return the generated image
Gets/sets the whitespace border around the barcode.
@param ws the whitespace border around the barcode
Generates barcodes in several formats: EAN13, EAN8, UPCA, UPCE,
supplemental 2 and 5. The default parameters are:
x = 0.8f;
font = BaseFont.CreateFont("Helvetica", "winansi", false);
size = 8;
baseline = size;
barHeight = size * 3;
guardBars = true;
codeType = EAN13;
code = "";
@author Paulo Soares
The total number of bars for EAN13.
The total number of bars for EAN8.
The total number of bars for UPCE.
The total number of bars for supplemental 2.
The total number of bars for supplemental 5.
Marker for odd parity.
Marker for even parity.
The bar positions that are guard bars.
The bar positions that are guard bars.
The bar positions that are guard bars.
The bar positions that are guard bars.
The bar positions that are guard bars.
The x coordinates to place the text.
The x coordinates to place the text.
The basic bar widths.
Sequence of parities to be used with EAN13.
Sequence of parities to be used with supplemental 2.
Sequence of parities to be used with supplemental 2.
Sequence of parities to be used with UPCE.
Creates new BarcodeEAN
Calculates the EAN parity character.
@param code the code
@return the parity character
Converts an UPCA code into an UPCE code. If the code can not
be converted a null
is returned.
@param text the code to convert. It must have 12 numeric characters
@return the 8 converted digits or null
if the
code could not be converted
Creates the bars for the barcode EAN13 and UPCA.
@param _code the text with 13 digits
@return the barcode
Creates the bars for the barcode EAN8.
@param _code the text with 8 digits
@return the barcode
Creates the bars for the barcode UPCE.
@param _code the text with 8 digits
@return the barcode
Creates the bars for the barcode supplemental 2.
@param _code the text with 2 digits
@return the barcode
Creates the bars for the barcode supplemental 5.
@param _code the text with 5 digits
@return the barcode
Gets the maximum area that the barcode and the text, if
any, will occupy. The lower left corner is always (0, 0).
@return the size the barcode occupies.
The barcode with the EAN/UPC.
The barcode with the supplemental.
Creates new combined barcode.
@param ean the EAN/UPC barcode
@param supp the supplemental barcode
Gets the maximum area that the barcode and the text, if
any, will occupy. The lower left corner is always (0, 0).
@return the size the barcode occupies.
Implements the code interleaved 2 of 5. The text can include
non numeric characters that are printed but do not generate bars.
The default parameters are:
x = 0.8f;
n = 2;
font = BaseFont.CreateFont("Helvetica", "winansi", false);
size = 8;
baseline = size;
barHeight = size * 3;
textint= Element.ALIGN_CENTER;
generateChecksum = false;
checksumText = false;
@author Paulo Soares
The bars to generate the code.
Creates new BarcodeInter25
Deletes all the non numeric characters from text
.
@param text the text
@return a string
with only numeric characters
Calculates the checksum.
@param text the numeric text
@return the checksum
Creates the bars for the barcode.
@param text the text. It can contain non numeric characters
@return the barcode
Gets the maximum area that the barcode and the text, if
any, will occupy. The lower left corner is always (0, 0).
@return the size the barcode occupies.
Generates the 2D barcode PDF417. Supports dimensioning auto-sizing, fixed
and variable sizes, automatic and manual error levels, raw codeword input,
codeword size optimization and bitmap inversion. The output can
be a CCITT G4 Image
or a raw bitmap.
@author Paulo Soares
Auto-size is made based on aspectRatio
and yHeight
.
The size of the barcode will be at least codeColumns*codeRows
.
The size will be at least codeColumns
with a variable number of codeRows
.
The size will be at least codeRows
with a variable number of codeColumns
.
The error level correction is set automatically according
to ISO 15438 recomendations.
The error level correction is set by the user. It can be 0 to 8.
One single binary segment is used
No text
interpretation is done and the content of codewords
is used directly.
Inverts the output bits of the raw bitmap that is normally
bit one for black. It has only effect for the raw bitmap.
Use Macro PDF417 Encoding
@see #setMacroFileId(String)
@see #setMacroSegmentId(int)
@see #setMacroSegmentCount(int)
Creates a new BarcodePDF417
with the default settings.
Set the default settings that correspond to PDF417_USE_ASPECT_RATIO
and PDF417_AUTO_ERROR_LEVEL
.
Paints the barcode. If no exception was thrown a valid barcode is available.
Gets an Image
with the barcode. The image will have to be
scaled in the Y direction by yHeight
for the barcode
to have the right printing aspect.
@return the barcode Image
@throws BadElementException on error
Sets the text that will form the barcode. This text is converted
to bytes using the encoding Cp437.
@param s the text that will form the barcode
@throws UnsupportedEncodingException if the encoding Cp437 is not supported
Holds value of property outBits.
Holds value of property bitColumns.
Holds value of property codeRows.
Holds value of property codeColumns.
Holds value of property codewords.
Holds value of property lenCodewords.
Holds value of property errorLevel.
Holds value of property text.
Holds value of property options.
Holds value of property aspectRatio.
Holds value of property yHeight.
Gets the size of the barcode grid.
Sets the segment id for macro PDF417 encoding
@param id the id (starting at 0)
@see #setMacroSegmentCount(int)
Sets the segment count for macro PDF417 encoding
@param cnt the number of macro segments
@see #setMacroSegmentId(int)
Sets the File ID for macro PDF417 encoding
@param id the file id
Gets the raw image bits of the barcode. The image will have to
be scaled in the Y direction by yHeight
.
@return The raw barcode image
Gets the number of X pixels of outBits
.
@return the number of X pixels of outBits
Gets the number of Y pixels of outBits
.
It is also the number of rows in the barcode.
@return the number of Y pixels of outBits
Sets the number of barcode rows. This number may be changed
to keep the barcode valid.
@param codeRows the number of barcode rows
Sets the number of barcode data columns.
This number may be changed to keep the barcode valid.
@param codeColumns the number of barcode data columns
Gets the codeword array. This array is always 928 elements long.
It can be writen to if the option PDF417_USE_RAW_CODEWORDS
is set.
@return the codeword array
Sets the length of the codewords.
@param lenCodewords the length of the codewords
Gets the error level correction used for the barcode. It may different
from the previously set value.
@return the error level correction used for the barcode
Sets the error level correction for the barcode.
@param errorLevel the error level correction for the barcode
Sets the bytes that form the barcode. This bytes should
be interpreted in the codepage Cp437.
@param text the bytes that form the barcode
Sets the options to generate the barcode. This can be all
the PDF417_*
constants.
@param options the options to generate the barcode
Sets the barcode aspect ratio. A ratio or 0.5 will make the
barcode width twice as large as the height.
@param aspectRatio the barcode aspect ratio
Sets the Y pixel height relative to X. It is usually 3.
@param yHeight the Y pixel height relative to X
Implements the Postnet and Planet barcodes. The default parameters are:
n = 72f / 22f; // distance between bars
x = 0.02f * 72f; // bar width
barHeight = 0.125f * 72f; // height of the tall bars
size = 0.05f * 72f; // height of the short bars
codeType = POSTNET; // type of code
@author Paulo Soares
The bars for each character.
Creates new BarcodePostnet
Creates the bars for Postnet.
@param text the code to be created without checksum
@return the bars
Gets the maximum area that the barcode and the text, if
any, will occupy. The lower left corner is always (0, 0).
@return the size the barcode occupies.
A QRCode implementation based on the zxing code.
@author Paulo Soares
@since 5.0.2
Creates the QR barcode. The barcode is always created with the smallest possible size and is then stretched
to the width and height given. Set the width and height to 1 to get an unscaled barcode.
@param content the text to be encoded
@param width the barcode width
@param height the barcode height
@param hints modifiers to change the way the barcode is create. They can be EncodeHintType.ERROR_CORRECTION
and EncodeHintType.CHARACTER_SET. For EncodeHintType.ERROR_CORRECTION the values can be ErrorCorrectionLevel.L, M, Q, H.
For EncodeHintType.CHARACTER_SET the values are strings and can be Cp437, Shift_JIS and ISO-8859-1 to ISO-8859-16.
You can also use UTF-8, but correct behaviour is not guaranteed as Unicode is not supported in QRCodes.
The default value is ISO-8859-1.
@throws WriterException
Gets an Image
with the barcode.
@return the barcode Image
@throws BadElementException on error
Gets the size of the barcode grid.
A thin border with 1 point width.
A medium border with 2 point width.
A thick border with 3 point width.
The field is visible.
The field is hidden.
The field is visible but does not print.
The field is hidden but is printable.
The user may not change the value of the field.
The field must have a value at the time it is exported by a submit-form
action.
The field may contain multiple lines of text.
This flag is only meaningful with text fields.
The field will not scroll (horizontally for single-line
fields, vertically for multiple-line fields) to accommodate more text
than will fit within its annotation rectangle. Once the field is full, no
further text will be accepted.
The field is intended for entering a secure password that should
not be echoed visibly to the screen.
The text entered in the field represents the pathname of
a file whose contents are to be submitted as the value of the field.
The text entered in the field will not be spell-checked.
This flag is meaningful only in text fields and in combo
fields with the EDIT
flag set.
If set the combo box includes an editable text box as well as a drop list; if
clear, it includes only a drop list.
This flag is only meaningful with combo fields.
whether or not a list may have multiple selections. Only applies to /CH LIST
fields, not combo boxes.
combo box flag.
Holds value of property rotation.
Holds value of property visibility.
Holds value of property fieldName.
Holds value of property options.
Holds value of property maxCharacterLength.
Creates a new TextField
.
@param writer the document PdfWriter
@param box the field location and dimensions
@param fieldName the field name. If null
only the widget keys
will be included in the field allowing it to be used as a kid field.
Convenience method to set the field rotation the same as the
page rotation.
@param page the page
Moves the field keys from from
to to
. The moved keys
are removed from from
.
@param from the source
@param to the destination. It may be null
Sets the border width in points. To eliminate the border
set the border color to null
.
@param borderWidth the border width in points
Sets the border style. The styles are found in PdfBorderDictionary
and can be STYLE_SOLID
, STYLE_DASHED
,
STYLE_BEVELED
, STYLE_INSET
and
STYLE_UNDERLINE
.
@param borderStyle the border style
Sets the border color. Set to null
to remove
the border.
@param borderColor the border color
Sets the background color. Set to null
for
transparent background.
@param backgroundColor the background color
Sets the text color. If null
the color used
will be black.
@param textColor the text color
Sets the text font. If null
then Helvetica
will be used.
@param font the text font
Sets the font size. If 0 then auto-sizing will be used but
only for text fields.
@param fontSize the font size
Sets the text horizontal alignment. It can be Element.ALIGN_LEFT
,
Element.ALIGN_CENTER
and Element.ALIGN_RIGHT
.
@param alignment the text horizontal alignment
Sets the text for text fields.
@param text the text
Sets the field dimension and position.
@param box the field dimension and position
Sets the field rotation. This value should be the same as
the page rotation where the field will be shown.
@param rotation the field rotation
Sets the field visibility flag. This flags can be one of
VISIBLE
, HIDDEN
, VISIBLE_BUT_DOES_NOT_PRINT
and HIDDEN_BUT_PRINTABLE
.
@param visibility field visibility flag
Sets the field name.
@param fieldName the field name. If null
only the widget keys
will be included in the field allowing it to be used as a kid field.
Sets the option flags. The option flags can be a combination by oring of
READ_ONLY
, REQUIRED
,
MULTILINE
, DO_NOT_SCROLL
,
PASSWORD
, FILE_SELECTION
,
DO_NOT_SPELL_CHECK
and EDIT
.
@param options the option flags
Sets the maximum length of the field�s text, in characters.
It is only meaningful for text fields.
@param maxCharacterLength the maximum length of the field�s text, in characters
Summary description for BaseFont.
This is a possible value of a base 14 type 1 font
This is a possible value of a base 14 type 1 font
This is a possible value of a base 14 type 1 font
This is a possible value of a base 14 type 1 font
This is a possible value of a base 14 type 1 font
This is a possible value of a base 14 type 1 font
This is a possible value of a base 14 type 1 font
This is a possible value of a base 14 type 1 font
This is a possible value of a base 14 type 1 font
This is a possible value of a base 14 type 1 font
This is a possible value of a base 14 type 1 font
This is a possible value of a base 14 type 1 font
This is a possible value of a base 14 type 1 font
This is a possible value of a base 14 type 1 font
The maximum height above the baseline reached by glyphs in this
font, excluding the height of glyphs for accented characters.
The y coordinate of the top of flat capital letters, measured from
the baseline.
The maximum depth below the baseline reached by glyphs in this
font. The value is a negative number.
The angle, expressed in degrees counterclockwise from the vertical,
of the dominant vertical strokes of the font. The value is
negative for fonts that slope to the right, as almost all italic fonts do.
The lower left x glyph coordinate.
The lower left y glyph coordinate.
The upper right x glyph coordinate.
The upper right y glyph coordinate.
java.awt.Font property
java.awt.Font property
java.awt.Font property
java.awt.Font property
The underline position. Usually a negative value.
The underline thickness.
The strikethrough position.
The strikethrough thickness.
The recommended vertical size for subscripts for this font.
The recommended vertical offset from the baseline for subscripts for this font. Usually a negative value.
The recommended vertical size for superscripts for this font.
The recommended vertical offset from the baseline for superscripts for this font.
The weight class of the font, as defined by the font author
@since 5.0.2
The width class of the font, as defined by the font author
@since 5.0.2
The entry of PDF FontDescriptor dictionary.
(Optional; PDF 1.5; strongly recommended for Type 3 fonts in Tagged PDF documents)
The weight (thickness) component of the fully-qualified font name or font specifier.
A value larger than 500 indicates bold font-weight.
The font is Type 1.
The font is True Type with a standard encoding.
The font is CJK.
The font is True Type with a Unicode encoding.
A font already inside the document.
A Type3 font.
The Unicode encoding with horizontal writing.
The Unicode encoding with vertical writing.
A possible encoding.
A possible encoding.
A possible encoding.
A possible encoding.
A possible encoding.
if the font has to be embedded
if the font doesn't have to be embedded
if the font has to be cached
if the font doesn't have to be cached
The path to the font resources.
The fake CID code that represents a newline.
* Unicode Character 'PARAGRAPH SEPARATOR' (U+2029)
* Treated as a line feed character in XFA rich and plain text.
* @since 5.4.3
a not defined character in a custom PDF encoding
default array of six numbers specifying the font matrix, mapping glyph space to text space
The font type.
table of characters widths for this encoding
encoding names
same as differences but with the unicode codes
encoding used with this font
true if the font is to be embedded in the PDF
The compression level for the font stream.
@since 2.1.3
true if the font must use its built in encoding. In that case the
encoding
is only used to map a char to the position inside
the font, not to the expected char name.
cache for the fonts already used.
list of the 14 built in fonts.
Forces the output of the width array. Only matters for the 14
built-in fonts.
Converts char
directly to byte
by casting.
Indicates if all the glyphs and widths for that particular
encoding should be included in the document.
Custom encodings use this map to key the Unicode character
to the single byte code.
Creates new BaseFont
Creates a new font. This will always be the default Helvetica font (not embedded).
This method is introduced because Helvetica is used in many examples.
@return a BaseFont object (Helvetica, Winansi, not embedded)
@throws IOException This shouldn't occur ever
@throws DocumentException This shouldn't occur ever
@since 2.1.1
Creates a font based on an existing document font. The created font font may not
behave as expected, depending on the encoding or subset.
@param fontRef the reference to the document font
@return the font
Indicates whether the font is used for verticl writing or not.
@return true
if the writing mode is vertical for the given font, false
otherwise.
Gets the name without the modifiers Bold, Italic or BoldItalic.
@param name the full name of the font
@return the name without the modifiers Bold, Italic or BoldItalic
Normalize the encoding names. "winansi" is changed to "Cp1252" and
"macroman" is changed to "MacRoman".
@param enc the encoding to be normalized
@return the normalized encoding
Creates the widths
and the differences
arrays
@throws UnsupportedEncodingException the encoding is not supported
Gets the width from the font according to the Unicode char c
or the name
. If the name
is null it's a symbolic font.
@param c the unicode char
@param name the glyph name
@return the width of the char
Gets the kerning between two Unicode chars.
@param char1 the first char
@param char2 the second char
@return the kerning to be applied
Sets the kerning between two Unicode chars.
@param char1 the first char
@param char2 the second char
@param kern the kerning to apply in normalized 1000 units
@return true
if the kerning was applied, false
otherwise
Gets the width of a char
in normalized 1000 units.
@param char1 the unicode char
to get the width of
@return the width in normalized 1000 units
Gets the width of a string
in normalized 1000 units.
@param text the string
to get the witdth of
@return the width in normalized 1000 units
Gets the descent of a String
in normalized 1000 units. The descent will always be
less than or equal to zero even if all the characters have an higher descent.
@param text the String
to get the descent of
@return the dexcent in normalized 1000 units
Gets the ascent of a String
in normalized 1000 units. The ascent will always be
greater than or equal to zero even if all the characters have a lower ascent.
@param text the String
to get the ascent of
@return the ascent in normalized 1000 units
Gets the descent of a String
in points. The descent will always be
less than or equal to zero even if all the characters have an higher descent.
@param text the String
to get the descent of
@param fontSize the size of the font
@return the dexcent in points
Gets the ascent of a String
in points. The ascent will always be
greater than or equal to zero even if all the characters have a lower ascent.
@param text the String
to get the ascent of
@param fontSize the size of the font
@return the ascent in points
Gets the width of a String
in points taking kerning
into account.
@param text the String
to get the witdth of
@param fontSize the font size
@return the width in points
Gets the width of a string
in points.
@param text the string
to get the witdth of
@param fontSize the font size
@return the width in points
Gets the width of a char
in points.
@param char1 the char
to get the witdth of
@param fontSize the font size
@return the width in points
Outputs to the writer the font dictionaries and streams.
@param writer the writer for this document
@param ref the font indirect reference
@param params several parameters that depend on the font type
@throws IOException on error
@throws DocumentException error in generating the object
Returns a PdfStream object with the full font program (if possible).
This method will return null for some types of fonts (CJKFont, Type3Font)
or if there is no font program available (standard Type 1 fonts).
@return a PdfStream with the font program
@since 2.1.3
Gets the font parameter identified by key
. Valid values
for key
are ASCENT
, CAPHEIGHT
, DESCENT
,
ITALICANGLE
, BBOXLLX
, BBOXLLY
, BBOXURX
and BBOXURY
.
@param key the parameter to be extracted
@param fontSize the font size in points
@return the parameter in points
Sets the font parameter identified by key
. Valid values
for key
are ASCENT
, CAPHEIGHT
, DESCENT
,
ITALICANGLE
, BBOXLLX
, BBOXLLY
, BBOXURX
and BBOXURY
.
@param key the parameter to be updated
@param value the parameter value
Gets the embedded flag.
@return true
if the font is embedded.
Gets the symbolic flag of the font.
@return true
if the font is symbolic
Creates a unique subset prefix to be added to the font name when the font is embedded and subset.
@return the subset prefix
Gets the Unicode character corresponding to the byte output to the pdf stream.
@param index the byte index
@return the Unicode character
Gets all the names from the font. Only the required tables are read.
@param name the name of the font
@param encoding the encoding of the font
@param ttfAfm the true type font or the afm in a byte array
@throws DocumentException on error
@throws IOException on error
@return an array of Object[] built with {getPostscriptFontName(), GetFamilyFontName(), GetFullFontName()}
Gets all the entries of the namestable from the font. Only the required tables are read.
@param name the name of the font
@param encoding the encoding of the font
@param ttfAfm the true type font or the afm in a byte array
@throws DocumentException on error
@throws IOException on error
@return an array of Object[] built with {getPostscriptFontName(), getFamilyFontName(), getFullFontName()}
Enumerates the postscript font names present inside a
True Type Collection.
@param ttcFile the file name of the font
@throws DocumentException on error
@throws IOException on error
@return the postscript font names
Enumerates the postscript font names present inside a
True Type Collection.
@param ttcArray the font as a byte
array
@throws DocumentException on error
@throws IOException on error
@return the postscript font names
Gets the CID code given an Unicode.
It has only meaning with CJK fonts.
@param c the Unicode
@return the CID equivalent
Checks if the font has any kerning pairs.
@return true
if the font has any kerning pairs
Checks if a character exists in this font.
@param c the character to check
@return true
if the character has a glyph,
false
otherwise
Sets the character advance.
@param c the character
@param advance the character advance normalized to 1000 units
@return true
if the advance was set,
false
otherwise
Gets a list of all document fonts. Each element of the ArrayList
contains a Object[]{String,PRIndirectReference}
with the font name
and the indirect reference to it.
@param reader the document where the fonts are to be listed from
@return the list of fonts and references
Gets a list of the document fonts in a particular page. Each element of the ArrayList
contains a Object[]{String,PRIndirectReference}
with the font name
and the indirect reference to it.
@param reader the document where the fonts are to be listed from
@param page the page to list the fonts from
@return the list of fonts and references
Gets the smallest box enclosing the character contours. It will return
null
if the font has not the information or the character has no
contours, as in the case of the space, for example. Characters with no contours may
also return [0,0,0,0].
@param c the character to get the contour bounding box from
@return an array of four floats with the bounding box in the format [llx,lly,urx,ury] or
null
Gets default array of six numbers specifying the font matrix, mapping glyph space to text space
@return an array of six values
null
iText expects Arabic Diactrics (tashkeel) to have zero advance but some fonts,
most notably those that come with Windows, like times.ttf, have non-zero
advance for those characters. This method makes those character to have zero
width advance and work correctly in the iText Arabic shaping and reordering
context.
Adds a character range when subsetting. The range is an int
array
where the first element is the start range inclusive and the second element is the
end range inclusive. Several ranges are allowed in the same array.
@param range the character range
Gets the encoding used to convert string
into byte[]
.
@return the encoding name
Gets the font type. The font types can be: FONT_TYPE_T1,
FONT_TYPE_TT, FONT_TYPE_CJK and FONT_TYPE_TTUNI.
@return the font type
Gets the postscript font name.
@return the postscript font name
Gets the code pages supported by the font. This has only meaning
with True Type fonts.
@return the code pages supported by the font
Gets the font width array.
@return the font width array
Gets the array with the names of the characters.
@return the array with the names of the characters
Gets the array with the unicode characters.
@return the array with the unicode characters
Set to true
to force the generation of the
widths array.
@param forceWidthsOutput true
to force the generation of the
widths array
Sets the conversion of char
directly to byte
by casting. This is a low level feature to put the bytes directly in
the content stream without passing through string.GetBytes().
@param directTextToByte New value of property directTextToByte.
Indicates if all the glyphs and widths for that particular
encoding should be included in the document. When set to true
only the glyphs used will be included in the font. When set to false
and {@link #addSubsetRange(int[])} was not called the full font will be included
otherwise just the characters ranges will be included.
@param subset new value of property subset
Sets the compression level to be used for the font streams.
@param compressionLevel a value between 0 (best speed) and 9 (best compression)
@since 2.1.3
Generates the PDF stream with the Type1 and Truetype fonts returning
a PdfStream.
a possible type of PdfObject
a possible type of PdfObject
a possible type of PdfObject
a possible type of PdfObject
a possible type of PdfObject
a possible type of PdfObject
a possible type of PdfObject
a possible type of PdfObject
a possible type of PdfObject
This is an empty string used for the PdfNull
-object and for an empty PdfString
-object.
This is the default encoding to be used for converting strings into bytes and vice versa.
The default encoding is PdfDocEcoding.
This is the encoding to be used to output text in Unicode.
the content of this PdfObject
the type of this PdfObject
Holds value of property indRef.
Hash code of the PdfObject instance.
Unfortunately, default C# behavior does not generate unique hash code.
Used for generating hash code.
Making hash code generation thread safe.
Constructs a PdfObject
of a certain type without any content.
@param type type of the new PdfObject
Constructs a PdfObject
of a certain type with a certain content.
@param type type of the new PdfObject
@param content content of the new PdfObject
as a String
.
Constructs a PdfObject
of a certain type with a certain content.
@param type type of the new PdfObject
@param bytes content of the new PdfObject
as an array of byte
.
Writes the PDF representation of this PdfObject
as an array of byte
s to the writer.
@param writer for backwards compatibility
@param os the outputstream to write the bytes to.
@throws IOException
Gets the presentation of this object in a byte array
@return a byte array
Can this object be in an object stream?
@return true if this object can be in an object stream.
Returns the String
-representation of this PdfObject
.
@return a String
Checks if this PdfObject
is of the type PdfNull
.
@return true
or false
Checks if this PdfObject
is of the type PdfBoolean
.
@return true
or false
Checks if this PdfObject
is of the type PdfNumber
.
@return true
or false
Checks if this PdfObject
is of the type PdfString
.
@return true
or false
Checks if this PdfObject
is of the type PdfName
.
@return true
or false
Checks if this PdfObject
is of the type PdfArray
.
@return true
or false
Checks if this PdfObject
is of the type PdfDictionary
.
@return true
or false
Checks if this PdfObject
is of the type PdfStream
.
@return true
or false
Checks if this is an indirect object.
@return true if this is an indirect object
Returns the length of the actual content of the PdfObject
.
In some cases, namely for PdfString
and PdfStream
,
this method differs from the method pdfLength
because pdfLength
returns the length of the PDF representation of the object, not of the actual content
as does the method length
.
Remark: the actual content of an object is in some cases identical to its representation.
The following statement is always true: Length() >= PdfLength().
@return a length
Changes the content of this PdfObject
.
@param content the new content of this PdfObject
Returns the type of this PdfObject
.
@return a type
This is a possible type of dictionary
This is a possible type of dictionary
This is a possible type of dictionary
This is a possible type of dictionary
This is a possible type of dictionary
This is the type of this dictionary
This is the hashmap that contains all the values and keys of the dictionary
Constructs an empty PdfDictionary
-object.
Constructs a PdfDictionary
-object of a certain type.
@param type a PdfName
Returns the PDF representation of this PdfDictionary
.
@return an array of byte
Adds a PdfObject
and its key to the PdfDictionary
.
If the value is null
or PdfNull
the key is deleted.
@param key key of the entry (a PdfName
)
@param value value of the entry (a PdfObject
)
Adds a PdfObject
and its key to the PdfDictionary
.
If the value is null it does nothing.
@param key key of the entry (a PdfName
)
@param value value of the entry (a PdfObject
)
Copies all of the mappings from the specified PdfDictionary
to this PdfDictionary
.
These mappings will replace any mappings previously contained in this
PdfDictionary
.
@param dic The PdfDictionary
with the mappings to be
copied over
Removes a PdfObject
and its key from the PdfDictionary
.
@param key key of the entry (a PdfName
)
Removes all the PdfObject
s and its keys from the
PdfDictionary
.
@since 5.0.2
Checks if a Dictionary
is of the type FONT.
@return true
if it is, false
if it isn't.
Checks if a Dictionary
is of the type PAGE.
@return true
if it is, false
if it isn't.
Checks if a Dictionary
is of the type PAGES.
@return true
if it is, false
if it isn't.
Checks if a Dictionary
is of the type CATALOG.
@return true
if it is, false
if it isn't.
Checks if a Dictionary
is of the type OUTLINES.
@return true
if it is, false
if it isn't.
Checks the type of the dictionary.
@param type the type you're looking for
@return true if the type of the dictionary corresponds with the type you're looking for
This function behaves the same as 'get', but will never return an indirect reference,
it will always look such references up and return the actual object.
@param key
@return null, or a non-indirect object
All the getAs functions will return either null, or the specified object type
This function will automatically look up indirect references. There's one obvious
exception, the one that will only return an indirect reference. All direct objects
come back as a null.
Mark A Storer (2/17/06)
@param key
@return the appropriate object in its final type, or null
A possible compression level.
@since 2.1.3
A possible compression level.
@since 2.1.3
A possible compression level.
@since 2.1.3
A possible compression level.
@since 2.1.3
is the stream compressed?
The level of compression.
@since 2.1.3
Constructs a PdfStream
-object.
@param bytes content of the new PdfObject
as an array of byte
.
Creates an efficient stream. No temporary array is ever created. The InputStream
is totally consumed but is not closed. The general usage is:
InputStream in = ...;
PdfStream stream = new PdfStream(in, writer);
stream.FlateCompress();
writer.AddToBody(stream);
stream.WriteLength();
in.Close();
@param inputStream the data to write to this stream
@param writer the PdfWriter
for this stream
Constructs a PdfStream
-object.
Writes the stream length to the PdfWriter
.
This method must be called and can only be called if the contructor {@link #PdfStream(InputStream,PdfWriter)}
is used to create the stream.
@throws IOException on error
@see #PdfStream(InputStream,PdfWriter)
Compresses the stream.
Compresses the stream.
@param compressionLevel the compression level (0 = best speed, 9 = best compression, -1 is default)
@since 2.1.3
Writes the data content to an Stream
.
@param os the destination to write to
@throws IOException on error
@see com.lowagie.text.pdf.PdfObject#toString()
Generates the PDF stream with the Type1 and Truetype fonts returning
a PdfStream.
@param contents the content of the stream
@param lengths an array of int that describes the several lengths of each part of the font
@param compressionLevel the compression level of the Stream
@throws DocumentException error in the stream compression
@since 2.1.3 (replaces the constructor without param compressionLevel)
Generates the PDF stream for a font.
@param contents the content of a stream
@param subType the subtype of the font.
@param compressionLevel the compression level of the Stream
@throws DocumentException error in the stream compression
@since 2.1.3 (replaces the constructor without param compressionLevel)
Does all the line bidirectional processing with PdfChunk assembly.
@author Paulo Soares
Creates new BidiLine
Call this after processLine() to know if any word was split into several lines.
@return
Gets the width of a range of characters.
@param startIdx the first index to calculate
@param lastIdx the last inclusive index to calculate
@return the sum of all widths
Gets the width of a range of characters.
@param startIdx the first index to calculate
@param lastIdx the last inclusive index to calculate
@param originalWidth the full width of the line. It is used in case of RTL and tab stops
@return the sum of all widths
Method that changes a String with Arabic characters into a String in which the ligatures are made.
@param s the original String
@param runDirection
@param arabicOptions
@return the String with the ligaturesc
Left-to-right
Left-to-Right Embedding
Left-to-Right Override
Right-to-Left
Right-to-Left Arabic
Right-to-Left Embedding
Right-to-Left Override
Pop Directional Format
European Number
European Number Separator
European Number Terminator
Arabic Number
Common Number Separator
Non-Spacing Mark
Boundary Neutral
Paragraph Separator
Segment Separator
Whitespace
Other Neutrals
Minimum bidi type value.
Maximum bidi type value.
Initialize using an array of direction types. Types range from TYPE_MIN to TYPE_MAX inclusive
and represent the direction codes of the characters in the text.
@param types the types array
Initialize using an array of direction types and an externally supplied paragraph embedding level.
The embedding level may be -1, 0, or 1. -1 means to apply the default algorithm (rules P2 and P3),
0 is for LTR paragraphs, and 1 is for RTL paragraphs.
@param types the types array
@param paragraphEmbeddingLevel the externally supplied paragraph embedding level.
The algorithm.
Does not include line-based processing (Rules L1, L2).
These are applied later in the line-based phase of the algorithm.
Rules X9.
Remove explicit codes so that they may be ignored during the remainder
of the main portion of the algorithm. The length of the resulting text
is returned.
@return the length of the data excluding explicit codes and BN.
Reinsert levels information for explicit codes.
This is for ease of relating the level information
to the original input data. Note that the levels
assigned to these codes are arbitrary, they're
chosen so as to avoid breaking level runs.
@param textLength the length of the data after compression
@return the length of the data (original length of
types array supplied to constructor)
2) determining explicit levels
Rules X1 - X8
The interaction of these rules makes handling them a bit complex.
This examines resultTypes but does not modify it. It returns embedding and
override information in the result array. The low 7 bits are the level, the high
bit is set if the level is an override, and clear if it is an embedding.
3) resolving weak types
Rules W1-W7.
Note that some weak types (EN, AN) remain after this processing is complete.
6) resolving neutral types
Rules N1-N2.
7) resolving implicit embedding levels
Rules I1, I2.
Return multiline reordering array for a given level array.
Reordering does not occur across a line break.
Return reordering array for a given level array. This reorders a single line.
The reordering is a visual to logical map. For example,
the leftmost char is string.CharAt(order[0]).
Rule L2.
Return the base level of the paragraph.
Return true if the type is considered a whitespace type for the line break rules.
Return the strong type (L or R) corresponding to the level.
Return the limit of the run starting at index that includes only resultTypes in validSet.
This checks the value at index, and will return index if that value is not in validSet.
Return the start of the run including index that includes only resultTypes in validSet.
This assumes the value at index is valid, and does not check it.
Set resultTypes from start up to (but not including) limit to newType.
Set resultLevels from start up to (but not including) limit to newLevel.
Throw exception if type array is invalid.
Throw exception if paragraph embedding level is invalid. Special allowance for -1 so that
default processing can still be performed when using this API.
Throw exception if line breaks array is invalid.
Acts like a StringBuilder
but works with byte
arrays.
floating point is converted to a format suitable to the PDF.
@author Paulo Soares
The count of bytes in the buffer.
The buffer where the bytes are stored.
If true
always output floating point numbers with 6 decimal digits.
If false
uses the faster, although less precise, representation.
Creates new ByteBuffer with capacity 128
Creates a byte buffer with a certain capacity.
@param size the initial capacity
You can fill the cache in advance if you want to.
@param decimals
Converts an double (multiplied by 100 and cast to an int) into an array of bytes.
@param i the int
@return a bytearray
Appends an int
. The size of the array will grow by one.
@param b the int to be appended
@return a reference to this ByteBuffer
object
Appends the subarray of the byte
array. The buffer will grow by
len
bytes.
@param b the array to be appended
@param off the offset to the start of the array
@param len the length of bytes to Append
@return a reference to this ByteBuffer
object
Appends an array of bytes.
@param b the array to be appended
@return a reference to this ByteBuffer
object
Appends a string
to the buffer. The string
is
converted according to the encoding ISO-8859-1.
@param str the string
to be appended
@return a reference to this ByteBuffer
object
Appends a char
to the buffer. The char
is
converted according to the encoding ISO-8859-1.
@param c the char
to be appended
@return a reference to this ByteBuffer
object
Appends another ByteBuffer
to this buffer.
@param buf the ByteBuffer
to be appended
@return a reference to this ByteBuffer
object
Appends the string representation of an int
.
@param i the int
to be appended
@return a reference to this ByteBuffer
object
Appends the string representation of a long
.
@param i the long
to be appended
@return a reference to this ByteBuffer
object
Appends a string representation of a float
according
to the Pdf conventions.
@param i the float
to be appended
@return a reference to this ByteBuffer
object
Appends a string representation of a double
according
to the Pdf conventions.
@param d the double
to be appended
@return a reference to this ByteBuffer
object
Outputs a double
into a format suitable for the PDF.
@param d a double
@return the string
representation of the double
Outputs a double
into a format suitable for the PDF.
@param d a double
@param buf a ByteBuffer
@return the String
representation of the double
if
buf
is null
. If buf
is not null
,
then the double is appended directly to the buffer and this methods returns null
.
Sets the size to zero.
Creates a newly allocated byte array. Its size is the current
size of this output stream and the valid contents of the buffer
have been copied into it.
@return the current contents of this output stream, as a byte array.
Converts the buffer's contents into a string, translating bytes into
characters according to the platform's default character encoding.
@return string translated from the buffer's contents.
Writes the complete contents of this byte buffer output to
the specified output stream argument, as if by calling the output
stream's write method using out.Write(buf, 0, count)
.
@param out the output stream to which to write the data.
@exception IOException if an I/O error occurs.
Returns the current size of the buffer.
@return the value of the count
field, which is the number of valid bytes in this byte buffer.
a utility that creates a range item for an entire index
@param indexOffset where the index is
@return a range item representing the entire index
get a single CID font. The PDF architecture (1.4)
supports 16-bit strings only with CID CFF fonts, not
in Type-1 CFF fonts, so we convert the font to CID if
it is in the Type-1 format.
Two other tasks that we need to do are to select
only a single font from the CFF package (this again is
a PDF restriction) and to subset the CharStrings glyph
description.
A random Access File or an array
(contributed by orly manor)
List items for the linked list that builds the new CID font.
remember the current offset and increment by item's size in bytes.
Emit the byte stream for this item.
Fix up cross references to this item (applies only to markers).
set the value of an offset item that was initially unknown.
It will be fixed up latex by a call to xref on some marker.
A range item.
An index-offset item for the list.
The size denotes the required size in the CFF. A positive
value means that we need a specific size in bytes (for offset arrays)
and a negative value means that this is a dict item that uses a
variable-size representation.
@author orly manor
TODO To change the template for this generated type comment go to
Window - Preferences - Java - Code Generation - Code and Comments
an unknown offset in a dictionary for the list.
We will fix up the offset later; for now, assume it's large.
Card24 item.
Card32 item.
A SID or Card16 item.
A Card8 item.
A dictionary number on the list.
This implementation is inefficient: it doesn't use the variable-length
representation.
An offset-marker item for the list.
It is used to mark an offset and to set the offset list item.
Operator codes for unused CharStrings and unused local and global Subrs
The Strings in this array represent Type1/Type2 operator names
The Strings in this array represent Type1/Type2 escape operator names
A HashMap containing the glyphs used in the text after being converted
to glyph number by the CMap
The GlyphsUsed keys as an ArrayList
A HashMap for keeping the FDArrays being used by the font
A HashMaps array for keeping the subroutines used in each FontDict
The SubroutinesUsed HashMaps as ArrayLists
A HashMap for keeping the Global subroutines used in the font
The Global SubroutinesUsed HashMaps as ArrayLists
A HashMap for keeping the subroutines used in a non-cid font
The SubroutinesUsed HashMap as ArrayList
An array of the new Indexs for the local Subr. One index for each FontDict
The new subroutines index for a non-cid font
The new global subroutines index of the font
The new CharString of the font
The bias for the global subroutines
The linked list for generating the new font stream
Number of arguments to the stem operators in a subroutine calculated recursivly
C'tor for CFFFontSubset
@param rf - The font file
@param GlyphsUsed - a HashMap that contains the glyph used in the subset
Calculates the length of the charset according to its format
@param Offset The Charset Offset
@param NumofGlyphs Number of glyphs in the font
@return the length of the Charset
Function calculates the number of ranges in the Charset
@param NumofGlyphs The number of glyphs in the font
@param Type The format of the Charset
@return The number of ranges in the Charset data structure
Read the FDSelect of the font and compute the array and its length
@param Font The index of the font being processed
@return The Processed FDSelect of the font
Function reads the FDSelect and builds the FDArrayUsed HashMap According to the glyphs used
@param Font the Number of font being processed
Read the FDArray count, offsize and Offset array
@param Font
The Process function extracts one font out of the CFF file and returns a
subset version of the original.
@param fontName - The name of the font to be taken out of the CFF
@return The new font stream
@throws IOException
Function calcs bias according to the CharString type and the count
of the subrs
@param Offset The offset to the relevent subrs index
@param Font the font
@return The calculated Bias
Function uses BuildNewIndex to create the new index of the subset charstrings
@param FontIndex the font
@throws IOException
The function finds for the FD array processed the local subr offset and its
offset array.
@param Font the font
@param FD The FDARRAY processed
The function reads a subrs (glyph info) between begin and end.
Adds calls to a Lsubr to the hSubr and lSubrs.
Adds calls to a Gsubr to the hGSubr and lGSubrs.
@param begin the start point of the subr
@param end the end point of the subr
@param GBias the bias of the Global Subrs
@param LBias the bias of the Local Subrs
@param hSubr the HashMap for the lSubrs
@param lSubr the ArrayList for the lSubrs
Function Checks how the current operator effects the run time stack after being run
An operator may increase or decrease the stack size
Function checks the key and return the change to the stack after the operator
@return The change in the stack. 2-> flush the stack
Empty the Type2 Stack
Pop one element from the stack
Add an item to the stack
The function reads the next command after the file pointer is set
The function reads the subroutine and returns the number of the hint in it.
If a call to another subroutine is found the function calls recursively.
@param begin the start point of the subr
@param end the end point of the subr
@param LBias the bias of the Local Subrs
@param GBias the bias of the Global Subrs
@param LSubrsOffsets The Offsets array of the subroutines
@return The number of hints in the subroutine read.
Function builds the new offset array, object array and assembles the index.
used for creating the glyph and subrs subsetted index
@param Offsets the offset array of the original index
@param Used the hashmap of the used objects
@param OperatorForUnusedEntries the operator inserted into the data stream for unused entries
@return the new index subset version
@throws IOException
Function builds the new offset array, object array and assembles the index.
used for creating the glyph and subrs subsetted index
@param Offsets the offset array of the original index
@param OperatorForUnusedEntries the operator inserted into the data stream for unused entries
@return the new index subset version
@throws IOException
Function creates the new index, inserting the count,offsetsize,offset array
and object array.
@param NewOffsets the subsetted offset array
@param NewObjects the subsetted object array
@return the new index created
The function builds the new output stream according to the subset process
@param Font the font
@return the subseted font stream
@throws IOException
Function Copies the header from the original fileto the output list
Function Build the header of an index
@param Count the count field of the index
@param Offsize the offsize field of the index
@param First the first offset of the index
Function adds the keys into the TopDict
@param fdarrayRef OffsetItem for the FDArray
@param fdselectRef OffsetItem for the FDSelect
@param charsetRef OffsetItem for the CharSet
@param charstringsRef OffsetItem for the CharString
Function takes the original string item and adds the new strings
to accomodate the CID rules
@param Font the font
Function creates new FDSelect for non-CID fonts.
The FDSelect built uses a single range for all glyphs
@param fdselectRef OffsetItem for the FDSelect
@param nglyphs the number of glyphs in the font
Function creates new CharSet for non-CID fonts.
The CharSet built uses a single range for all glyphs
@param charsetRef OffsetItem for the CharSet
@param nglyphs the number of glyphs in the font
Function creates new FDArray for non-CID fonts.
The FDArray built has only the "Private" operator that points to the font's
original private dict
@param fdarrayRef OffsetItem for the FDArray
@param privateRef OffsetItem for the Private Dict
@param Font the font
Function reconstructs the FDArray, PrivateDict and LSubr for CID fonts
@param Font the font
@throws IOException
Function subsets the FDArray and builds the new one with new offsets
@param Font The font
@param fdPrivate OffsetItem Array (one for each FDArray)
@throws IOException
Function Adds the new private dicts (only for the FDs used) to the list
@param Font the font
@param fdPrivate OffsetItem array one element for each private
@param fdPrivateBase IndexBaseItem array one element for each private
@param fdSubrs OffsetItem array one element for each private
@throws IOException
Function Adds the new LSubrs dicts (only for the FDs used) to the list
@param Font The index of the font
@param fdPrivateBase The IndexBaseItem array for the linked list
@param fdSubrs OffsetItem array for the linked list
@throws IOException
Calculates how many byte it took to write the offset for the subrs in a specific
private dict.
@param Offset The Offset for the private dict
@param Size The size of the private dict
@return The size of the offset of the subrs in the private dict
Function computes the size of an index
@param indexOffset The offset for the computed index
@return The size of the index
The function creates a private dict for a font that was not CID
All the keys are copied as is except for the subrs key
@param Font the font
@param Subr The OffsetItem for the subrs of the private
the function marks the beginning of the subrs index and adds the subsetted subrs
index to the output list.
@param Font the font
@param PrivateBase IndexBaseItem for the private that's referencing to the subrs
@param Subrs OffsetItem for the subrs
@throws IOException
Creates a CJK font compatible with the fonts in the Adobe Asian font Pack.
@author Paulo Soares
The encoding used in the PDF document for CJK fonts
The path to the font resources.
The font name
The style modifier
The CMap name associated with this font
Creates a CJK font.
@param fontName the name of the font
@param enc the encoding of the font
@param emb always false
. CJK font and not embedded
@throws DocumentException on error
@throws IOException on error
Returns a font compatible with a CJK encoding or null if not found.
@param enc
@return
Checks if its a valid CJK font.
@param fontName the font name
@param enc the encoding
@return true
if it is CJK font
Gets the width of a char
in normalized 1000 units.
@param char1 the unicode char
to get the width of
@return the width in normalized 1000 units
You can't get the FontStream of a CJK font (CJK fonts are never embedded),
so this method always returns null.
@return null
@since 2.1.3
Gets the font parameter identified by key
. Valid values
for key
are ASCENT
, CAPHEIGHT
, DESCENT
and ITALICANGLE
.
@param key the parameter to be extracted
@param fontSize the font size in points
@return the parameter in points
Implementation of DocumentFont used while parsing PDF streams.
@since 2.1.4
Creates a new instance of DocumentFont
Creates a new instance of DocumentFont
Creates a new instance of DocumentFont
Gets the font parameter identified by key
. Valid values
for key
are ASCENT
, CAPHEIGHT
, DESCENT
,
ITALICANGLE
, BBOXLLX
, BBOXLLY
, BBOXURX
and BBOXURY
.
@param key the parameter to be extracted
@param fontSize the font size in points
@return the parameter in points
Gets the kerning between two Unicode chars.
@param char1 the first char
@param char2 the second char
@return the kerning to be applied
Gets the width from the font according to the Unicode char c
or the name
. If the name
is null it's a symbolic font.
@param c the unicode char
@param name the glyph name
@return the width of the char
Checks if the font has any kerning pairs.
@return true
if the font has any kerning pairs
Outputs to the writer the font dictionaries and streams.
@param writer the writer for this document
@param ref the font indirect reference
@param params several parameters that depend on the font type
@throws IOException on error
@throws DocumentException error in generating the object
Always returns null.
@return null
@since 2.1.3
Gets the width of a char
in normalized 1000 units.
@param char1 the unicode char
to get the width of
@return the width in normalized 1000 units
Gets the postscript font name.
@return the postscript font name
Exposes the unicode - > CID map that is constructed from the font's encoding
@return the unicode to CID map
@since 2.1.7
Exposes the CID - > unicode map that is constructed from the font's encoding
@return the CID to unicode map
@since 5.4.0
Gets the difference map
@return the difference map
@since 5.0.5
The font dictionary.
the width of a space for this font, in normalized 1000 point units
The CMap constructed from the ToUnicode map from the font's dictionary, if present.
This CMap transforms CID values into unicode equivalent
Mapping between CID code (single byte only for now) and unicode equivalent
as derived by the font's encoding. Only needed if the ToUnicode CMap is not provided.
Creates an instance of a CMapAwareFont based on an indirect reference to a font.
@param refFont the indirect reference to a font
Parses the ToUnicode entry, if present, and constructs a CMap for it
@since 2.1.7
Inverts DocumentFont's uni2byte mapping to obtain a cid-to-unicode mapping based
on the font's encoding
@since 2.1.7
For all widths of all glyphs, compute the average width in normalized 1000 point units.
This is used to give some meaningful width in cases where we need an average font width
(such as if the width of a space isn't specified by a given font)
@return the average width of all non-zero width glyphs in the font
@since 2.1.5
Override to allow special handling for fonts that don't specify width of space character
@see com.itextpdf.text.pdf.DocumentFont#getWidth(int)
Decodes a single CID (represented by one or two bytes) to a unicode String.
@param bytes the bytes making up the character code to convert
@param offset an offset
@param len a length
@return a String containing the encoded form of the input bytes using the font's encoding.
Decodes a string of bytes (encoded in the font's encoding) into a unicode string
This will use the ToUnicode map of the font, if available, otherwise it uses
the font's encoding
@param cidbytes the bytes that need to be decoded
@return the unicode String that results from decoding
@since 2.1.7
! .NET SPECIFIC; this method is used to avoid unecessary using of StringBuilder because it is slow in .NET !
Decodes a single character string of bytes (encoded in the font's encoding) into a unicode string
This will use the ToUnicode map of the font, if available, otherwise it uses
the font's encoding
@param cidbytes the bytes that need to be decoded
@return the unicode String that results from decoding
Encodes bytes to a String.
@param bytes the bytes from a stream
@param offset an offset
@param len a length
@return a String encoded taking into account if the bytes are in unicode or not.
@deprecated method name is not indicative of what it does. Use decode
instead.
@author Paulo Soares
Came from GIFEncoder initially.
Modified - to allow for output compressed data without the block counts
which breakup the compressed data stream for GIF.
note this also indicates gif format BITFile. *
@param output destination for output data
@param blocks GIF LZW requires block counts for output data
Reads a BMP from an url.
@param url the url
@throws IOException on error
@return the image
Reads a BMP from a stream. The stream is not closed.
@param is the stream
@throws IOException on error
@return the image
Reads a BMP from a stream. The stream is not closed.
The BMP may not have a header and be considered as a plain DIB.
@param is the stream
@param noHeader true to process a plain DIB
@param size the size of the DIB. Not used for a BMP
@throws IOException on error
@return the image
Reads a BMP from a file.
@param file the file
@throws IOException on error
@return the image
Reads a BMP from a byte array.
@param data the byte array
@throws IOException on error
@return the image
Encodes data in the CCITT G4 FAX format.
Creates a new encoder.
@param width the line width
Encodes a number of lines.
@param data the data to be encoded
@param offset the offset into the data
@param size the size of the data to be encoded
Encodes a full image.
@param data the data to encode
@param width the image width
@param height the image height
@return the encoded image
Encodes a number of lines.
@param data the data to be encoded
@param height the number of lines to encode
Closes the encoder and returns the encoded data.
@return the encoded data
Reads gif images of all types. All the images in a gif are read in the constructors
and can be retrieved with other methods.
@author Paulo Soares
Reads gif images from an URL.
@param url the URL
@throws IOException on error
Reads gif images from a file.
@param file the file
@throws IOException on error
Reads gif images from a byte array.
@param data the byte array
@throws IOException on error
Reads gif images from a stream. The stream isp not closed.
@param isp the stream
@throws IOException on error
Gets the number of frames the gif has.
@return the number of frames the gif has
Gets the image from a frame. The first frame isp 1.
@param frame the frame to get the image from
@return the image
Gets the [x,y] position of the frame in reference to the
logical screen.
@param frame the frame
@return the [x,y] position of the frame
Gets the logical screen. The images may be smaller and placed
in some position in this screen to playback some animation.
No image will be be bigger that this.
@return the logical screen dimensions as [x,y]
Reads GIF file header information.
Reads Logical Screen Descriptor
Reads next 16-bit value, LSB first
Reads next variable length block from input.
@return number of bytes stored in "buffer"
Reads next frame image
Resets frame state for reading next image.
Reads Graphics Control Extension values
Skips variable length blocks up to and including
next zero length block.
Support for JBIG2 Images.
This class assumes that we are always embedding into a pdf.
@since 2.1.5
Gets a byte array that can be used as a /JBIG2Globals,
or null if not applicable to the given jbig2.
@param ra an random access file or array
@return a byte array
returns an Image representing the given page.
@param ra the file or array containing the image
@param page the page number of the image
@return an Image object
Class to read a JBIG2 file at a basic level: understand all the segments,
understand what segments belong to which pages, how many pages there are,
what the width and height of each page is, and global segments if there
are any. Or: the minimum required to be able to take a normal sequential
or random-access organized file, and be able to embed JBIG2 pages as images
in a PDF.
TODO: the indeterminate-segment-size value of dataLength, else?
@since 2.1.5
Inner class that holds information about a JBIG2 segment.
@since 2.1.5
Inner class that holds information about a JBIG2 page.
@since 2.1.5
return as a single byte array the header-data for each segment in segment number
order, EMBEDDED organization, but i am putting the needed segments in SEQUENTIAL organization.
if for_embedding, skip the segment types that are known to be not for acrobat.
@param for_embedding
@return a byte array
@throws IOException
A PNG marker.
A PNG marker.
A PNG marker.
A PNG marker.
A PNG marker.
A PNG marker.
A PNG marker.
A PNG marker.
A PNG marker.
A PNG marker.
Some PNG specific values.
Creates a new instance of PngImage
Reads a PNG from an url.
@param url the url
@throws IOException on error
@return the image
Reads a PNG from a stream.
@param is the stream
@throws IOException on error
@return the image
Reads a PNG from a file.
@param file the file
@throws IOException on error
@return the image
Reads a PNG from a byte array.
@param data the byte array
@throws IOException on error
@return the image
Gets an int
from an Stream
.
@param is an Stream
@return the value of an int
Gets a word
from an Stream
.
@param is an Stream
@return the value of an int
Gets a String
from an Stream
.
@param is an Stream
@return the value of an int
A list of constants used in class TIFFImage.
A bool storing the endianness of the stream.
The number of entries in the IFD.
An array of TIFFFields.
A Hashtable indexing the fields by tag number.
The offset of this IFD.
The offset of the next IFD.
The default constructor.
Constructs a TIFFDirectory from a SeekableStream.
The directory parameter specifies which directory to read from
the linked list present in the stream; directory 0 is normally
read but it is possible to store multiple images in a single
TIFF file by maintaing multiple directories.
@param stream a SeekableStream to read from.
@param directory the index of the directory to read.
Constructs a TIFFDirectory by reading a SeekableStream.
The ifd_offset parameter specifies the stream offset from which
to begin reading; this mechanism is sometimes used to store
private IFDs within a TIFF file that are not part of the normal
sequence of IFDs.
@param stream a SeekableStream to read from.
@param ifd_offset the long byte offset of the directory.
@param directory the index of the directory to read beyond the
one at the current stream offset; zero indicates the IFD
at the current offset.
Returns the number of directory entries.
Returns the value of a given tag as a TIFFField,
or null if the tag is not present.
Returns true if a tag appears in the directory.
Returns an ordered array of ints indicating the tag
values.
Returns an array of TIFFFields containing all the fields
in this directory.
Returns the value of a particular index of a given tag as a
byte. The caller is responsible for ensuring that the tag is
present and has type TIFFField.TIFF_SBYTE, TIFF_BYTE, or
TIFF_UNDEFINED.
Returns the value of index 0 of a given tag as a
byte. The caller is responsible for ensuring that the tag is
present and has type TIFFField.TIFF_SBYTE, TIFF_BYTE, or
TIFF_UNDEFINED.
Returns the value of a particular index of a given tag as a
long. The caller is responsible for ensuring that the tag is
present and has type TIFF_BYTE, TIFF_SBYTE, TIFF_UNDEFINED,
TIFF_SHORT, TIFF_SSHORT, TIFF_SLONG or TIFF_LONG.
Returns the value of index 0 of a given tag as a
long. The caller is responsible for ensuring that the tag is
present and has type TIFF_BYTE, TIFF_SBYTE, TIFF_UNDEFINED,
TIFF_SHORT, TIFF_SSHORT, TIFF_SLONG or TIFF_LONG.
Returns the value of a particular index of a given tag as a
float. The caller is responsible for ensuring that the tag is
present and has numeric type (all but TIFF_UNDEFINED and
TIFF_ASCII).
Returns the value of index 0 of a given tag as a float. The
caller is responsible for ensuring that the tag is present and
has numeric type (all but TIFF_UNDEFINED and TIFF_ASCII).
Returns the value of a particular index of a given tag as a
double. The caller is responsible for ensuring that the tag is
present and has numeric type (all but TIFF_UNDEFINED and
TIFF_ASCII).
Returns the value of index 0 of a given tag as a double. The
caller is responsible for ensuring that the tag is present and
has numeric type (all but TIFF_UNDEFINED and TIFF_ASCII).
Returns the number of image directories (subimages) stored in a
given TIFF file, represented by a SeekableStream
.
Returns a bool indicating whether the byte order used in the
the TIFF file is big-endian (i.e. whether the byte order is from
the most significant to the least significant)
Returns the offset of the IFD corresponding to this
TIFFDirectory
.
Returns the offset of the next IFD after the IFD corresponding to this
TIFFDirectory
.
@param fillOrder The fill order of the compressed data bytes.
@param w
@param h
The logical order of bits within a byte.
1 = MSB-to-LSB
2 = LSB-to-MSB (flipped)
Uncompressed mode flag: 1 if uncompressed, 0 if not.
EOL padding flag: 1 if fill bits have been added before an EOL such
that the EOL ends on a byte boundary, 0 otherwise.
Coding dimensionality: 1 for 2-dimensional, 0 for 1-dimensional.
Invokes the superclass method and then sets instance variables on
the basis of the metadata set on this decompressor.
Flag for 8 bit unsigned integers.
Flag for null-terminated ASCII strings.
Flag for 16 bit unsigned integers.
Flag for 32 bit unsigned integers.
Flag for pairs of 32 bit unsigned integers.
Flag for 8 bit signed integers.
Flag for 8 bit uninterpreted bytes.
Flag for 16 bit signed integers.
Flag for 32 bit signed integers.
Flag for pairs of 32 bit signed integers.
Flag for 32 bit IEEE floats.
Flag for 64 bit IEEE doubles.
The tag number.
The tag type.
The number of data items present in the field.
The field data.
The default constructor.
Returns the tag number, between 0 and 65535.
Returns the type of the data stored in the IFD.
For a TIFF6.0 file, the value will equal one of the
TIFF_ constants defined in this class. For future
revisions of TIFF, higher values are possible.
Returns the number of elements in the IFD.
Reads TIFF images
@author Paulo Soares
Gets the number of pages the TIFF document has.
@param s the file source
@return the number of pages
Reads a page from a TIFF image.
@param s the file source
@param page the page to get. The first page is 1
@param direct for single strip, CCITT images, generate the image
by direct byte copying. It's faster but may not work
every time
@return the Image
Reads a page from a TIFF image. Direct mode is not used.
@param s the file source
@param page the page to get. The first page is 1
@return the Image
Reads a page from a TIFF image.
@param s the file source
@param page the page to get. The first page is 1
@param direct for single strip, CCITT images, generate the image
by direct byte copying. It's faster but may not work
every time
@return the Image
A class for performing LZW decoding.
Method to decode LZW compressed data.
@param data The compressed data.
@param uncompData Array to return the uncompressed data in.
@param h The number of rows the compressed data contains.
Initialize the string table.
Write out the string just uncompressed.
Add a new string to the string table.
Add a new string to the string table.
Append newString
to the end of oldString
.
@author psoares
Summary description for InputMeta.
Summary description for MetaDo.
Creates new MetaState
Getter for property currentBackgroundColor.
@return Value of property currentBackgroundColor.
Getter for property currentTextColor.
@return Value of property currentTextColor.
Getter for property backgroundMode.
@return Value of property backgroundMode.
Getter for property textAlign.
@return Value of property textAlign.
Getter for property polyFillMode.
@return Value of property polyFillMode.
A type of PDF Collection
A type of PDF Collection
A type of PDF Collection
A type of PDF Collection
Constructs a PDF Collection.
@param type the type of PDF collection.
Identifies the document that will be initially presented
in the user interface.
@param description the description that was used when attaching the file to the document
Sets the Collection schema dictionary.
@param schema an overview of the collection fields
Sets the Collection sort dictionary.
@param sort a collection sort dictionary
@author blowagie
A possible type of collection field.
A possible type of collection field.
A possible type of collection field.
A possible type of collection field.
A possible type of collection field.
A possible type of collection field.
A possible type of collection field.
A possible type of collection field.
The type of the PDF collection field.
Creates a PdfCollectionField.
@param name the field name
@param type the field type
Checks if the type of the field is suitable for a Collection Item.
Returns a PdfObject that can be used as the value of a Collection Item.
@param String value the value that has to be changed into a PdfObject (PdfString, PdfDate or PdfNumber)
The relative order of the field name. Fields are sorted in ascending order.
@param i a number indicating the order of the field
Sets the initial visibility of the field.
@param visible the default is true (visible)
Indication if the field value should be editable in the viewer.
@param editable the default is false (not editable)
The PdfCollectionSchema with the names and types of the items.
Constructs a Collection Item that can be added to a PdfFileSpecification.
Sets the value of the collection item.
@param value
Sets the value of the collection item.
@param value
Sets the value of the collection item.
@param value
Sets the value of the collection item.
@param value
Sets the value of the collection item.
@param value
Sets the value of the collection item.
@param value
Sets the value of the collection item.
@param value
Sets the value of the collection item.
@param value
Adds a prefix for the Collection item.
You can only use this method after you have set the value of the item.
@param prefix a prefix
Creates a Collection Schema dictionary.
Adds a Collection field to the Schema.
@param name the name of the collection field
@param field a Collection Field
Constructs a PDF Collection Sort Dictionary.
@param key the key of the field that will be used to sort entries
Constructs a PDF Collection Sort Dictionary.
@param keys the keys of the fields that will be used to sort entries
Defines the sort order of the field (ascending or descending).
@param ascending true is the default, use false for descending order
Defines the sort order of the field (ascending or descending).
@param ascending an array with every element corresponding with a name of a field.
Creates dictionary referring to a target document that is the parent of the current document.
@param nested null if this is the actual target, another target if this is only an intermediate target.
Creates a dictionary referring to a target document.
@param child if false, this refers to the parent document; if true, this refers to a child document, and you'll have to specify where to find the child using the other methods of this class
If this dictionary refers to a child that is a document level attachment,
you need to specify the name that was used to attach the document.
@param name the name in the EmbeddedFiles name tree
If this dictionary refers to a child that is a file attachment added to a page,
you need to specify the name of the page (or use setFileAttachmentPage to specify the page number).
Once you have specified the page, you still need to specify the attachment using another method.
@param name the named destination referring to the page with the file attachment.
If this dictionary refers to a child that is a file attachment added to a page,
you need to specify the page number (or use setFileAttachmentPagename to specify a named destination).
Once you have specified the page, you still need to specify the attachment using another method.
@param page the page number of the page with the file attachment.
If this dictionary refers to a child that is a file attachment added to a page,
you need to specify the page with setFileAttachmentPage or setFileAttachmentPageName,
and then specify the name of the attachment added to this page (or use setFileAttachmentIndex).
@param name the name of the attachment
If this dictionary refers to a child that is a file attachment added to a page,
you need to specify the page with setFileAttachmentPage or setFileAttachmentPageName,
and then specify the index of the attachment added to this page (or use setFileAttachmentName).
@param name the name of the attachment
If this dictionary refers to an intermediate target, you can
add the next target in the sequence.
@param nested the next target in the sequence
Each colorSpace in the document will have an instance of this class
@author Phillip Pan (phillip@formstar.com)
The indirect reference to this color
The color name that appears in the document body stream
The color
Each spot color used in a document has an instance of this class.
@param colorName the color name
@param indirectReference the indirect reference to the font
@param scolor the PDfSpotColor
Gets the SpotColor
object.
@return the PdfSpotColor
Gets the indirect reference to this color.
@return the indirect reference to this color
Gets the color name as it appears in the document body.
@return the color name
Eliminate the arabic vowels
Compose the tashkeel in the ligatures.
Do some extra double ligatures.
Digit shaping option: Replace European digits (U+0030...U+0039) by Arabic-Indic digits.
Digit shaping option: Replace Arabic-Indic digits by European digits (U+0030...U+0039).
Digit shaping option:
Replace European digits (U+0030...U+0039) by Arabic-Indic digits
if the most recent strongly directional character
is an Arabic letter (its Bidi direction value is RIGHT_TO_LEFT_ARABIC).
The initial state at the start of the text is assumed to be not an Arabic,
letter, so European digits at the start of the text will not change.
Compare to DIGITS_ALEN2AN_INIT_AL.
Digit shaping option:
Replace European digits (U+0030...U+0039) by Arabic-Indic digits
if the most recent strongly directional character
is an Arabic letter (its Bidi direction value is RIGHT_TO_LEFT_ARABIC).
The initial state at the start of the text is assumed to be an Arabic,
letter, so European digits at the start of the text will change.
Compare to DIGITS_ALEN2AN_INT_LR.
Digit type option: Use Arabic-Indic digits (U+0660...U+0669).
Digit type option: Use Eastern (Extended) Arabic-Indic digits (U+06f0...U+06f9).
Signals that there is no more text available.
Signals that there is no more column.
The column is valid.
The line is out the column limits.
The line cannot fit this column position.
Upper bound of the column.
Lower bound of the column.
The column Element. Default is left Element.
The left column bound.
The right column bound.
The chunks that form the text.
The current y line location. Text will be written at this line minus the leading.
The X position after the last line that has been written.
@since 5.0.3
The leading for the current line.
The fixed text leading.
The text leading that is multiplied by the biggest font size in the line.
The PdfContent
where the text will be written to.
The line status when trying to fit a line to a column.
The first paragraph line indent.
The following paragraph lines indent.
The right paragraph lines indent.
The extra space between paragraphs.
The width of the line when the column is defined as a simple rectangle.
Holds value of property spaceCharRatio.
Holds value of property linesWritten.
Holds value of property arabicOptions.
Pointer for the row in a table that is being dealt with
@since 5.1.0
The index of the last row that needed to be splitted.
@since 5.0.1 changed a boolean into an int
-2 value mean it is the first attempt to split the first row.
-1 means that we try to avoid splitting current row.
if true, first line height is adjusted so that the max ascender touches the top
@since 5.4.2
Creates a ColumnText
.
@param text the place where the text will be written to. Can
be a template.
Creates an independent duplicated of the instance org
.
@param org the original ColumnText
@return the duplicated
Makes this instance an independent copy of org
.
@param org the original ColumnText
@return itself
Adds a Phrase
to the current text array.
@param phrase the text
Replaces the current text array with this Phrase
.
Anything added previously with AddElement() is lost.
@param phrase the text
Adds a Chunk
to the current text array.
Will not have any effect if AddElement() was called before.
@param chunk the text
Finds the intersection between the yLine
and the column. It will
set the lineStatus
apropriatly.
@param wall the column to intersect
@return the x coordinate of the intersection
Finds the intersection between the yLine
and the two
column bounds. It will set the lineStatus
apropriatly.
@return a float[2]
with the x coordinates of the intersection
Finds the intersection between the yLine
,
the yLine-leading
and the two
column bounds. It will set the lineStatus
apropriatly.
@return a float[4]
with the x coordinates of the intersection
Sets the columns bounds. Each column bound is described by a
float[]
with the line points [x1,y1,x2,y2,...].
The array must have at least 4 elements.
@param leftLine the left column bound
@param rightLine the right column bound
Simplified method for rectangular columns.
@param phrase a Phrase
@param llx the lower left x corner
@param lly the lower left y corner
@param urx the upper right x corner
@param ury the upper right y corner
@param leading the leading
@param alignment the column alignment
Simplified method for rectangular columns.
@param llx the lower left x corner
@param lly the lower left y corner
@param urx the upper right x corner
@param ury the upper right y corner
@param leading the leading
@param alignment the column alignment
Simplified method for rectangular columns.
@param llx
@param lly
@param urx
@param ury
Simplified method for rectangular columns.
@param rect the rectangle for the column
Sets the leading fixed and variable. The resultant leading will be
fixedLeading+multipliedLeading*maxFontSize where maxFontSize is the
size of the bigest font in the line.
@param fixedLeading the fixed leading
@param multipliedLeading the variable leading
Sets the first paragraph line indent.
@param indent the indent
@param repeatFirstLineIndent do we need to repeat the indentation of the first line after a newline?
Outputs the lines to the document. It is equivalent to go(false)
.
@return returns the result of the operation. It can be NO_MORE_TEXT
and/or NO_MORE_COLUMN
@throws DocumentException on error
Outputs the lines to the document. The output can be simulated.
@param simulate true
to simulate the writting to the document
@return returns the result of the operation. It can be NO_MORE_TEXT
and/or NO_MORE_COLUMN
@throws DocumentException on error
Call this after go() to know if any word was split into several lines.
@return
Clears the chunk array. A call to go()
will always return
NO_MORE_TEXT.
Gets the width that the line will occupy after writing.
Only the width of the first line is returned.
@param phrase the Phrase
containing the line
@param runDirection the run direction
@param arabicOptions the options for the arabic shaping
@return the width of the line
Gets the width that the line will occupy after writing.
Only the width of the first line is returned.
@param phrase the Phrase
containing the line
@return the width of the line
Shows a line of text. Only the first line is written.
@param canvas where the text is to be written to
@param alignment the alignment. It is not influenced by the run direction
@param phrase the Phrase
with the text
@param x the x reference position
@param y the y reference position
@param rotation the rotation to be applied in degrees counterclockwise
@param runDirection the run direction
@param arabicOptions the options for the arabic shaping
Shows a line of text. Only the first line is written.
@param canvas where the text is to be written to
@param alignment the alignment
@param phrase the Phrase
with the text
@param x the x reference position
@param y the y reference position
@param rotation the rotation to be applied in degrees counterclockwise
Fits the text to some rectangle adjusting the font size as needed.
@param font the font to use
@param text the text
@param rect the rectangle where the text must fit
@param maxFontSize the maximum font size
@param runDirection the run direction
@return the calculated font size that makes the text fit
Checks if the element has a height of 0.
@return true or false
@since 2.1.2
Checks the status variable and looks if there's still some text.
Holds value of property filledWidth.
Replaces the filledWidth
if greater than the existing one.
@param w the new filledWidth
if greater than the existing one
Gets the fixed leading
@return the leading
Gets the variable leading
@return the leading
Gets the yLine.
@return the yLine
Gets the number of rows that were drawn when a table is involved.
Gets the Element.
@return the alignment
Gets the first paragraph line indent.
@return the indent
Gets the following paragraph lines indent.
@return the indent
Gets the right paragraph lines indent.
@return the indent
Gets the currentLeading.
@return the currentLeading
Sets the extra space between paragraphs.
@return the extra space between paragraphs
Gets the space/character extra spacing ratio for
fully justified text.
@return the space/character extra spacing ratio
Gets the run direction.
@return the run direction
Gets the number of lines written.
@return the number of lines written
Gets the X position of the end of the last line that has been written
(will not work in simulation mode!).
@since 5.0.3
Sets the arabic shaping options. The option can be AR_NOVOWEL,
AR_COMPOSEDTASHKEEL and AR_LIG.
@param arabicOptions the arabic shaping options
Gets the biggest descender value of the last line written.
@return the biggest descender value of the last line written
Sets the canvas.
@param canvas
Sets the canvases.
@param canvas
Enables/Disables adjustment of first line height based on max ascender.
@param use enable adjustment if true
Sets the real width used by the largest line. Only used to set it
to zero to start another measurement.
@param filledWidth the real width used by the largest line
Sets the first line adjustment. Some objects have properties, like spacing before, that
behave differently if the object is the first to be written after go() or not. The first line adjustment is
true
by default but can be changed if several objects are to be placed one
after the other in the same column calling go() several times.
@param adjustFirstLine true
to adjust the first line, false
otherwise
Creates an AES Cipher with CBC and no padding.
@author Paulo Soares
Creates a new instance of AESCipher
Creates a new instance of ARCFOUREncryption
An initialization vector generator for a CBC block encryption. It's a random generator based on RC4.
@author Paulo Soares
Creates a new instance of IVGenerator
Gets a 16 byte random initialization vector.
@return a 16 byte random initialization vector
Gets a random initialization vector.
@param len the length of the initialization vector
@return a random initialization vector
An instance of the default SplitCharacter.
Default constructor, has no custom characters to check.
Constructor with one splittable character.
@param character char
Constructor with an array of splittable characters
@param characters char[]
Returns the current character
@param current current position in the array
@param ck chunk array
@param cc the character array that has to be checked
@return the current character
Element that draws a dotted line from left to right.
Can be added directly to a document or column.
Can also be used to create a separator chunk.
@since 2.1.2
Element that draws a solid line from left to right.
Can be added directly to a document or column.
Can also be used to create a separator chunk.
@author Paulo Soares
@since 2.1.2
Helper class implementing the DrawInterface. Can be used to add
horizontal or vertical separators. Won't draw anything unless
you implement the draw method.
@since 2.1.2
Interface for an Element that allows you to draw something at the current
vertical position. Trivial implementations are LineSeparator and VerticalPositionMark.
It is also used to define what has to be drawn by a separator chunk.
@since 2.1.2
Implement this method if you want to draw something at the current Y position
(for instance a line).
@param canvas the canvas on which you can draw
@param llx the x coordinate of the left page margin
@param lly the y coordinate of the bottom page margin
@param urx the x coordinate of the right page margin
@param ury the y coordinate of the top page margin
@param y the current y position on the page
Another implementation of the DrawInterface; its draw method will overrule LineSeparator.Draw().
The offset for the line.
Creates a vertical position mark that won't draw anything unless
you define a DrawInterface.
Creates a vertical position mark that won't draw anything unless
you define a DrawInterface.
@param drawInterface the drawInterface for this vertical position mark.
@param offset the offset for this vertical position mark.
@see com.lowagie.text.pdf.draw.DrawInterface#draw(com.lowagie.text.pdf.PdfContentByte, float, float, float, float, float)
@see com.lowagie.text.Element#process(com.lowagie.text.ElementListener)
@see com.lowagie.text.Element#isContent()
@see com.lowagie.text.Element#isNestable()
@see com.lowagie.text.Element#type()
@see com.lowagie.text.Element#getChunks()
Setter for the interface with the overruling Draw() method.
@param drawInterface a DrawInterface implementation
Setter for the offset. The offset is relative to the current
Y position. If you want to underline something, you have to
choose a negative offset.
@param offset an offset
The thickness of the line.
The width of the line as a percentage of the available page width.
The color of the line.
The alignment of the line.
Creates a new instance of the LineSeparator class.
@param lineWidth the thickness of the line
@param percentage the width of the line as a percentage of the available page width
@param color the color of the line
@param align the alignment
@param offset the offset of the line relative to the current baseline (negative = under the baseline)
Creates a new instance of the LineSeparator class.
@param font the font
Creates a new instance of the LineSeparator class with
default values: lineWidth 1 user unit, width 100%, centered with offset 0.
@see com.lowagie.text.pdf.draw.DrawInterface#draw(com.lowagie.text.pdf.PdfContentByte, float, float, float, float, float)
Draws a horizontal line.
@param canvas the canvas to draw on
@param leftX the left x coordinate
@param rightX the right x coordindate
@param y the y coordinate
Setter for the line width.
@param lineWidth the thickness of the line that will be drawn.
Setter for the width as a percentage of the available width.
@return a width percentage
Setter for the color of the line that will be drawn.
@param color a color
Setter for the alignment of the line.
@param align an alignment value
the gap between the dots.
@see com.lowagie.text.pdf.draw.DrawInterface#draw(com.lowagie.text.pdf.PdfContentByte, float, float, float, float, float)
Setter for the gap between the center of the dots of the dotted line.
@param gap the gap between the center of the dots
Enumerates all the fonts inside a True Type Collection.
@author Paulo Soares
Reads a Truetype font
@author Paulo Soares
The code pages possible for a True Type font.
Contains the location of the several tables. The key is the name of
the table and the value is an int[2]
where position 0
is the offset from the start of the file and position 1 is the length
of the table.
The file in use.
The file name.
The offset from the start of the file to the table directory.
It is 0 for TTF and may vary for TTC depending on the chosen font.
The index for the TTC font. It is an empty string
for a
TTF file.
The style modifier
The content of table 'head'.
The content of table 'hhea'.
The content of table 'OS/2'.
The width of the glyphs. This is essentially the content of table
'hmtx' normalized to 1000 units.
The map containing the code information for the table 'cmap', encoding 1.0.
The key is the code and the value is an int[2]
where position 0
is the glyph number and position 1 is the glyph width normalized to 1000
units.
By James for unicode Ext.B
The map containing the kerning information. It represents the content of
table 'kern'. The key is an Integer
where the top 16 bits
are the glyph number for the first character and the lower 16 bits are the
glyph number for the second character. The value is the amount of kerning in
normalized 1000 units as an Integer
. This value is usually negative.
The font name.
This name is usually extracted from the table 'name' with
the 'Name ID' 6.
The font subfamily
This subFamily name is usually extracted from the table 'name' with
the 'Name ID' 2 or 'Name ID' 17.
The full name of the font 'Name ID' 1 or 'Name ID' 16
All the names auf the Names-Table
The family name of the font
true
if all the glyphs have the same width.
This constructor is present to allow extending the class.
Creates a new TrueType font.
@param ttFile the location of the font on file. The file must end in '.ttf' or
'.ttc' but can have modifiers after the name
@param enc the encoding to be applied to this font
@param emb true if the font is to be embedded in the PDF
@param ttfAfm the font as a byte
array
@throws DocumentException the font is invalid
@throws IOException the font file could not be read
Gets the name from a composed TTC file name.
If I have for input "myfont.ttc,2" the return will
be "myfont.ttc".
@param name the full name
@return the simple file name
Reads the tables 'head', 'hhea', 'OS/2', 'post' and 'maxp' filling several variables.
@throws DocumentException the font is invalid
@throws IOException the font file could not be read
Extracts the names of the font in all the languages available.
@param id the name id to retrieve
@throws DocumentException on error
@throws IOException on error
Extracts all the names of the names-Table
@param id the name id to retrieve
@throws DocumentException on error
@throws IOException on error
Reads the font data.
@param ttfAfm the font as a byte
array, possibly null
@throws DocumentException the font is invalid
@throws IOException the font file could not be read
Reads a string
from the font file as bytes using the Cp1252
encoding.
@param length the length of bytes to read
@return the string
read
@throws IOException the font file could not be read
Reads a Unicode string
from the font file. Each character is
represented by two bytes.
@param length the length of bytes to read. The string
will have length
/2
characters
@return the string
read
@throws IOException the font file could not be read
Reads the glyphs widths. The widths are extracted from the table 'hmtx'.
The glyphs are normalized to 1000 units.
@throws DocumentException the font is invalid
@throws IOException the font file could not be read
Gets a glyph width.
@param glyph the glyph to get the width of
@return the width of the glyph in normalized 1000 units
Reads the several maps from the table 'cmap'. The maps of interest are 1.0 for symbolic
fonts and 3.1 for all others. A symbolic font is defined as having the map 3.0.
@throws DocumentException the font is invalid
@throws IOException the font file could not be read
The information in the maps of the table 'cmap' is coded in several formats.
Format 0 is the Apple standard character to glyph index mapping table.
@return a Hashtable
representing this map
@throws IOException the font file could not be read
The information in the maps of the table 'cmap' is coded in several formats.
Format 4 is the Microsoft standard character to glyph index mapping table.
@return a Hashtable
representing this map
@throws IOException the font file could not be read
The information in the maps of the table 'cmap' is coded in several formats.
Format 6 is a trimmed table mapping. It is similar to format 0 but can have
less than 256 entries.
@return a Hashtable
representing this map
@throws IOException the font file could not be read
Reads the kerning information from the 'kern' table.
@throws IOException the font file could not be read
Gets the kerning between two Unicode chars.
@param char1 the first char
@param char2 the second char
@return the kerning to be applied
Gets the width from the font according to the unicode char c
.
If the name
is null it's a symbolic font.
@param c the unicode char
@param name the glyph name
@return the width of the char
Generates the font descriptor for this font.
@return the PdfDictionary containing the font descriptor or null
@param subsetPrefix the subset prefix
@param fontStream the indirect reference to a PdfStream containing the font or null
@throws DocumentException if there is an error
Generates the font dictionary for this font.
@return the PdfDictionary containing the font dictionary
@param subsetPrefix the subset prefx
@param firstChar the first valid character
@param lastChar the last valid character
@param shortTag a 256 bytes long byte
array where each unused byte is represented by 0
@param fontDescriptor the indirect reference to a PdfDictionary containing the font descriptor or null
@throws DocumentException if there is an error
Outputs to the writer the font dictionaries and streams.
@param writer the writer for this document
@param ref the font indirect reference
@param params several parameters that depend on the font type
@throws IOException on error
@throws DocumentException error in generating the object
If this font file is using the Compact Font File Format, then this method
will return the raw bytes needed for the font stream. If this method is
ever made public: make sure to add a test if (cff == true).
@return a byte array
@since 2.1.3
Returns a PdfStream object with the full font program.
@return a PdfStream with the font program
@since 2.1.3
Gets the font parameter identified by key
. Valid values
for key
are ASCENT
, CAPHEIGHT
, DESCENT
and ITALICANGLE
.
@param key the parameter to be extracted
@param fontSize the font size in points
@return the parameter in points
Gets the glyph index and metrics for a character.
@param c the character
@return an int
array with {glyph index, width}
Checks if the font has any kerning pairs.
@return true
if the font has any kerning pairs
Sets the kerning between two Unicode chars.
@param char1 the first char
@param char2 the second char
@param kern the kerning to apply in normalized 1000 units
@return true
if the kerning was applied, false
otherwise
Checks whether this font may be used with winansi encoding.
@return true
if the font can be correctly used with winansi encodings
Gets the Postscript font name.
@throws DocumentException the font is invalid
@throws IOException the font file could not be read
@return the Postscript font name
Gets the postscript font name.
@return the postscript font name
Gets the code pages supported by the font.
@return the code pages supported by the font
The components of table 'head'.
A variable.
A variable.
A variable.
A variable.
A variable.
A variable.
A variable.
The components of table 'hhea'.
A variable.
A variable.
A variable.
A variable.
A variable.
A variable.
A variable.
A variable.
A variable.
A variable.
The components of table 'OS/2'.
A variable.
A variable.
A variable.
A variable.
A variable.
A variable.
A variable.
A variable.
A variable.
A variable.
A variable.
A variable.
A variable.
A variable.
A variable.
A variable.
A variable.
A variable.
A variable.
A variable.
A variable.
A variable.
A variable.
A variable.
A variable.
A variable.
A variable.
A variable.
Class for an index.
@author Michael Niedermair
Helps the use of PdfPageEvent
by implementing all the interface methods.
A class can extend PdfPageEventHelper
and only implement the
needed methods.
@author Paulo Soares
Allows a class to catch several document events.
@author Paulo Soares
Called when the document is opened.
@param writer the PdfWriter
for this document
@param document the document
Called when a page is initialized.
Note that if even if a page is not written this method is still
called. It is preferable to use onEndPage
to avoid
infinite loops.
Note that this method isn't called for the first page. You should apply modifications for the first
page either before opening the document or by using the onOpenDocument() method.
@param writer the PdfWriter
for this document
@param document the document
Called when a page is finished, just before being written to the document.
@param writer the PdfWriter
for this document
@param document the document
Called when the document is opened.
@param writer the PdfWriter
for this document
@param document the document
Called when a page is finished, just before being written to the document.
@param writer the PdfWriter
for this document
@param document the document
Summary description for IPdfPCellEvent.
Keeps a map with fields that are to be positioned in inGenericTag.
Keeps the form field that is to be positioned in a cellLayout event.
The PdfWriter to use when a field has to added in a cell event.
The PdfFormField that is the parent of the field added in a cell event.
Creates a new event. This constructor will be used if you need to position fields with Chunk objects.
Some extra padding that will be taken into account when defining the widget.
Add a PdfFormField that has to be tied to a generic Chunk.
Creates a new event. This constructor will be used if you need to position fields with a Cell Event.
Creates a new event. This constructor will be used if you need to position fields with a Cell Event.
Creates a new event. This constructor will be used if you need to position fields with a Cell Event.
@throws DocumentException
@throws IOException
Creates a new event. This constructor will be used if you need to position fields with a Cell Event.
@throws DocumentException
@throws IOException
@see com.lowagie.text.pdf.PdfPageEvent#onGenericTag(com.lowagie.text.pdf.PdfWriter, com.lowagie.text.Document, com.lowagie.text.Rectangle, java.lang.String)
@see com.lowagie.text.pdf.PdfPCellEvent#cellLayout(com.lowagie.text.pdf.PdfPCell, com.lowagie.text.Rectangle, com.lowagie.text.pdf.PdfContentByte[])
@param padding The padding to set.
@param parent The parent to set.
Class for an index.
@author Michael Niedermair
keeps the indextag with the pagenumber
All the text that is passed to this event, gets registered in the indexentry.
@see com.lowagie.text.pdf.PdfPageEventHelper#onGenericTag(
com.lowagie.text.pdf.PdfWriter, com.lowagie.text.Document,
com.lowagie.text.Rectangle, java.lang.String)
indexcounter
the list for the index entry
Create an index entry.
@param text The text for the Chunk.
@param in1 The first level.
@param in2 The second level.
@param in3 The third level.
@return Returns the Chunk.
Create an index entry.
@param text The text for the Chunk.
@param in1 The first level.
@return Returns the Chunk.
Create an index entry.
@param text The text for the Chunk.
@param in1 The first level.
@param in2 The second level.
@return Returns the Chunk.
Create an index entry.
@param text The text.
@param in1 The first level.
@param in2 The second level.
@param in3 The third level.
Create an index entry.
@param text The text.
@param in1 The first level.
Create an index entry.
@param text The text.
@param in1 The first level.
@param in2 The second level.
Comparator for sorting the index
Set the comparator.
@param aComparator The comparator to set.
Returns the sorted list with the entries and the collected page numbers.
@return Returns the sorted list with the entries and teh collected page numbers.
Class for an index entry.
In the first step, only in1, in2,in3 and tag are used.
After the collections of the index entries, pagenumbers are used.
first level
second level
third level
the tag
the lsit of all page numbers.
the lsit of all tags.
Create a new object.
@param aIn1 The first level.
@param aIn2 The second level.
@param aIn3 The third level.
@param aTag The tag.
Returns the in1.
@return Returns the in1.
Returns the in2.
@return Returns the in2.
Returns the in3.
@return Returns the in3.
Returns the tag.
@return Returns the tag.
Returns the pagenumer for this entry.
@return Returns the pagenumer for this entry.
Add a pagenumber.
@param number The page number.
@param tag
Returns the key for the map-entry.
@return Returns the key for the map-entry.
Returns the pagenumbers.
@return Returns the pagenumbers.
Returns the tags.
@return Returns the tags.
print the entry (only for test)
@return the toString implementation of the entry
If you want to add more than one page eventa to a PdfWriter,
you have to construct a PdfPageEventForwarder, add the
different events to this object and add the forwarder to
the PdfWriter.
ArrayList containing all the PageEvents that have to be executed.
Add a page eventa to the forwarder.
@param eventa an eventa that has to be added to the forwarder.
Called when the document is opened.
@param writer
the PdfWriter
for this document
@param document
the document
Called when a page is finished, just before being written to the
document.
@param writer
the PdfWriter
for this document
@param document
the document
If you want to add more than one event to a cell,
you have to construct a PdfPCellEventForwarder, add the
different events to this object and add the forwarder to
the PdfPCell.
ArrayList containing all the PageEvents that have to be executed.
Add a page event to the forwarder.
@param event an event that has to be added to the forwarder.
@see com.lowagie.text.pdf.PdfPCellEvent#cellLayout(com.lowagie.text.pdf.PdfPCell, com.lowagie.text.Rectangle, com.lowagie.text.pdf.PdfContentByte[])
If you want to add more than one page event to a PdfPTable,
you have to construct a PdfPTableEventForwarder, add the
different events to this object and add the forwarder to
the PdfWriter.
Signals that a table will continue in the next page.
@since 5.0.6
An interface that can be used to retrieve the position of cells in PdfPTable
.
@author Paulo Soares
This method is called to indicate that table is being split. It's called
before the tableLayout
method and before the table is drawn.
@param table the PdfPTable
in use
ArrayList containing all the PageEvents that have to be executed.
Add a page event to the forwarder.
@param event an event that has to be added to the forwarder.
@see com.lowagie.text.pdf.PdfPTableEvent#tableLayout(com.lowagie.text.pdf.PdfPTable, float[][], float[], int, int, com.lowagie.text.pdf.PdfContentByte[])
@see com.itextpdf.text.pdf.PdfPTableEventAfterSplit#afterSplitTable(com.itextpdf.text.pdf.PdfPTable, com.itextpdf.text.pdf.PdfPRow, int)
@since iText 5.4.3
Reads an FDF form and makes the fields available
@author Paulo Soares
Reads a PDF document.
@author Paulo Soares
@author Kazuya Ujihara
Viewer preferences are described in section 3.6.1 and 8.1 of the
PDF Reference 1.7 (Table 3.25 on p139-142 and Table 8.1 on p579-581).
They are explained in section 13.1 of the book 'iText in Action'.
The values of the different preferences were originally stored
in class PdfWriter, but they have been moved to this separate interface
for reasons of convenience.
The iText developers are not responsible if you decide to change the
value of this static parameter.
@since 5.0.2
Holds value of property appendable.
Constructs a new PdfReader. This is the master constructor.
@param byteSource source of bytes for the reader
@param partialRead if true, the reader is opened in partial mode (PDF is parsed on demand), if false, the entire PDF is parsed into memory as the reader opens
@param ownerPassword the password or null if no password is required
@param certificate the certificate or null if no certificate is required
@param certificateKey the key or null if no certificate key is required
@param certificateKeyProvider the name of the key provider, or null if no key is required
@param closeSourceOnConstructorError if true, the byteSource will be closed if there is an error during construction of this reader
Reads and parses a PDF document.
@param filename the file name of the document
@throws IOException on error
Reads and parses a PDF document.
@param filename the file name of the document
@param ownerPassword the password to read the document
@throws IOException on error
Reads and parses a PDF document.
@param filename the file name of the document
@param ownerPassword the password to read the document
@throws IOException on error
Reads and parses a PDF document.
@param pdfIn the byte array with the document
@throws IOException on error
Reads and parses a PDF document.
@param pdfIn the byte array with the document
@param ownerPassword the password to read the document
@throws IOException on error
Reads and parses a PDF document.
@param filename the file name of the document
@param certificate the certificate to read the document
@param certificateKey the private key of the certificate
@param certificateKeyProvider the security provider for certificateKey
@throws IOException on error
Reads and parses a PDF document.
@param url the Uri of the document
@throws IOException on error
Reads and parses a PDF document.
@param url the Uri of the document
@param ownerPassword the password to read the document
@throws IOException on error
Reads and parses a PDF document.
@param is the InputStream
containing the document. The stream is read to the
end but is not closed
@param ownerPassword the password to read the document
@throws IOException on error
Reads and parses a PDF document.
@param isp the InputStream
containing the document. The stream is read to the
end but is not closed
@throws IOException on error
Reads and parses a pdf document. Contrary to the other constructors only the xref is read
into memory. The reader is said to be working in "partial" mode as only parts of the pdf
are read as needed.
@param raf the document location
@param ownerPassword the password or null
for no password
@throws IOException on error
Reads and parses a pdf document.
@param raf the document location
@param ownerPassword the password or null
for no password
@param partial indicates if the reader needs to read the document only partially. See {@link PdfReader#PdfReader(RandomAccessFileOrArray, byte[])}
@throws IOException on error
Creates an independent duplicate.
@param reader the PdfReader
to duplicate
Utility method that checks the provided byte source to see if it has junk bytes at the beginning. If junk bytes
are found, construct a tokeniser that ignores the junk. Otherwise, construct a tokeniser for the byte source as it is
@param byteSource the source to check
@return a tokeniser that is guaranteed to start at the PDF header
@throws IOException if there is a problem reading the byte source
Gets the page rotation. This value can be 0, 90, 180 or 270.
@param index the page number. The first page is 1
@return the page rotation
Gets the page size, taking rotation into account. This
is a Rectangle
with the value of the /MediaBox and the /Rotate key.
@param index the page number. The first page is 1
@return a Rectangle
Gets the rotated page from a page dictionary.
@param page the page dictionary
@return the rotated page
Gets the page size without taking rotation into account. This
is the value of the /MediaBox key.
@param index the page number. The first page is 1
@return the page size
Gets the page from a page dictionary
@param page the page dictionary
@return the page
Gets the crop box without taking rotation into account. This
is the value of the /CropBox key. The crop box is the part
of the document to be displayed or printed. It usually is the same
as the media box but may be smaller. If the page doesn't have a crop
box the page size will be returned.
@param index the page number. The first page is 1
@return the crop box
Gets the box size. Allowed names are: "crop", "trim", "art", "bleed" and "media".
@param index the page number. The first page is 1
@param boxName the box name
@return the box rectangle or null
Normalizes a Rectangle
so that llx and lly are smaller than urx and ury.
@param box the original rectangle
@return a normalized Rectangle
Checks if the PDF is a tagged PDF.
Parses the entire PDF
@throws IOException
@param obj
@return a PdfObject
Reads a PdfObject
resolving an indirect reference
if needed.
@param obj the PdfObject
to read
@return the resolved PdfObject
Reads a PdfObject
resolving an indirect reference
if needed. If the reader was opened in partial mode the object will be released
to save memory.
@param obj the PdfObject
to read
@param parent
@return a PdfObject
@param obj
@param parent
@return a PdfObject
@param idx
@return a PdfObject
@param idx
@return aPdfObject
@param obj
@param obj
@return an indirect reference
@return the percentage of the cross reference table that has been read
Eliminates the reference to the object freeing the memory used by it and clearing
the xref entry.
@param obj the object. If it's an indirect reference it will be eliminated
@return the object or the already erased dereferenced object
Decodes a stream that has the FlateDecode filter.
@param in the input data
@return the decoded data
@param in
@param dicPar
@return a byte array
A helper to FlateDecode.
@param in the input data
@param strict true
to read a correct stream. false
to try to read a corrupted stream
@return the decoded data
Decodes a stream that has the ASCIIHexDecode filter.
@param in the input data
@return the decoded data
Decodes a stream that has the ASCII85Decode filter.
@param in the input data
@return the decoded data
Decodes a stream that has the LZWDecode filter.
@param in the input data
@return the decoded data
Checks if the document had errors and was rebuilt.
@return true if rebuilt.
Gets the dictionary that represents a page.
@param pageNum the page number. 1 is the first
@return the page dictionary
@param pageNum
@return a Dictionary object
@param pageNum
Gets the page reference to this page.
@param pageNum the page number. 1 is the first
@return the page reference
Gets the contents of the page.
@param pageNum the page number. 1 is the first
@param file the location of the PDF document
@throws IOException on error
@return the content
Gets the content from the page dictionary.
@param page the page dictionary
@throws IOException on error
@return the content
@since 5.0.6
Retrieve the given page's resource dictionary
@param pageNum 1-based page number from which to retrieve the resource dictionary
@return The page's resources, or 'null' if the page has none.
@since 5.1
Retrieve the given page's resource dictionary
@param pageDict the given page
@return The page's resources, or 'null' if the page has none.
@since 5.1
Gets the contents of the page.
@param pageNum the page number. 1 is the first
@throws IOException on error
@return the content
Sets the contents of the page.
@param content the new page content
@param pageNum the page number. 1 is the first
@throws IOException on error
Sets the contents of the page.
@param content the new page content
@param pageNum the page number. 1 is the first
@since 2.1.3 (the method already existed without param compressionLevel)
Decode a byte[] applying the filters specified in the provided dictionary using default filter handlers.
@param b the bytes to decode
@param streamDictionary the dictionary that contains filter information
@return the decoded bytes
@throws IOException if there are any problems decoding the bytes
@since 5.0.4
Decode a byte[] applying the filters specified in the provided dictionary using the provided filter handlers.
@param b the bytes to decode
@param streamDictionary the dictionary that contains filter information
@param filterHandlers the map used to look up a handler for each type of filter
@return the decoded bytes
@throws IOException if there are any problems decoding the bytes
@since 5.0.4
Get the content from a stream applying the required filters.
@param stream the stream
@param file the location where the stream is
@throws IOException on error
@return the stream content
Get the content from a stream applying the required filters.
@param stream the stream
@throws IOException on error
@return the stream content
Get the content from a stream as it is without applying any filter.
@param stream the stream
@param file the location where the stream is
@throws IOException on error
@return the stream content
Get the content from a stream as it is without applying any filter.
@param stream the stream
@throws IOException on error
@return the stream content
Eliminates shared streams if they exist.
Returns true
if the PDF is encrypted.
@return true
if the PDF is encrypted
Returns true
if the PDF has a 128 bit key encryption.
@return true
if the PDF has a 128 bit key encryption
Finds all the font subsets and changes the prefixes to some
random values.
@return the number of font subsets altered
Finds all the fonts not subset but embedded and marks them as subset.
@return the number of fonts altered
Gets all the named destinations as an Hashtable
. The key is the name
and the value is the destinations array.
@return gets all the named destinations
Gets all the named destinations as an HashMap
. The key is the name
and the value is the destinations array.
@param keepNames true if you want the keys to be real PdfNames instead of Strings
@return gets all the named destinations
@since 2.1.6
Gets the named destinations from the /Dests key in the catalog as an Hashtable
. The key is the name
and the value is the destinations array.
@return gets the named destinations
Gets the named destinations from the /Dests key in the catalog as an HashMap
. The key is the name
and the value is the destinations array.
@param keepNames true if you want the keys to be real PdfNames instead of Strings
@return gets the named destinations
@since 2.1.6
Gets the named destinations from the /Names key in the catalog as an Hashtable
. The key is the name
and the value is the destinations array.
@return gets the named destinations
Removes all the fields from the document.
Removes all the annotations and fields from the document.
Replaces remote named links with local destinations that have the same name.
@since 5.0
Converts a remote named destination GoToR with a local named destination
if there's a corresponding name.
@param obj an annotation that needs to be screened for links to external named destinations.
@param names a map with names of local named destinations
@since iText 5.0
Replaces all the local named links with the actual destinations.
Closes the reader, and any underlying stream or data source used to create the reader
Removes all the unreachable objects.
@return the number of indirect objects removed
Gets the global document JavaScript.
@param file the document file
@throws IOException on error
@return the global document JavaScript
Selects the pages to keep in the document. The pages are described as
ranges. The page ordering can be changed but
no page repetitions are allowed. Note that it may be very slow in partial mode.
@param ranges the comma separated ranges as described in {@link SequenceList}
Selects the pages to keep in the document. The pages are described as a
List
of Integer
. The page ordering can be changed but
no page repetitions are allowed. Note that it may be very slow in partial mode.
@param pagesToKeep the pages to keep in the document
Selects the pages to keep in the document. The pages are described as a
List
of Integer
. The page ordering can be changed but
no page repetitions are allowed. Note that it may be very slow in partial mode.
@param pagesToKeep the pages to keep in the document
@param removeUnused indicate if to remove unsed objects. @see removeUnusedObjects
Adds a viewer preference
@param key a key for a viewer preference
@param value a value for the viewer preference
@see PdfViewerPreferences#addViewerPreference
Getter for property newXrefType.
@return Value of property newXrefType.
Getter for property hybridXref.
@return Value of property hybridXref.
Checks if this PDF has usage rights enabled.
@return true
if usage rights are present; false
otherwise
Removes any usage rights that this PDF may have. Only Adobe can grant usage rights
and any PDF modification with iText will invalidate them. Invalidated usage rights may
confuse Acrobat and it's advisabe to remove them altogether.
Gets the certification level for this document. The return values can be PdfSignatureAppearance.NOT_CERTIFIED
,
PdfSignatureAppearance.CERTIFIED_NO_CHANGES_ALLOWED
,
PdfSignatureAppearance.CERTIFIED_FORM_FILLING
and
PdfSignatureAppearance.CERTIFIED_FORM_FILLING_AND_ANNOTATIONS
.
No signature validation is made, use the methods availabe for that in AcroFields
.
@return gets the certification level for this document
Computes user password if standard encryption handler is used with Standard40, Standard128 or AES128 encryption algorithm.
@return user password, or null if not a standard encryption handler was used,
if standard encryption handler was used with AES256 encryption algorithm,
or if ownerPasswordUsed wasn't use to open the document.
Gets a new file instance of the original PDF
document.
@return a new file instance of the original PDF document
Gets the number of pages in the document.
@return the number of pages in the document
Returns the document's catalog. This dictionary is not a copy,
any changes will be reflected in the catalog.
@return the document's catalog
Returns the document's acroform, if it has one.
@return the document's acroform
Returns the content of the document information dictionary as a Hashtable
of String
.
@return content of the document information dictionary
Sets the tampered state. A tampered PdfReader cannot be reused in PdfStamper.
@param tampered the tampered state
Gets the XML metadata.
@throws IOException on error
@return the XML metadata
Gets the byte address of the last xref table.
@return the byte address of the last xref table
Gets the number of xref objects.
@return the number of xref objects
Gets the byte address of the %%EOF marker.
@return the byte address of the %%EOF marker
Gets the PDF version. Only the last version char is returned. For example
version 1.4 is returned as '4'.
@return the PDF version
Gets the encryption permissions. It can be used directly in
PdfWriter.SetEncryption()
.
@return the encryption permissions
Gets the trailer dictionary
@return the trailer dictionary
Gets a read-only version of AcroFields
.
@return a read-only version of AcroFields
Gets the global document JavaScript.
@throws IOException on error
@return the global document JavaScript
Sets the viewer preferences as the sum of several constants.
@param preferences the viewer preferences
@see PdfViewerPreferences#setViewerPreferences
Returns a bitset representing the PageMode and PageLayout viewer preferences.
Doesn't return any information about the ViewerPreferences dictionary.
@return an int that contains the Viewer Preferences.
Getter for property fileLength.
@return Value of property fileLength.
Checks if the document was opened with the owner password so that the end application
can decide what level of access restrictions to apply. If the document is not encrypted
it will return true
.
@return true
if the document was opened with the owner password or if it's not encrypted,
false
if the document was opened with the user password
Keeps track of all pages nodes to avoid circular references.
Gets the dictionary that represents a page.
@param pageNum the page number. 1 is the first
@return the page dictionary
@param pageNum
@return a dictionary object
@param pageNum
@return an indirect reference
Gets the page reference to this page.
@param pageNum the page number. 1 is the first
@return the page reference
@param pageNum
Reads an FDF form.
@param filename the file name of the form
@throws IOException on error
Reads an FDF form.
@param pdfIn the byte array with the form
@throws IOException on error
Reads an FDF form.
@param url the URL of the document
@throws IOException on error
Reads an FDF form.
@param is the InputStream
containing the document. The stream is read to the
end but is not closed
@throws IOException on error
Gets the field dictionary.
@param name the fully qualified field name
@return the field dictionary
Gets a byte[] containing a file that is embedded in the FDF.
@param name the fully qualified field name
@return the bytes of the file
@throws IOException
@since 5.0.1
Gets the field value or null
if the field does not
exist or has no value defined.
@param name the fully qualified field name
@return the field value or null
Gets all the fields. The map is keyed by the fully qualified
field name and the value is a merged PdfDictionary
with the field content.
@return all the fields
Gets the PDF file specification contained in the FDF.
@return the PDF file specification contained in the FDF
Writes an FDF form.
@author Paulo Soares
The PDF file associated with the FDF.
Creates a new FdfWriter.
Writes the content to a stream.
@param os the stream
@throws DocumentException on error
@throws IOException on error
Removes the field value.
@param field the field name
@return true
if the field was found and removed,
false
otherwise
Gets all the fields. The map is keyed by the fully qualified
field name and the values are PdfObject
.
@return a map with all the fields
Gets the field value.
@param field the field name
@return the field value or null
if not found
Sets the field value as a name.
@param field the fully qualified field name
@param value the value
@return true
if the value was inserted,
false
if the name is incompatible with
an existing field
Sets the field value as a string.
@param field the fully qualified field name
@param value the value
@return true
if the value was inserted,
false
if the name is incompatible with
an existing field
Sets the field value as a PDFAction
.
For example, this method allows setting a form submit button action using {@link PdfAction#createSubmitForm(String, Object[], int)}.
This method creates an A
entry for the specified field in the underlying FDF file.
Method contributed by Philippe Laflamme (plaflamme)
@param field the fully qualified field name
@param action the field's action
@return true
if the value was inserted,
false
if the name is incompatible with
an existing field
@since 2.1.5
Sets all the fields from this FdfReader
@param fdf the FdfReader
Sets all the fields from this PdfReader
@param pdf the PdfReader
Sets all the fields from this AcroFields
@param acro the AcroFields
Gets the PDF file name associated with the FDF.
@return the PDF file name associated with the FDF
A DocWriter
class for PDF.
When this PdfWriter
is added
to a certain PdfDocument
, the PDF representation of every Element
added to this Document will be written to the outputstream.
Encryption settings are described in section 3.5 (more specifically
section 3.5.2) of the PDF Reference 1.7.
They are explained in section 3.3.3 of the book 'iText in Action'.
The values of the different preferences were originally stored
in class PdfWriter, but they have been moved to this separate interface
for reasons of convenience.
Sets the encryption options for this document. The userPassword and the
ownerPassword can be null or have zero length. In this case the ownerPassword
is replaced by a random string. The open permissions for the document can be
AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations,
AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting.
The permissions can be combined by ORing them.
@param userPassword the user password. Can be null or empty
@param ownerPassword the owner password. Can be null or empty
@param permissions the user permissions
@param encryptionType the type of encryption. It can be one of STANDARD_ENCRYPTION_40, STANDARD_ENCRYPTION_128 or ENCRYPTION_AES128.
Optionally DO_NOT_ENCRYPT_METADATA can be ored to output the metadata in cleartext
@throws DocumentException if the document is already open
Sets the certificate encryption options for this document. An array of one or more public certificates
must be provided together with an array of the same size for the permissions for each certificate.
The open permissions for the document can be
AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations,
AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting.
The permissions can be combined by ORing them.
Optionally DO_NOT_ENCRYPT_METADATA can be ored to output the metadata in cleartext
@param certs the public certificates to be used for the encryption
@param permissions the user permissions for each of the certicates
@param encryptionType the type of encryption. It can be one of STANDARD_ENCRYPTION_40, STANDARD_ENCRYPTION_128 or ENCRYPTION_AES128.
@throws DocumentException if the document is already open
The PDF version is described in the PDF Reference 1.7 p92
(about the PDF Header) and page 139 (the version entry in
the Catalog). You'll also find info about setting the version
in the book 'iText in Action' sections 2.1.3 (PDF Header)
and 3.3 (Version history).
If the PDF Header hasn't been written yet,
this changes the version as it will appear in the PDF Header,
but only if param refers to a higher version.
If the PDF header was already written to the Stream,
this changes the version as it will appear in the Catalog.
@param version a character representing the PDF version
Sets the PDF version as it will appear in the Catalog.
Note that this only has effect if you use a later version
than the one that appears in the header. This method
ignores the parameter if you try to set a lower version
than the one currently set in the Catalog.
@param version the PDF name that will be used for the Version key in the catalog
Adds a developer extension to the Extensions dictionary
in the Catalog.
@param de an object that contains the extensions prefix and dictionary
@since 2.1.6
If the PDF Header hasn't been written yet,
this changes the version as it will appear in the PDF Header.
If the PDF header was already written to the Stream,
this changes the version as it will appear in the Catalog.
@param version a character representing the PDF version
A PDF document can have an open action and other additional actions.
When the document opens it will jump to the destination with
this name.
@param name the name of the destination to jump to
When the document opens this action
will be
invoked.
@param action the action to be invoked
Additional-actions defining the actions to be taken in
response to various trigger events affecting the document
as a whole. The actions types allowed are: DOCUMENT_CLOSE
,
WILL_SAVE
, DID_SAVE
, WILL_PRINT
and DID_PRINT
.
@param actionType the action type
@param action the action to execute in response to the trigger
@throws DocumentException on invalid action type
A PDF page can have an open and/or close action.
Sets the open and close page additional action.
@param actionType the action type. It can be PdfWriter.PAGE_OPEN
or PdfWriter.PAGE_CLOSE
@param action the action to perform
@throws DocumentException if the action type is invalid
Sets the display duration for the page (for presentations)
@param seconds the number of seconds to display the page
Sets the transition for the page
@param transition the Transition object
Checks if any PDF ISO conformance is necessary.
@return true
if the PDF has to be in conformance with any of the PDF ISO specifications
Sets the run direction. This is only used as a placeholder
as it does not affect anything.
@param runDirection the run direction
Use this methods to add a PdfAnnotation
or a PdfFormField
to the document. Only the top parent of a PdfFormField
needs to be added.
@param annot the PdfAnnotation
or the PdfFormField
to add
Use this method to adds the PdfAnnotation
to the calculation order array.
@param annot the PdfAnnotation
to be added
Use this methods to get the AcroForm object.
Use this method only if you know what you're doing
@return the PdfAcroform object of the PdfDocument
Use this method to set the signature flags.
@param f the flags. This flags are ORed with current ones
The highest generation number possible.
@since iText 2.1.6
possible PDF version (header)
possible PDF version (header)
possible PDF version (header)
possible PDF version (header)
possible PDF version (header)
possible PDF version (header)
A viewer preference
A viewer preference
A viewer preference
A viewer preference
A viewer preference
A viewer preference
A viewer preference
A viewer preference
A viewer preference
A viewer preference
A viewer preference
A viewer preference
A viewer preference
A viewer preference
A viewer preference
A viewer preference
A viewer preference
A viewer preference
A viewer preference
A viewer preference
A viewer preference
A viewer preference
A viewer preference
A viewer preference
A viewer preference
signature value
signature value
PDF/X level
PDF/X level
PDF/X level
Type of encryption
Type of encryption
Type of encryption
Type of encryption
Mask to separate the encryption type from the encryption mode.
Add this to the mode to keep the metadata in clear text
Add this to the mode to keep encrypt only the embedded files.
@since 2.1.3
The operation permitted when the document is opened with the user password
@since 2.0.7
The operation permitted when the document is opened with the user password
@since 2.0.7
The operation permitted when the document is opened with the user password
@since 2.0.7
The operation permitted when the document is opened with the user password
@since 2.0.7
The operation permitted when the document is opened with the user password
@since 2.0.7
The operation permitted when the document is opened with the user password
@since 2.0.7
The operation permitted when the document is opened with the user password
@since 2.0.7
The operation permitted when the document is opened with the user password
@since 2.0.7
@deprecated As of iText 2.0.7, use {@link #ALLOW_PRINTING} instead. Scheduled for removal at or after 2.2.0
@deprecated As of iText 2.0.7, use {@link #ALLOW_MODIFY_CONTENTS} instead. Scheduled for removal at or after 2.2.0
@deprecated As of iText 2.0.7, use {@link #ALLOW_COPY} instead. Scheduled for removal at or after 2.2.0
@deprecated As of iText 2.0.7, use {@link #ALLOW_MODIFY_ANNOTATIONS} instead. Scheduled for removal at or after 2.2.0
@deprecated As of iText 2.0.7, use {@link #ALLOW_FILL_IN} instead. Scheduled for removal at or after 2.2.0
@deprecated As of iText 2.0.7, use {@link #ALLOW_SCREENREADERS} instead. Scheduled for removal at or after 2.2.0
@deprecated As of iText 2.0.7, use {@link #ALLOW_ASSEMBLY} instead. Scheduled for removal at or after 2.2.0
@deprecated As of iText 2.0.7, use {@link #ALLOW_DEGRADED_PRINTING} instead. Scheduled for removal at or after 2.2.0
@deprecated As of iText 2.0.7, use {@link #STANDARD_ENCRYPTION_40} instead. Scheduled for removal at or after 2.2.0
@deprecated As of iText 2.0.7, use {@link #STANDARD_ENCRYPTION_128} instead. Scheduled for removal at or after 2.2.0
The default space-char ratio.
Disable the inter-character spacing.
Use the default run direction.
Do not use bidirectional reordering.
Use bidirectional reordering with left-to-right
preferential run direction.
Use bidirectional reordering with right-to-left
preferential run direction.
Constructs a PdfWriter
.
Use this method to get an instance of the PdfWriter
.
@param document The Document
that has to be written
@param os The Stream
the writer has to write to.
@return a new PdfWriter
@throws DocumentException on error
Use this method to get an instance of the PdfWriter
.
@return a new PdfWriter
@param document The Document
that has to be written
@param os The Stream
the writer has to write to.
@param listener A DocListener
to pass to the PdfDocument.
@throws DocumentException on error
the pdfdocument object.
Use this method to get the current vertical page position.
@param ensureNewLine Tells whether a new line shall be enforced. This may cause side effects
for elements that do not terminate the lines they've started because those lines will get
terminated.
@return The current vertical page position.
The direct content in this document.
The direct content under in this document.
Resets all the direct contents to empty.
This happens when a new page is started.
body of the PDF document
Adds the local destinations to the body of the document.
@param dest the Hashtable
containing the destinations
@throws IOException on error
Adds an object to the PDF body.
@param object
@return a PdfIndirectObject
@throws IOException
Adds an object to the PDF body.
@param object
@param inObjStm
@return a PdfIndirectObject
@throws IOException
Adds an object to the PDF body.
@param object
@param ref
@return a PdfIndirectObject
@throws IOException
Adds an object to the PDF body.
@param object
@param ref
@param inObjStm
@return a PdfIndirectObject
@throws IOException
Adds an object to the PDF body.
@param object
@param refNumber
@return a PdfIndirectObject
@throws IOException
Adds an object to the PDF body.
@param object
@param refNumber
@param inObjStm
@return a PdfIndirectObject
@throws IOException
Use this method for caching objects.
@param iobj @see PdfIndirectObject
Holds value of property extraCatalog.
The root of the page tree.
The PdfIndirectReference to the pages.
The current page number.
The value of the Tabs entry in the page dictionary.
@since 2.1.5
Additional page dictionary entries.
@since 5.1.0
Adds an additional entry for the page dictionary.
@since 5.1.0
Resets the additional pageDictEntries.
@since 5.1.0
Use this method to make sure the page tree has a lineair structure
(every leave is attached directly to the root).
Use this method to allow page reordering with method reorderPages.
Use this method to reorder the pages in the document.
A null
argument value only returns the number of pages to process.
It is advisable to issue a Document.NewPage()
before using this method.
@return the total number of pages
@param order an array with the new page sequence. It must have the
same size as the number of pages.
@throws DocumentException if all the pages are not present in the array
Use this method to get a reference to a page existing or not.
If the page does not exist yet the reference will be created
in advance. If on closing the document, a page number greater
than the total number of pages was requested, an exception
is thrown.
@param page the page number. The first page is 1
@return the reference to the page
Sets the Viewport for the next page.
@param viewport an array consisting of Viewport dictionaries.
@since 5.1.0
The PdfPageEvent
for this document.
A number refering to the previous Cross-Reference Table.
The original file ID (if present).
possible PDF version (catalog)
possible PDF version (catalog)
possible PDF version (catalog)
possible PDF version (catalog)
possible PDF version (catalog)
possible PDF version (catalog)
Stores the version information for the header and the catalog.
@see com.lowagie.text.pdf.interfaces.PdfVersion#setAtLeastPdfVersion(char)
@see com.lowagie.text.pdf.interfaces.PdfVersion#setPdfVersion(com.lowagie.text.pdf.PdfName)
@see com.lowagie.text.pdf.interfaces.PdfVersion#addDeveloperExtension(com.lowagie.text.pdf.PdfDeveloperExtension)
@since 2.1.6
Returns the version information.
Adds a viewer preference
@param preferences the viewer preferences
@see PdfViewerPreferences#addViewerPreference
Adds named destinations in bulk.
Valid keys and values of the map can be found in the map
that is created by SimpleNamedDestination.
@param map a map with strings as keys for the names,
and structured strings as values for the destinations
@param page_offset number of pages that has to be added to
the page numbers in the destinations (useful if you
use this method in combination with PdfCopy).
@since iText 5.0
Adds one named destination.
@param name the name for the destination
@param page the page number where you want to jump to
@param dest an explicit destination
@since iText 5.0
Use this method to add a JavaScript action at the document level.
When the document opens, all this JavaScript runs.
@param js The JavaScript action
Adds a JavaScript action at the document level. When the document
opens all this JavaScript runs.
@param code the JavaScript code
@param unicode select JavaScript unicode. Note that the internal
Acrobat JavaScript engine does not support unicode,
so this may or may not work for you
Adds a JavaScript action at the document level. When the document
opens all this JavaScript runs.
@param code the JavaScript code
Use this method to add a JavaScript action at the document level.
When the document opens, all this JavaScript runs.
@param name The name of the JS Action in the name tree
@param js The JavaScript action
Use this method to add a JavaScript action at the document level.
When the document opens, all this JavaScript runs.
@param name The name of the JS Action in the name tree
@param code the JavaScript code
@param unicode select JavaScript unicode. Note that the internal
Acrobat JavaScript engine does not support unicode,
so this may or may not work for you
Use this method to adds a JavaScript action at the document level.
When the document opens, all this JavaScript runs.
@param name The name of the JS Action in the name tree
@param code the JavaScript code
Adds a file attachment at the document level.
@param description the file description
@param fileStore an array with the file. If it's null
the file will be read from the disk
@param file the path to the file. It will only be used if
fileStore
is not null
@param fileDisplay the actual file name stored in the pdf
@throws IOException on error
Adds a file attachment at the document level.
@param description the file description
@param fs the file specification
Adds a file attachment at the document level.
@param fs the file specification
action value
action value
action value
action value
action value
When the document opens it will jump to the destination with
this name.
@param name the name of the destination to jump to
When the document opens this action
will be
invoked.
@param action the action to be invoked
Additional-actions defining the actions to be taken in
response to various trigger events affecting the document
as a whole. The actions types allowed are: DOCUMENT_CLOSE
,
WILL_SAVE
, DID_SAVE
, WILL_PRINT
and DID_PRINT
.
@param actionType the action type
@param action the action to execute in response to the trigger
@throws PdfException on invalid action type
Adds a PdfAnnotation
or a PdfFormField
to the document. Only the top parent of a PdfFormField
needs to be added.
@param annot the PdfAnnotation
or the PdfFormField
to add
Adds the PdfAnnotation
to the calculation order
array.
@param annot the PdfAnnotation
to be added
XMP Metadata for the document.
Use this method to creates XMP Metadata based
on the metadata in the PdfDocument.
@since 5.4.4 just creates XmpWriter instance which will be serialized in close.
Stores the PDF ISO conformance.
Checks if any PDF ISO conformance is necessary.
@return true
if the PDF has to be in conformance with any of the PDF ISO specifications
@see com.lowagie.text.pdf.interfaces.PdfXConformance#isPdfX()
Sets the values of the output intent dictionary. Null values are allowed to
suppress any key.
@param outputConditionIdentifier a value
@param outputCondition a value
@param registryName a value
@param info a value
@param destOutputProfile a value
@throws IOException on error
Sets the values of the output intent dictionary. Null values are allowed to
suppress any key.
Prefer the ICC_Profile
-based version of this method.
@param outputConditionIdentifier a value
@param outputCondition a value, "PDFA/A" to force GTS_PDFA1, otherwise cued by pdfxConformance.
@param registryName a value
@param info a value
@param destOutputProfile a value
@since 1.x
@throws IOException
Copies the output intent dictionary from other document to this one.
@param reader the other document
@param checkExistence true
to just check for the existence of a valid output intent
dictionary, false
to insert the dictionary if it exists
@throws IOException on error
@return true
if the output intent dictionary exists, false
otherwise
Contains the business logic for cryptography.
Sets the encryption options for this document. The userPassword and the
ownerPassword can be null or have zero length. In this case the ownerPassword
is replaced by a random string. The open permissions for the document can be
AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations,
AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting.
The permissions can be combined by ORing them.
@param userPassword the user password. Can be null or empty
@param ownerPassword the owner password. Can be null or empty
@param permissions the user permissions
@param encryptionType the type of encryption. It can be one of STANDARD_ENCRYPTION_40, STANDARD_ENCRYPTION_128 or ENCRYPTION_AES128.
Optionally DO_NOT_ENCRYPT_METADATA can be ored to output the metadata in cleartext
@throws DocumentException if the document is already open
Sets the certificate encryption options for this document. An array of one or more public certificates
must be provided together with an array of the same size for the permissions for each certificate.
The open permissions for the document can be
AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations,
AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting.
The permissions can be combined by ORing them.
Optionally DO_NOT_ENCRYPT_METADATA can be ored to output the metadata in cleartext
@param certs the public certificates to be used for the encryption
@param permissions the user permissions for each of the certicates
@param encryptionType the type of encryption. It can be one of STANDARD_ENCRYPTION_40, STANDARD_ENCRYPTION_128 or ENCRYPTION_AES128.
@throws DocumentException if the document is already open
Sets the encryption options for this document. The userPassword and the
ownerPassword can be null or have zero length. In this case the ownerPassword
is replaced by a random string. The open permissions for the document can be
AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations,
AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting.
The permissions can be combined by ORing them.
@param userPassword the user password. Can be null or empty
@param ownerPassword the owner password. Can be null or empty
@param permissions the user permissions
@param strength128Bits true
for 128 bit key length, false
for 40 bit key length
@throws DocumentException if the document is already open
Sets the encryption options for this document. The userPassword and the
ownerPassword can be null or have zero length. In this case the ownerPassword
is replaced by a random string. The open permissions for the document can be
AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations,
AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting.
The permissions can be combined by ORing them.
@param strength true
for 128 bit key length, false
for 40 bit key length
@param userPassword the user password. Can be null or empty
@param ownerPassword the owner password. Can be null or empty
@param permissions the user permissions
@throws DocumentException if the document is already open
Sets the encryption options for this document. The userPassword and the
ownerPassword can be null or have zero length. In this case the ownerPassword
is replaced by a random string. The open permissions for the document can be
AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations,
AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting.
The permissions can be combined by ORing them.
@param encryptionType the type of encryption. It can be one of STANDARD_ENCRYPTION_40, STANDARD_ENCRYPTION_128 or ENCRYPTION_AES128.
Optionally DO_NOT_ENCRYPT_METADATA can be ored to output the metadata in cleartext
@param userPassword the user password. Can be null or empty
@param ownerPassword the owner password. Can be null or empty
@param permissions the user permissions
@throws DocumentException if the document is already open
Holds value of property fullCompression.
Sets the document's compression to the new 1.5 mode with object streams and xref
streams. It can be set at any time but once set it can't be unset.
The compression level of the content streams.
@since 2.1.3
The fonts of this document
The font number counter for the fonts in the document.
Adds a BaseFont
to the document but not to the page resources.
It is used for templates.
@param bf the BaseFont
to add
@return an Object[]
where position 0 is a PdfName
and position 1 is an PdfIndirectReference
The form XObjects in this document. The key is the xref and the value
is Object[]{PdfName, template}.
The name counter for the form XObjects name.
Adds a template to the document but not to the page resources.
@param template the template to add
@param forcedName the template name, rather than a generated one. Can be null
@return the PdfName
for this template
Releases the memory used by a template by writing it to the output. The template
can still be added to any content but changes to the template itself won't have
any effect.
@param tp the template to release
@throws IOException on error
Gets a page from other PDF document. The page can be used as
any other PdfTemplate. Note that calling this method more than
once with the same parameters will retrieve the same object.
@param reader the PDF document where the page is
@param pageNumber the page number. The first page is 1
@return the template representing the imported page
Returns the PdfReaderInstance associated with the specified reader.
Multiple calls with the same reader object will return the same
PdfReaderInstance.
@param reader the PDF reader that you want an instance for
@return the instance for the provided reader
@since 5.0.3
Writes the reader to the document and frees the memory used by it.
The main use is when concatenating multiple documents to keep the
memory usage restricted to the current appending document.
@param reader the PdfReader
to free
@throws IOException on error
The colors of this document
The color number counter for the colors in the document.
Adds a SpotColor
to the document but not to the page resources.
@param spc the SpotColor
to add
@return an Object[]
where position 0 is a PdfName
and position 1 is an PdfIndirectReference
The patterns of this document
The patten number counter for the colors in the document.
Mark this document for tagging. It must be called before open.
Check if the document is marked for tagging.
@return true
if the document is marked for tagging
Fix structure of tagged document: remove unused objects, remove unused items from class map,
fix xref table due to removed objects.
Flushes merged AcroFields to document (if any).
Sets a collection of optional content groups whose states are intended to follow
a "radio button" paradigm. That is, the state of at most one optional
content group in the array should be ON at a time: if one group is turned
ON, all others must be turned OFF.
@param group the radio group
Use this method to lock an optional content group.
The state of a locked group cannot be changed through the user interface
of a viewer application. Producers can use this entry to prevent the visibility
of content that depends on these groups from being changed by users.
@param layer the layer that needs to be added to the array of locked OCGs
@since 2.1.2
Sets the page box sizes. Allowed names are: "crop", "trim", "art" and "bleed".
@param boxName the box size
@param size the size
Gives the size of a trim, art, crop or bleed box, or null if not defined.
@param boxName crop, trim, art or bleed
Returns the intersection between the crop, trim art or bleed box and the parameter intersectingRectangle.
This method returns null when
- there is no intersection
- any of the above boxes are not defined
- the parameter intersectingRectangle is null
@param boxName crop, trim, art, bleed
@param intersectingRectangle the rectangle that intersects the rectangle associated to the boxName
@return the intersection of the two rectangles
action value
action value
Sets the open and close page additional action.
@param actionType the action type. It can be PdfWriter.PAGE_OPEN
or PdfWriter.PAGE_CLOSE
@param action the action to perform
@throws PdfException if the action type is invalid
A group attributes dictionary specifying the attributes
of the page�s page group for use in the transparent
imaging model
The ratio between the extra word spacing and the extra character spacing.
Extra word spacing will grow ratio
times more than extra character spacing.
Clears text wrapping around images (if applicable).
Method suggested by Pelikan Stephan
@throws DocumentException
Dictionary, containing all the images of the PDF document
This is the list with all the images in the document.
Adds an image to the document but not to the page resources. It is used with
templates and Document.Add(Image)
.
@param image the Image
to add
@return the name of the image added
@throws PdfException on error
@throws DocumentException on error
Adds an image to the document but not to the page resources. It is used with
templates and Document.Add(Image)
.
@param image the Image
to add
@param fixedRef the reference to used. It may be null
,
a PdfIndirectReference
or a PRIndirectReference
.
@return the name of the image added
@throws PdfException on error
@throws DocumentException on error
Writes a PdfImage
to the outputstream.
@param pdfImage the image to be added
@return a PdfIndirectReference
to the encapsulated image
@throws PdfException when a document isn't open yet, or has been closed
return the PdfIndirectReference
to the image with a given name.
@param name the name of the image
@return a PdfIndirectReference
A Hashtable with Stream objects containing JBIG2 Globals
@since 2.1.5
Gets an indirect reference to a JBIG2 Globals stream.
Adds the stream if it hasn't already been added to the writer.
@param content a byte array that may already been added to the writer inside a stream object.
@since 2.1.5
A flag indicating the presence of structure elements that contain user properties attributes.
Holds value of property RGBTranparency.
A wrapper around PdfAnnotation constructor.
It is recommended to use this wrapper instead of direct constructor as this is a convenient way to override PdfAnnotation construction when needed.
@param rect
@param subtype
@return
A wrapper around PdfAnnotation constructor.
It is recommended to use this wrapper instead of direct constructor as this is a convenient way to override PdfAnnotation construction when needed.
@param llx
@param lly
@param urx
@param ury
@param title
@param content
@param subtype
@return
A wrapper around PdfAnnotation constructor.
It is recommended to use this wrapper instead of direct constructor as this is a convenient way to override PdfAnnotation construction when needed.
@param llx
@param lly
@param urx
@param ury
@param action
@param subtype
@return
Gets the list of the standard structure element names (roles).
@return
Gets the PdfDocument
associated with this writer.
@return the PdfDocument
Use this method to get the info dictionary if you want to
change it directly (add keys and values to the info dictionary).
@return the info dictionary
Sets the initial leading for the PDF document.
This has to be done before the document is opened.
@param leading the initial leading
@since 2.1.6
@throws DocumentException if you try setting the leading after the document was opened.
Use this method to get the direct content for this document.
There is only one direct content, multiple calls to this method
will allways retrieve the same object.
@return the direct content
Use this method to get the direct content under for this document.
There is only one direct content, multiple calls to this method
will allways retrieve the same object.
@return the direct content
Gets a PdfIndirectReference
for an object that
will be created in the future.
@return the PdfIndirectReference
Returns the outputStreamCounter.
@return the outputStreamCounter
Sets extra keys to the catalog.
@return the catalog to change
Gets the additional pageDictEntries.
@since 5.1.0
Gets the pagenumber of this document.
This number can be different from the real pagenumber,
if you have (re)set the page number previously.
@return a page number
Sets the value for the Tabs entry in the page tree.
@param tabs Can be PdfName.R, PdfName.C or PdfName.S.
Since the Adobe Extensions Level 3, it can also be PdfName.A
or PdfName.W
@since 2.1.5
Gets the PdfPageEvent
for this document or null
if none is set.
@return the PdfPageEvent
for this document or null
if none is set
Use this method to get the root outline
and construct bookmarks.
@return the root outline
Sets the bookmarks. The list structure is defined in
{@link SimpleBookmark}.
@param outlines the bookmarks or null
to remove any
@see com.lowagie.text.pdf.interfaces.PdfVersion#setPdfVersion(char)
Sets the viewer preferences as the sum of several constants.
@param preferences the viewer preferences
@see PdfViewerPreferences#setViewerPreferences
Use this method to add page labels
@param pageLabels the page labels
Sets the Collection dictionary.
@param collection a dictionary of type PdfCollection
Gets the AcroForm object.
@return the PdfAcroForm
Set the signature flags.
@param f the flags. This flags are ORed with current ones
Sets XMP Metadata.
@param xmpMetadata The xmpMetadata to set.
Use this method to set the XMP Metadata for each page.
@param xmpMetadata The xmpMetadata to set.
Sets the PDFX conformance level. Allowed values are PDFX1A2001 and PDFX32002. It
must be called before opening the document.
@param pdfxConformance the conformance level
Gets the 1.5 compression status.
@return true
if the 1.5 compression is on
Sets the compression level to be used for streams written by this writer.
@param compressionLevel a value between 0 (best speed) and 9 (best compression)
@since 2.1.3
Gets the current document size. This size only includes
the data already writen to the output stream, it does not
include templates or fonts. It is usefull if used with
freeReader()
when concatenating many documents
and an idea of the current size is needed.
@return the approximate size without fonts or templates
Gets the structure tree root. If the document is not marked for tagging it will return null
.
@return the structure tree root
Gets the Optional Content Properties Dictionary. Each call fills the dictionary with the current layer
state. It's advisable to only call this method right before close and do any modifications
at that time.
@return the Optional Content Properties Dictionary
Gives the size of the media box.
@return a Rectangle
Sets the crop box. The crop box should not be rotated even if the
page is rotated. This change only takes effect in the next
page.
@param crop the crop box
Use this method to make sure a page is added,
even if it's empty. If you use SetPageEmpty(false),
invoking NewPage() after a blank page will add a newPage.
SetPageEmpty(true) won't have any effect.
@param pageEmpty the state
Sets the display duration for the page (for presentations)
@param seconds the number of seconds to display the page
Sets the transition for the page
@param transition the Transition object
Sets the the thumbnail image for the current page.
@param image the image
@throws PdfException on error
@throws DocumentException or error
Sets the ratio between the extra word spacing and the extra character spacing
when the text is fully justified.
Extra word spacing will grow spaceCharRatio
times more than extra character spacing.
If the ratio is PdfWriter.NO_SPACE_CHAR_RATIO
then the extra character spacing
will be zero.
@param spaceCharRatio the ratio between the extra word spacing and the extra character spacing
Sets the run direction. This is only used as a placeholder
as it does not affect anything.
@param runDirection the run direction
A UserUnit is a value that defines the default user space unit.
The minimum UserUnit is 1 (1 unit = 1/72 inch).
The maximum UserUnit is 75,000.
Remark that this userunit only works starting with PDF1.6!
Gets the default colorspaces.
@return the default colorspaces
Sets the image sequence to follow the text in strict order.
@param strictImageSequence new value of property strictImageSequence
Sets the flag indicating the presence of structure elements that contain user properties attributes.
@param userProperties the user properties flag
Sets the transparency blending colorspace to RGB. The default blending colorspace is
CMYK and will result in faded colors in the screen and in printing. Calling this method
will return the RGB colors to what is expected. The RGB blending will be applied to all subsequent pages
until other value is set.
Note that this is a generic solution that may not work in all cases.
@param rgbTransparencyBlending true
to set the transparency blending colorspace to RGB, false
to use the default blending colorspace
array containing the cross-reference table of the normal objects.
the current byteposition in the body.
Constructs a new PdfBody
.
@param writer
Returns the CrossReferenceTable of the Body
.
@param os
@param root
@param info
@param encryption
@param fileID
@param prevxref
@throws IOException
Gets a PdfIndirectReference for an object that will be created in the future.
@return a PdfIndirectReference
Returns the offset of the Cross-Reference table.
@return an offset
Returns the total number of objects contained in the CrossReferenceTable of this Body
.
@return a number of objects
PdfCrossReference
is an entry in the PDF Cross-Reference table.
Byte offset in the PDF file.
generation of the object.
Constructs a cross-reference element for a PdfIndirectObject.
@param refnum
@param offset byte offset of the object
@param generation generationnumber of the object
Constructs a cross-reference element for a PdfIndirectObject.
@param refnum
@param offset byte offset of the object
Returns the PDF representation of this PdfObject
.
@param os
@throws IOException
Writes PDF syntax to the Stream
@param midSize
@param os
@throws IOException
@see java.lang.Comparable#compareTo(java.lang.Object)
@see java.lang.Object#equals(java.lang.Object)
Constructs a PDF-Trailer.
@param size the number of entries in the PdfCrossReferenceTable
@param offset offset of the PdfCrossReferenceTable
@param root an indirect reference to the root of the PDF document
@param info an indirect reference to the info object of the PDF document
@param encryption
@param fileID
@param prevxref
Returns the PDF representation of this PdfObject
.
@param writer
@param os
@throws IOException
Each font in the document will have an instance of this class
where the characters used will be represented.
@author Paulo Soares
The indirect reference to this font
The font name that appears in the document body stream
The font
The font if its an instance of TrueTypeFontUnicode
The array used with single byte encodings
The map used with double byte encodings. The key is Int(glyph) and the
value is int[]{glyph, width, Unicode code}
The font type
true
if the font is symbolic
Indicates if all the glyphs and widths for that particular
encoding should be included in the document.
Each font used in a document has an instance of this class.
This class stores the characters used in the document and other
specifics unique to the current working document.
@param fontName the font name
@param indirectReference the indirect reference to the font
@param baseFont the BaseFont
Converts the text into bytes to be placed in the document.
The conversion is done according to the font and the encoding and the characters
used are stored.
@param text the text to convert
@return the conversion
Writes the font definition to the document.
@param writer the PdfWriter
of this document
Gets the indirect reference to this font.
@return the indirect reference to this font
Gets the font name as it appears in the document body.
@return the font name
Gets the BaseFont
of this font.
@return the BaseFont
of this font
Indicates if all the glyphs and widths for that particular
encoding should be included in the document. Set to false
to include all.
@param subset new value of property subset
Adds a Font
to be searched for valid characters.
@param font the Font
Process the text so that it will render with a combination of fonts
if needed.
@param text the text
@return a Phrase
with one or more chunks
@author Paulo Soares
Hyphenates words automatically accordingly to the language and country.
The hyphenator engine was taken from FOP and uses the TEX patterns. If a language
is not provided and a TEX pattern for it exists, it can be easily adapted.
@author Paulo Soares
Called by Chunk
to hyphenate a word.
@author Paulo Soares
Hyphenates a word and returns the first part of it. To get
the second part of the hyphenated word call getHyphenatedWordPost()
.
@param word the word to hyphenate
@param font the font used by this word
@param fontSize the font size used by this word
@param remainingWidth the width available to fit this word in
@return the first part of the hyphenated word including
the hyphen symbol, if any
Gets the hyphen symbol.
@return the hyphen symbol
Gets the second part of the hyphenated word. Must be called
after getHyphenatedWordPre()
.
@return the second part of the hyphenated word
The hyphenator engine.
The second part of the hyphenated word.
Creates a new hyphenation instance usable in Chunk
.
@param lang the language ("en" for english, for example)
@param country the country ("GB" for Great-Britain or "none" for no country, for example)
@param leftMin the minimun number of letters before the hyphen
@param rightMin the minimun number of letters after the hyphen
Hyphenates a word and returns the first part of it. To get
the second part of the hyphenated word call getHyphenatedWordPost()
.
@param word the word to hyphenate
@param font the font used by this word
@param fontSize the font size used by this word
@param remainingWidth the width available to fit this word in
@return the first part of the hyphenated word including
the hyphen symbol, if any
Gets the hyphen symbol.
@return the hyphen symbol
Gets the second part of the hyphenated word. Must be called
after getHyphenatedWordPre()
.
@return the second part of the hyphenated word
Capacity increment size
The encapsulated array
Points to next free item
This is to implement memory allocation in the array. Like Malloc().
return number of items in array
returns current capacity of array
Capacity increment size
The encapsulated array
Points to next free item
Reset Vector but don't resize or clear elements
return number of items in array
returns current capacity of array
number of hyphenation points in word
rawWord as made of alternating strings and {@link Hyphen Hyphen}
instances
@return the pre-break text, not including the hyphen character
@return the post-break text
@return the number of hyphenation points in the word
@return the hyphenation points
Ternary Search Tree
A ternary search tree is a hibrid between a binary tree and
a digital search tree (trie). Keys are limited to strings.
A data value of type char is stored in each leaf node.
It can be used as an index (or pointer) to the data.
Branches that only contain one key are compressed to one node
by storing a pointer to the trailer substring of the key.
This class is intended to serve as base class or helper class
to implement Dictionary collections or the like. Ternary trees
have some nice properties as the following: the tree can be
traversed in sorted order, partial matches (wildcard) can be
implemented, retrieval of all keys within a given distance
from the target, etc. The storage requirements are higher than
a binary tree but a lot less than a trie. Performance is
comparable with a hash table, sometimes it outperforms a hash
function (most of the time can determine a miss faster than a hash).
The main purpose of this java port is to serve as a base for
implementing TeX's hyphenation algorithm (see The TeXBook,
appendix H). Each language requires from 5000 to 15000 hyphenation
patterns which will be keys in this tree. The strings patterns
are usually small (from 2 to 5 characters), but each char in the
tree is stored in a node. Thus memory usage is the main concern.
We will sacrify 'elegance' to keep memory requirenments to the
minimum. Using java's char type as pointer (yes, I know pointer
it is a forbidden word in java) we can keep the size of the node
to be just 8 bytes (3 pointers and the data char). This gives
room for about 65000 nodes. In my tests the english patterns
took 7694 nodes and the german patterns 10055 nodes,
so I think we are safe.
All said, this is a map with strings as keys and char as value.
Pretty limited!. It can be extended to a general map by
using the string representation of an object and using the
char value as an index to an array that contains the object
values.
@author cav@uniscope.co.jp
Pointer to low branch and to rest of the key when it is
stored directly in this node, we don't have unions in java!
Pointer to high branch.
Pointer to equal branch and to data when this node is a string terminator.
The character stored in this node: splitchar
Two special values are reserved:
- 0x0000 as string terminator
- 0xFFFF to indicate that the branch starting at
this node is compressed
This shouldn't be a problem if we give the usual semantics to
strings since 0xFFFF is garanteed not to be an Unicode character.
This vector holds the trailing of the keys when the branch is compressed.
Branches are initially compressed, needing
one node per key plus the size of the string
key. They are decompressed as needed when
another key with same prefix
is inserted. This saves a lot of space,
specially for long keys.
The actual insertion function, recursive version.
Compares 2 null terminated char arrays
Compares a string with null terminated char array
Recursively insert the median first and then the median of the
lower and upper halves, and so on in order to get a balanced
tree. The array of keys is assumed to be sorted in ascending
order.
Balance the tree for best search performance
Each node stores a character (splitchar) which is part of
some Key(s). In a compressed branch (one that only contain
a single string key) the trailer of the key which is not
already in nodes is stored externally in the kv array.
As items are inserted, key substrings decrease.
Some substrings may completely disappear when the whole
branch is totally decompressed.
The tree is traversed to find the key substrings actually
used. In addition, duplicate substrings are removed using
a map (implemented with a TernaryTree!).
current node index
current key
TernaryTree parent
Node stack
key stack implemented with a StringBuilder
traverse upwards
traverse the tree to find next key
Add a character class.
A character class defines characters that are considered
equivalent for the purpose of hyphenation (e.g. "aA"). It
usually means to ignore case.
@param chargroup character group
Add a hyphenation exception. An exception replaces the
result obtained by the algorithm for cases for which this
fails or the user wants to provide his own hyphenation.
A hyphenatedword is a vector of alternating String's and
{@link Hyphen Hyphen} instances
Add hyphenation patterns.
@param pattern the pattern
@param values interletter values expressed as a string of
digit characters.
value space: stores the inteletter values
This map stores hyphenation exceptions
This map stores the character classes
Temporary map to store interletter values on pattern loading.
Packs the values by storing them in 4 bits, two values into a byte
Values range is from 0 to 9. We use zero as terminator,
so we'll add 1 to the value.
@param values a string of digits from '0' to '9' representing the
interletter values.
@return the index into the vspace array where the packed values
are stored.
String compare, returns 0 if equal or
t is a substring of s
Hyphenate word and return a Hyphenation object.
@param word the word to be hyphenated
@param remainCharCount Minimum number of characters allowed
before the hyphenation point.
@param pushCharCount Minimum number of characters allowed after
the hyphenation point.
@return a {@link Hyphenation Hyphenation} object representing
the hyphenated word or null if word is not hyphenated.
Hyphenate word and return an array of hyphenation points.
@param w char array that contains the word
@param offset Offset to first character in word
@param len Length of word
@param remainCharCount Minimum number of characters allowed
before the hyphenation point.
@param pushCharCount Minimum number of characters allowed after
the hyphenation point.
@return a {@link Hyphenation Hyphenation} object representing
the hyphenated word or null if word is not hyphenated.
Add a character class to the tree. It is used by
{@link SimplePatternParser SimplePatternParser} as callback to
add character classes. Character classes define the
valid word characters for hyphenation. If a word contains
a character not defined in any of the classes, it is not hyphenated.
It also defines a way to normalize the characters in order
to compare them with the stored patterns. Usually pattern
files use only lower case characters, in this case a class
for letter 'a', for example, should be defined as "aA", the first
character being the normalization char.
Add an exception to the tree. It is used by
{@link SimplePatternParser SimplePatternParser} class as callback to
store the hyphenation exceptions.
@param word normalized word
@param hyphenatedword a vector of alternating strings and
{@link Hyphen hyphen} objects.
Add a pattern to the tree. Mainly, to be used by
{@link SimplePatternParser SimplePatternParser} class as callback to
add a pattern to the tree.
@param pattern the hyphenation pattern
@param ivalue interletter weight values indicating the
desirability and priority of hyphenating at a given point
within the pattern. It should contain only digit characters.
(i.e. '0' to '9').
TODO: Don't use statics
@param lang
@param country
@param leftMin
@param rightMin
@param lang
@param country
@return the hyphenation tree
@param key
@return a hyphenation tree
@param lang
@param country
@param word
@param leftMin
@param rightMin
@return a hyphenation object
@param lang
@param country
@param word
@param offset
@param len
@param leftMin
@param rightMin
@return a hyphenation object
@param min
@param min
@param lang
@param country
@param word
@param offset
@param len
@return a hyphenation object
@param word
@return a hyphenation object
Parses the xml hyphenation pattern.
@author Paulo Soares
Creates a new instance of PatternParser2
Summary description for ICC_Profile.
Classes implementing this interface can create custom encodings or
replace existing ones. It is used in the context of PdfEncoding
.
@author Paulo Soares
Converts an Unicode string to a byte array according to some encoding.
@param text the Unicode string
@param encoding the requested encoding. It's mainly of use if the same class
supports more than one encoding.
@return the conversion or null
if no conversion is supported
Converts an Unicode char to a byte array according to some encoding.
@param char1 the Unicode char
@param encoding the requested encoding. It's mainly of use if the same class
supports more than one encoding.
@return the conversion or null
if no conversion is supported
Converts a byte array to an Unicode string according to some encoding.
@param b the input byte array
@param encoding the requested encoding. It's mainly of use if the same class
supports more than one encoding.
@return the conversion or null
if no conversion is supported
Checks if the PDF/X Conformance is necessary.
@return true if the PDF has to be in conformance with any of the PDF/X specifications
Sets the PDF/X conformance level.
Allowed values are PDFX1A2001, PDFX32002, PDFA1A and PDFA1B.
It must be called before opening the document.
@param pdfxConformance the conformance level
This is the AcroForm object for the complete document.
This is the array containing the references to annotations
that were added to the document.
This is an array containg references to some delayed annotations
(that were added for a page that doesn't exist yet).
Checks if the AcroForm is valid.
Gets the AcroForm object.
@return the PdfAcroform object of the PdfDocument
Stores the PDF version information,
knows how to write a PDF Header,
and how to add the version to the catalog (if necessary).
Contains different strings that are part of the header.
Indicates if the header was already written.
Indicates if we are working in append mode.
The version that was or will be written to the header.
The version that will be written to the catalog.
The version that user can use to get the actual version of PDF document *
The extensions dictionary.
@since 2.1.6
@see com.lowagie.text.pdf.interfaces.PdfVersion#setAtLeastPdfVersion(char)
@see com.lowagie.text.pdf.interfaces.PdfVersion#setPdfVersion(com.lowagie.text.pdf.PdfName)
Sets the append mode.
Writes the header to the OutputStreamCounter.
@throws IOException
Returns the PDF version as a name.
@param version the version character.
Returns the version as a byte[].
@param version the version character
Adds the version to the Catalog dictionary.
@see com.lowagie.text.pdf.interfaces.PdfVersion#addDeveloperExtension(com.lowagie.text.pdf.PdfDeveloperExtension)
@since 2.1.6
@see com.lowagie.text.pdf.interfaces.PdfVersion#setPdfVersion(char)
Stores the information concerning viewer preferences,
and contains the business logic that allows you to set viewer preferences.
The mask to decide if a ViewerPreferences dictionary is needed
A series of viewer preferences.
A series of viewer preferences.
A series of viewer preferences.
A series of viewer preferences
A series of viewer preferences.
This value will hold the viewer preferences for the page layout and page mode.
This dictionary holds the viewer preferences (other than page layout and page mode).
Returns the viewer preferences.
Given a key for a viewer preference (a PdfName object),
this method returns the index in the VIEWER_PREFERENCES array.
@param key a PdfName referring to a viewer preference
@return an index in the VIEWER_PREFERENCES array
Checks if some value is valid for a certain key.
Sets the viewer preferences for printing.
Adds the viewer preferences defined in the preferences parameter to a
PdfDictionary (more specifically the root or catalog of a PDF file).
@param catalog
Returns the page layout and page mode value.
Sets the viewer preferences as the sum of several constants.
@param preferences
the viewer preferences
@see PdfWriter#setViewerPreferences
The value indicating if the PDF has to be in conformance with PDF/X.
@see com.itextpdf.text.pdf.interfaces.PdfIsoConformance#isPdfIso()
Checks if the PDF/X Conformance is necessary.
@return true if the PDF has to be in conformance with any of the PDF/X specifications
Checks if the PDF has to be in conformance with PDF/X-1a:2001
@return true of the PDF has to be in conformance with PDF/X-1a:2001
Checks if the PDF has to be in conformance with PDF/X-3:2002
@return true of the PDF has to be in conformance with PDF/X-3:2002
Business logic that checks if a certain object is in conformance with PDF/X.
@param writer the writer that is supposed to write the PDF/X file
@param key the type of PDF ISO conformance that has to be checked
@param obj1 the object that is checked for conformance
@see com.lowagie.text.pdf.interfaces.PdfXConformance#setPDFXConformance(int)
A Hashtable that uses ints as the keys.
The hash table data.
The total number of entries in the hash table.
Rehashes the table when count exceeds this threshold.
The load factor for the hashtable.
Constructs a new, empty hashtable with the specified initial
Constructs a new, empty hashtable with the specified initial
Constructs a new, empty hashtable. A default capacity and load factor
Returns true if the hashtable contains no elements.
Returns true if the specified object is an element of the hashtable.
Returns true if the collection contains an element for the key.
Rehashes the content of the table into a bigger table.
Removes the element corresponding to the key. Does nothing if the
Clears the hash table so that it has no more elements in it.
Returns the number of elements contained in the hashtable.
Gets the object associated with the specified key in the
The interface common to all layer types.
@author Paulo Soares
Gets the PdfIndirectReference
that represents this layer.
@return the PdfIndirectReference
that represents this layer
Gets the object representing the layer.
@return the object representing the layer
Implementation of the IndicLigaturizer for Devanagari.
Warning: this is an incomplete and experimental implementation of Devanagari. This implementation should not be used in production.
Superclass for processors that can convert a String of bytes in an Indic
language to a String in the same language of which the bytes are reordered
for rendering using a font that contains the necessary glyphs.
Interface that needs to be implemented by classes that process bytes
representing text in specific languages. Processing involves changing
order to Right to Left and/or applying ligatures.
Processes a String
@param s the original String
@return the processed String
Indicates if the rundirection is right-to-left.
@return true if text needs to be rendered from right to left.
The table mapping specific character indexes to the characters in a
specific language.
Reorders the bytes in a String making Indic ligatures
@param s
the original String
@return the ligaturized String
Indic languages are written from right to left.
@return false
@see com.itextpdf.text.pdf.languages.LanguageProcessor#isRTL()
Checks if a character is vowel letter.
@param ch
the character that needs to be checked
@return true if the characters is a vowel letter
Checks if a character is vowel sign.
@param ch
the character that needs to be checked
@return true if the characters is a vowel sign
Checks if a character is consonant letter.
@param ch
the character that needs to be checked
@return true if the chracter is a consonant letter
Swaps two characters in a StringBuilder object
@param s
the StringBuilder
@param i
the index of one character
@param j
the index of the other character
Constructor for the IndicLigaturizer for Devanagari.
Implementation of the IndicLigaturizer for Gujarati.
Constructor for the IndicLigaturizer for Gujarati.
Hebrew is written from right to left.
@return true
@see com.itextpdf.text.pdf.languages.LanguageProcessor#isRTL()
A class for performing LZW decoding.
Method to decode LZW compressed data.
@param data The compressed data.
@param uncompData Array to return the uncompressed data in.
Initialize the string table.
Write out the string just uncompressed.
Add a new string to the string table.
Add a new string to the string table.
Append newstring
to the end of oldstring
.
Represents a Bezier curve.
@since 5.5.6
Represents segment from a PDF path.
@since 5.5.6
Treat base points as the points which are enough to construct a shape.
E.g. for a bezier curve they are control points, for a line segment - the start and the end points
of the segment.
@return Ordered list consisting of shape's base points.
If the distance between a point and a line is less than
this constant, then we consider the point lies on the line.
In the case when neither the line ((x1, y1), (x4, y4)) passes
through both (x2, y2) and (x3, y3) nor (x1, y1) = (x4, y4) we
use the square of the sum of the distances mentioned below in
compare to this field as the criterion of good approximation.
1. The distance between the line and (x2, y2)
2. The distance between the line and (x3, y3)
The Manhattan distance is used in the case when either the line
((x1, y1), (x4, y4)) passes through both (x2, y2) and (x3, y3)
or (x1, y1) = (x4, y4). The essential observation is that when
the curve is a uniform speed straight line from end to end, the
control points are evenly spaced from beginning to end. Our measure
of how far we deviate from that ideal uses distance of the middle
controls: point 2 should be halfway between points 1 and 3; point 3
should be halfway between points 2 and 4.
Constructs new bezier curve.
@param controlPoints Curve's control points.
{@inheritDoc}
You can adjust precision of the approximation by varying the following
parameters: {@link #curveCollinearityEpsilon}, {@link #distanceToleranceSquare},
{@link #distanceToleranceManhattan}
@return {@link java.util.List} containing points of piecewise linear approximation
for this bezier curve.
@since 5.5.6
@author kevin
@since 5.0.1
Gets the content bytes from a content object, which may be a reference
a stream or an array.
@param contentObject the object to read bytes from
@return the content bytes
@throws IOException
Gets the content bytes of a page from a reader
@param reader the reader to get content bytes from
@param pageNum the page number of page you want get the content stream from
@return a byte array with the effective content stream of a page
@throws IOException
@since 5.0.1
Simply extends the {@link com.itextpdf.text.pdf.parser.RenderListener} interface to provide
additional methods.
{@inheritDoc}
@since 5.5.6
Called when a new text block is beginning (i.e. BT)
@since iText 5.0.1
Called when text should be rendered
@param renderInfo information specifying what to render
Called when a text block has ended (i.e. ET)
@since iText 5.0.1
Called when image should be rendered
@param renderInfo information specifying what to render
@since iText 5.0.1
Called when the current path is being modified. E.g. new segment is being added,
new subpath is being started etc.
@param renderInfo Contains information about the path segment being added to the current path.
Called when the current path should be rendered.
@param renderInfo Contains information about the current path which should be rendered.
@return The path which can be used as a new clipping path.
Called when the current path should be set as a new clipping path.
@param rule Either {@link PathPaintingRenderInfo#EVEN_ODD_RULE} or {@link PathPaintingRenderInfo#NONZERO_WINDING_RULE}
A text render listener that filters text operations before passing them on to a deleg
@since 5.0.1
The deleg that will receive the text render operation if the filters all pass
The filters to be applied
Construction
@param deleg the deleg {@link RenderListener} that will receive filtered text operations
@param filters the Filter(s) to apply
Applies filters, then delegates to the deleg if all filters pass
@param renderInfo contains info to render text
@see com.itextpdf.text.pdf.parser.RenderListener#renderText(com.itextpdf.text.pdf.parser.TextRenderInfo)
This class delegates this call
@see com.itextpdf.text.pdf.parser.RenderListener#beginTextBlock()
This class delegates this call
@see com.itextpdf.text.pdf.parser.RenderListener#endTextBlock()
Applies filters, then delegates to the deleg if all filters pass
@see com.itextpdf.text.pdf.parser.RenderListener#renderImage(com.itextpdf.text.pdf.parser.ImageRenderInfo)
@since 5.0.1
A text render listener that filters text operations before passing them on to a deleg
@since 5.0.1
Defines an interface for {@link RenderListener}s that can return text
@since 5.0.2
Returns the result so far.
@return a String with the resulting text.
The deleg that will receive the text render operation if the filters all pass
Construction
@param deleg the deleg {@link RenderListener} that will receive filtered text operations
@param filters the Filter(s) to apply
This class delegates this call
@see com.itextpdf.text.pdf.parser.TextExtractionStrategy#getResultantText()
Keeps all the parameters of the graphics state.
@since 2.1.4
The current transformation matrix.
The current character spacing.
The current word spacing.
The current horizontal scaling
The current leading.
The active font.
The current font size.
The current render mode.
The current text rise
The current knockout value.
The current color space for stroke.
The current color space for stroke.
The current fill color.
The current stroke color.
The line width for stroking operations
The line cap style. For possible values
see {@link PdfContentByte}
The line join style. For possible values
see {@link PdfContentByte}
The mitir limit value
The line dash pattern
Constructs a new Graphics State object with the default values.
Copy constructor.
@param source another GraphicsState object
Getter for the current transformation matrix
@return the ctm
@since iText 5.0.1
Getter for the character spacing.
@return the character spacing
@since iText 5.0.1
Getter for the word spacing
@return the word spacing
@since iText 5.0.1
Getter for the horizontal scaling
@return the horizontal scaling
@since iText 5.0.1
Getter for the leading
@return the leading
@since iText 5.0.1
Getter for the font
@return the font
@since iText 5.0.1
Getter for the font size
@return the font size
@since iText 5.0.1
Getter for the render mode
@return the renderMode
@since iText 5.0.1
Getter for text rise
@return the text rise
@since iText 5.0.1
Getter for knockout
@return the knockout
@since iText 5.0.1
Getter for the line dash pattern.
@return The line dash pattern.
@since 5.5.6
Setter for the line dash pattern.
@param lineDashPattern New line dash pattern.
@since 5.5.6
Gets the current color space for fill operations
Gets the current color space for stroke operations
Gets the current fill color
@return a BaseColor
Gets the current stroke color
@return a BaseColor
Getter and setter for the line width.
@return The line width
@since 5.5.6
Getter and setter for the line cap style.
For possible values see {@link PdfContentByte}
@return The line cap style.
@since 5.5.6
Getter and setter for the line join style.
For possible values see {@link PdfContentByte}
@return The line join style.
@since 5.5.6
Getter and setter for the miter limit value.
@return The miter limit.
@since 5.5.6
Interface implemented by a series of content operators
@since 2.1.4
Invokes a content operator.
@param processor the processor that is dealing with the PDF content
@param operator the literal PDF syntax of the operator
@param operands the operands that come with the operator
@throws Exception any exception can be thrown - it will be re-packaged into a runtime exception and re-thrown by the {@link PdfContentStreamProcessor}
Represents image data from a PDF
@since 5.0.1
The graphics state that was in effect when the image was rendered
A reference to the image XObject
A reference to an inline image
the color space associated with the image
the image object to be rendered, if it has been parsed already. Null otherwise.
Array containing marked content info for the text.
@since 5.5.11
Create an ImageRenderInfo object based on an XObject (this is the most common way of including an image in PDF)
@param ctm the coordinate transformation matrix at the time the image is rendered
@param ref a reference to the image XObject
@return the ImageRenderInfo representing the rendered XObject
@since 5.0.1
Create an ImageRenderInfo object based on an XObject (this is the most common way of including an image in PDF)
@param ctm the coordinate transformation matrix at the time the image is rendered
@param ref a reference to the image XObject
@return the ImageRenderInfo representing the rendered XObject
@since 5.0.1
Create an ImageRenderInfo object based on inline image data. This is nowhere near completely thought through
and really just acts as a placeholder.
@param ctm the coordinate transformation matrix at the time the image is rendered
@param imageObject the image object representing the inline image
@return the ImageRenderInfo representing the rendered embedded image
@since 5.0.1
Gets an object containing the image dictionary and bytes.
@return an object containing the image dictionary and byte[]
@since 5.0.2
@return a vector in User space representing the start point of the xobject
@return The coordinate transformation matrix active when this image was rendered. Coordinates are in User space.
@since 5.0.3
@return the size of the image, in User space units
@return an indirect reference to the image
@since 5.0.2
@return the current fill color from the graphics state at the time this render operation occured
@since 5.5.7
Checks if the image belongs to a marked content sequence
with a given mcid.
@param mcid a marked content id
@return true if the text is marked with this id
@since 5.5.11
* Checks if the image belongs to a marked content sequence
* with a given mcid.
* @param mcid a marked content id
* @param checkTheTopmostLevelOnly indicates whether to check the topmost level of marked content stack only
* @return true if the text is marked with this id
* @since 5.5.11
@return the marked content associated with the ImageRenderInfo instance.
Represents a line.
@since 5.5.6
Constructs a new zero-length line starting at zero.
Constructs a new line based on the given coordinates.
Constructs a new line based on the given coordinates.
Represents the line dash pattern. The line dash pattern shall control the pattern
of dashes and gaps used to stroke paths. It shall be specified by a dash array and
a dash phase.
@since 5.5.6
Creates new {@link LineDashPattern} object.
@param dashArray The dash array. See {@link #getDashArray()}
@param dashPhase The dash phase. See {@link #getDashPhase()}
Calculates and returns the next element which is either gap or dash.
@return The next dash array's element.
Checks whether the dashed pattern is solid or not. It's solid when the
size of a dash array is even and sum of all the units off in the array
is 0.
For example: [3 0 4 0 5 0 6 0] (sum is 0), [3 0 4 0 5 1] (sum is 1).
Resets the dash array so that the {@link #next()} method will start
from the beginning of the dash array.
Getter and setter for the dash array.
The dash array’s elements is number that specify the lengths of
alternating dashes and gaps; the numbers are nonnegative. The
elements are expressed in user space units.
@return The dash array.
Getter and setter for the dash phase.
The dash phase shall specify the distance into the dash pattern at which
to start the dash. The elements are expressed in user space units.
@return The dash phase.
Represents a line segment in a particular coordinate system. This class is immutable.
@since 5.0.2
Start vector of the segment.
End vector of the segment.
Creates a new line segment.
@param startPoint the start point of a line segment.
@param endPoint the end point of a line segment.
@return the start point
@return the end point
@return the length of this line segment
@since 5.0.2
Computes the bounding rectangle for this line segment. The rectangle has a rotation 0 degrees
with respect to the coordinate system that the line system is in. For example, if a line segment
is 5 unit long and sits at a 37 degree angle from horizontal, the bounding rectangle will have
origin of the lower left hand end point of the segment, with width = 4 and height = 3.
@return the bounding rectangle
@since 5.0.2
Transforms the segment by the specified matrix
@param m the matrix for the transformation
@return the transformed segment
set to true for debugging
a summary of all found text
Creates a new text extraction renderer.
Creates a new text extraction renderer, with a custom strategy for
creating new TextChunkLocation objects based on the input of the
TextRenderInfo.
@param strat the custom strategy
@see com.itextpdf.text.pdf.parser.RenderListener#beginTextBlock()
@see com.itextpdf.text.pdf.parser.RenderListener#endTextBlock()
@param str
@return true if the string starts with a space character, false if the string is empty or starts with a non-space character
@param str
@return true if the string ends with a space character, false if the string is empty or ends with a non-space character
Filters the provided list with the provided filter
@param textChunks a list of all TextChunks that this strategy found during processing
@param filter the filter to apply. If null, filtering will be skipped.
@return the filtered list
@since 5.3.3
Determines if a space character should be inserted between a previous chunk and the current chunk.
This method is exposed as a callback so subclasses can fine time the algorithm for determining whether a space should be inserted or not.
By default, this method will insert a space if the there is a gap of more than half the font space character width between the end of the
previous chunk and the beginning of the current chunk. It will also indicate that a space is needed if the starting point of the new chunk
appears *before* the end of the previous chunk (i.e. overlapping text).
@param chunk the new chunk being evaluated
@param previousChunk the chunk that appeared immediately before the current chunk
@return true if the two chunks represent different words (i.e. should have a space between them). False otherwise.
Gets text that meets the specified filter
If multiple text extractions will be performed for the same page (i.e. for different physical regions of the page),
filtering at this level is more efficient than filtering using {@link FilteredRenderListener} - but not nearly as powerful
because most of the RenderInfo state is not captured in {@link TextChunk}
@param chunkFilter the filter to to apply
@return the text results so far, filtered using the specified filter
Returns the result so far.
@return a String with the resulting text.
Used for debugging only
@see com.itextpdf.text.pdf.parser.RenderListener#renderText(com.itextpdf.text.pdf.parser.TextRenderInfo)
@param int1
@param int2
@return comparison of the two integers
no-op method - this renderer isn't interested in image events
@see com.itextpdf.text.pdf.parser.RenderListener#renderImage(com.itextpdf.text.pdf.parser.ImageRenderInfo)
@since 5.0.1
@param comparedLine the location to compare to
@return true is this location is on the the same line as the other
Computes the distance between the end of 'other' and the beginning of this chunk
in the direction of this chunk's orientation vector. Note that it's a bad idea
to call this for chunks that aren't on the same line and orientation, but we don't
explicitly check for that condition for performance reasons.
@param other
@return the number of spaces between the end of 'other' and the beginning of this chunk
the starting location of the chunk
the ending location of the chunk
the orientation as a scalar for quick sorting
perpendicular distance to the orientation unit vector (i.e. the Y position in an unrotated coordinate system)
we round to the nearest integer to handle the fuzziness of comparing floats
distance of the start of the chunk parallel to the orientation unit vector (i.e. the X position in an unrotated coordinate system)
distance of the end of the chunk parallel to the orientation unit vector (i.e. the X position in an unrotated coordinate system)
the width of a single space character in the font of the chunk
unit vector in the orientation of the chunk
Compares based on orientation, perpendicular distance, then parallel distance
@see java.lang.Comparable#compareTo(java.lang.Object)
Represents a chunk of text, it's orientation, and location relative to the orientation vector
the text of the chunk
Computes the distance between the end of 'other' and the beginning of this chunk
in the direction of this chunk's orientation vector. Note that it's a bad idea
to call this for chunks that aren't on the same line and orientation, but we don't
explicitly check for that condition for performance reasons.
@param other
@return the number of spaces between the end of 'other' and the beginning of this chunk
Compares based on orientation, perpendicular distance, then parallel distance
@see java.lang.Comparable#compareTo(java.lang.Object)
@param as the location to compare to
@return true is this location is on the the same line as the other
@return the start location of the text
@return the end location of the text
@return the width of a single space character as rendered by this chunk
Specifies a filter for filtering {@link TextChunk} objects during text extraction
@see LocationTextExtractionStrategy#getResultantText(TextChunkFilter)
@since 5.3.3
@param textChunk the chunk to check
@return true if the chunk should be allowed
Represents a Marked Content block in a PDF
@since 5.0.2
Get the tag of this marked content
@return the tag of this marked content
Determine if an MCID is available
@return true if the MCID is available, false otherwise
Gets the MCID value If the Marked Content contains
an MCID entry, returns that value. Otherwise, a {@link NullPointerException} is thrown.
@return the MCID value
@throws NullPointerException if there is no MCID (see {@link MarkedContentInfo#hasMcid()})
A {@link RenderFilter} that only allows text within a specified marked content sequence.
@since 5.0.2
Interface for defining filters for use with {@link FilteredRenderListener}
@since 5.0.1
@param renderInfo
@return true if the text render operation should be performed
@param renderInfo
@return true if the image render operation should be performed
The MCID to match.
Constructs a filter
@param mcid the MCID to match
@see com.itextpdf.text.pdf.parser.RenderFilter#allowText(com.itextpdf.text.pdf.parser.TextRenderInfo)
Keeps all the values of a 3 by 3 matrix
and allows you to do some math with matrices.
@since 2.1.4
the row=1, col=1 position ('a') in the matrix.
the row=1, col=2 position ('b') in the matrix.
the row=1, col=3 position (always 0 for 2-D) in the matrix.
the row=2, col=1 position ('c') in the matrix.
the row=2, col=2 position ('d') in the matrix.
the row=2, col=3 position (always 0 for 2-D) in the matrix.
the row=3, col=1 ('e', or X translation) position in the matrix.
the row=3, col=2 ('f', or Y translation) position in the matrix.
the row=3, col=3 position (always 1 for 2-D) in the matrix.
the values inside the matrix (the identity matrix by default).
default initialization is performed in the default constructor.
constructs a new Matrix with identity.
!shall be called from any other constructor!
Constructs a matrix that represents translation
@param tx
@param ty
Creates a Matrix with 6 specified entries
@param a
@param b
@param c
@param d
@param e
@param f
multiplies this matrix by 'b' and returns the result
See http://en.wikipedia.org/wiki/Matrix_multiplication
@param by The matrix to multiply by
@return the resulting matrix
Subtracts a matrix from this matrix and returns the results
@param arg the matrix to subtract from this matrix
@return a Matrix object
Computes the determinant of the matrix.
@return the determinant of the matrix
Checks equality of matrices.
@param obj the other Matrix that needs to be compared with this matrix.
@return true if both matrices are equal
@see java.lang.Object#equals(java.lang.Object)
Generates a hash code for this object.
@return the hash code of this object
@see java.lang.Object#hashCode()
Generates a String representation of the matrix.
@return the values, delimited with tabs and newlines.
@see java.lang.Object#toString()
Gets a specific value inside the matrix.
@param index an array index corresponding with a value inside the matrix
@return the value at that specific position.
Attaches a {@link RenderListener} for the corresponding filter set.
@param delegate RenderListener instance to be attached.
@param filterSet filter set to be attached. The delegate will be invoked if all the filters pass.
Paths define shapes, trajectories, and regions of all sorts. They shall be used
to draw lines, define the shapes of filled areas, and specify boundaries for clipping
other graphics. A path shall be composed of straight and curved line segments, which
may connect to one another or may be disconnected.
@since 5.5.6
Adds the subpath to this path.
@param subpath The subpath to be added to this path.
Adds the subpaths to this path.
@param subpaths {@link java.util.List} of subpaths to be added to this path.
Begins a new subpath by moving the current point to coordinates (x, y)
.
Appends a straight line segment from the current point to the point (x, y)
.
Appends a cubic Bezier curve to the current path. The curve shall extend from
the current point to the point (x3, y3)
.
Appends a cubic Bezier curve to the current path. The curve shall extend from
the current point to the point (x3, y3)
with the note that the current
point represents two control points.
Appends a cubic Bezier curve to the current path. The curve shall extend from
the current point to the point (x3, y3)
with the note that the (x3, y3)
point represents two control points.
Appends a rectangle to the current path as a complete subpath.
Closes the current subpath.
Closes all subpathes contained in this path.
Adds additional line to each closed subpath and makes the subpath unclosed.
The line connects the last and the first points of the subpaths.
@returns Indices of modified subpaths.
Path is empty if it contains no subpaths.
@return A {@link java.util.List} of subpaths forming this path.
The current point is the trailing endpoint of the segment most recently added to the current path.
@return The current point.
Contains information relating to construction the current path.
@since 5.5.6
See {@link com.itextpdf.text.pdf.parser.Path#moveTo(float, float)}
See {@link com.itextpdf.text.pdf.parser.Path#lineTo(float, float)}
See {@link com.itextpdf.text.pdf.parser.Path#curveTo(float, float, float, float, float, float)}
See {@link com.itextpdf.text.pdf.parser.Path#curveTo(float, float, float, float)}
See {@link com.itextpdf.text.pdf.parser.Path#curveFromTo(float, float, float, float)}
See {@link com.itextpdf.text.pdf.parser.Path#closeSubpath()}
See {@link com.itextpdf.text.pdf.parser.Path#rectangle(float, float, float, float)}
@param operation Indicates which path-construction operation should be performed.
@param segmentData Contains data of a new segment being added to the current path.
E.g. x, y, w, h for rectangle; x, y for line etc.
@param ctm Current transformation matrix.
See {@link #PathConstructionRenderInfo(int, java.util.List, Matrix)}
@return construction operation should be performed on the current path.
@return {@link java.util.List} containing data of a new segment (E.g. x, y, w, h for rectangle;
x, y for line etc.) if the specified operation relates to adding the segment to the
current path, null
otherwise.
@return Current transformation matrix.
Contains information relating to painting current path.
@since 5.5.6
The nonzero winding number rule determines whether a given point is inside a path by
conceptually drawing a ray from that point to infinity in any direction and then examining
the places where a segment of the path crosses the ray. Starting with a count of 0, the rule
adds 1 each time a path segment crosses the ray from left to right and subtracts 1 each time a
segment crosses from right to left. After counting all the crossings, if the result is 0, the
point is outside the path; otherwise, it is inside.
For more details see PDF spec.
The even-odd rule determines whether a point is inside a path by drawing a ray from that point in
any direction and simply counting the number of path segments that cross the ray, regardless of
direction. If this number is odd, the point is inside; if even, the point is outside.
For more details see PDF spec.
End the path object without filling or stroking it. This operator shall be a path-painting no-op,
used primarily for the side effect of changing the current clipping path
Value specifying stroke operation to perform on the current path.
Value specifying fill operation to perform on the current path. When the fill operation
is performed it should use either nonzero winding or even-odd rule.
@param operation One of the possible combinations of {@link #STROKE} and {@link #FILL} values or {@link #NO_OP}
@param rule Either {@link #NONZERO_WINDING_RULE} or {@link #EVEN_ODD_RULE}.
@param gs The graphics state.
If the operation is {@link #NO_OP} then the rule is ignored,
otherwise {@link #NONZERO_WINDING_RULE} is used by default.
See {@link #PathPaintingRenderInfo(int, int, GraphicsState)}
@return int
value which is either {@link #NO_OP} or one of possible
combinations of {@link #STROKE} and {@link #FILL}
@return Either {@link #NONZERO_WINDING_RULE} or {@link #EVEN_ODD_RULE}.
@return Current transformation matrix.
Tool that parses the content of a PDF document.
@since 2.1.4
Shows the detail of a dictionary.
This is similar to the PdfLister functionality.
@param dic the dictionary of which you want the detail
@return a String representation of the dictionary
Shows the detail of a dictionary.
@param dic the dictionary of which you want the detail
@param depth the depth of the current dictionary (for nested dictionaries)
@return a String representation of the dictionary
Displays a summary of the entries in the XObject dictionary for the stream
@param resourceDic the resource dictionary for the stream
@return a string with the summary of the entries
@throws IOException
@since 5.0.2
Writes information about a specific page from PdfReader to the specified output stream.
@since 2.1.5
@param reader the PdfReader to read the page content from
@param pageNum the page number to read
@param out the output stream to send the content to
@throws IOException
Writes information about each page in a PDF file to the specified output stream.
@since 2.1.5
@param pdfFile a File instance referring to a PDF file
@param out the output stream to send the content to
@throws IOException
Writes information about the specified page in a PDF file to the specified output stream.
@since 2.1.5
@param pdfFile a File instance referring to a PDF file
@param pageNum the page number to read
@param out the output stream to send the content to
@throws IOException
Writes information about each page in a PDF file to the specified file, or System.out.
@param args
Processor for a PDF content Stream.
@since 2.1.4
Default oper
@since 5.0.1
A map with all supported operators (PDF syntax).
Resources for the content stream.
Stack keeping track of the graphics state.
Text matrix.
Text line matrix.
Listener that will be notified of render events
A map with all supported XObject handlers
The font cache.
@since 5.0.6
A stack containing marked content info.
@since 5.0.2
Creates a new PDF Content Stream Processor that will send it's output to the
designated render listener.
@param renderListener the {@link RenderListener} that will receive rendering notifications
Gets the font pointed to by the indirect reference. The font may have been cached.
@param ind the indirect reference ponting to the font
@return the font
@since 5.0.6
Loads all the supported graphics and text state operators in a map.
Resets the graphics state stack, matrices and resources.
Returns the current graphics state.
@return the graphics state
Invokes an oper.
@param oper the PDF Syntax of the oper
@param operands a list with operands
Add to the marked content stack
@param tag the tag of the marked content
@param dict the PdfDictionary associated with the marked content
@since 5.0.2
Remove the latest marked content from the stack. Keeps track of the BMC, BDC and EMC operators.
@since 5.0.2
Used to trigger beginTextBlock on the renderListener
Used to trigger endTextBlock on the renderListener
Displays text.
@param string the text to display
Displays an XObject using the registered handler for this XObject's subtype
@param xobjectName the name of the XObject to retrieve from the resource dictionary
Displays the current path.
@param operation One of the possible combinations of {@link com.itextpdf.text.pdf.parser.PathPaintingRenderInfo#STROKE}
and {@link com.itextpdf.text.pdf.parser.PathPaintingRenderInfo#FILL} values or
{@link com.itextpdf.text.pdf.parser.PathPaintingRenderInfo#NO_OP}
@param rule Either {@link com.itextpdf.text.pdf.parser.PathPaintingRenderInfo#NONZERO_WINDING_RULE} or
{@link com.itextpdf.text.pdf.parser.PathPaintingRenderInfo#EVEN_ODD_RULE}
In case it isn't applicable pass any int
value.
@param close Indicates whether the path should be closed or not.
@since 5.5.6
Modifies the current path.
@param operation Indicates which path-construction operation should be performed.
@param segmentData Contains x, y components of points of a new segment being added to the current path.
E.g. x1 y1 x2 y2 x3 y3 etc. It's ignored for "close subpath" operarion (h).
Adjusts the text matrix for the specified adjustment value (see TJ oper in the PDF spec for information)
@param tj the text adjustment
Processes PDF syntax.
Note: If you re-use a given {@link PdfContentStreamProcessor}, you must call {@link PdfContentStreamProcessor#reset()}
@param contentBytes the bytes of a content stream
@param resources the resources that come with the content stream
Callback when an inline image is found. This requires special handling because inline images don't follow the standard operator syntax
@param info the inline image
@param colorSpaceDic the color space for the inline immage
Gets a color based on a list of operands.
Gets a color based on a list of operands.
@return {@link java.util.Collection} containing all the registered operators strings
@since 5.5.6
Property for the RenderListener object maintained in this class.
Necessary for implementing custom ContentOperator implementations.
@return the renderListener
A resource dictionary that allows stack-like behavior to support resource dictionary inheritance
A content oper implementation (unregistered).
A content oper implementation (TJ).
A content oper implementation (").
A content oper implementation (').
A content oper implementation (Tj).
A content oper implementation (T*).
A content oper implementation (Tm).
A content oper implementation (TD).
A content oper implementation (Td).
A content oper implementation (Tf).
A content oper implementation (Tr).
A content oper implementation (Ts).
A content oper implementation (TL).
A content oper implementation (Tz).
A content oper implementation (Tc).
A content oper implementation (Tw).
A content oper implementation (gs).
A content oper implementation (q).
A content oper implementation (cm).
A content operator implementation (g).
A content operator implementation (G).
A content operator implementation (rg).
A content operator implementation (RG).
A content operator implementation (rg).
A content operator implementation (RG).
A content operator implementation (cs).
A content operator implementation (CS).
A content operator implementation (sc / scn).
A content operator implementation (SC / SCN).
A content oper implementation (Q).
A content oper implementation (BT).
A content oper implementation (ET).
A content oper implementation (BMC).
@since 5.0.2
A content oper implementation (BDC).
@since 5.0.2
A content oper implementation (EMC).
@since 5.0.2
A content oper implementation (Do).
A content operator implementation (w).
A content operator implementation (J).
A content operator implementation (j).
A content operator implementation (M).
A content operator implementation (d).
A content operator implementation (m).
@since 5.5.6
A content operator implementation (l).
@since 5.5.6
A content operator implementation (c).
@since 5.5.6
A content operator implementation (v).
@since 5.5.6
A content operator implementation (y).
@since 5.5.6
A content operator implementation (h).
@since 5.5.6
A content operator implementation (re).
@since 5.5.6
A content operator implementation (S, s, f, F, f*, B, B*, b, b*).
@since 5.5.6
Constructs PainPath object.
@param operation One of the possible combinations of {@link com.itextpdf.text.pdf.parser.PathPaintingRenderInfo#STROKE}
and {@link com.itextpdf.text.pdf.parser.PathPaintingRenderInfo#FILL} values or
{@link com.itextpdf.text.pdf.parser.PathPaintingRenderInfo#NO_OP}
@param rule Either {@link com.itextpdf.text.pdf.parser.PathPaintingRenderInfo#NONZERO_WINDING_RULE} or
{@link com.itextpdf.text.pdf.parser.PathPaintingRenderInfo#EVEN_ODD_RULE}
In case it isn't applicable pass any value.
@param close Indicates whether the path should be closed or not.
A content operator implementation (n).
@since 5.5.6
An XObject subtype handler for FORM
@author Kevin Day
@since iText 5.0.1
An XObject subtype handler for IMAGE
An XObject subtype handler that does nothing
An object that contains an image dictionary and image bytes.
@since 5.0.2
The image dictionary.
The decoded image bytes (after applying filters), or the raw image bytes if unable to decode
Tracks the type of data that is actually stored in the streamBytes member
@return the type of image data that is returned by getImageBytes()
Creates a PdfImage object.
@param stream a PRStream
@throws IOException
Creates a PdfImage object.
@param stream a PRStream
@param colorSpaceDic a color space dictionary
@throws IOException
Creats a PdfImage object using an explicitly provided dictionary and image bytes
@param dictionary the dictionary for the image
@param samples the samples
@since 5.0.3
Returns an entry from the image dictionary.
@param key a key
@return the value
Returns the image dictionary.
@return the dictionary
Sets state of this object according to the color space
@param colorspace the colorspace to use
@param allowIndexed whether indexed color spaces will be resolved (used for recursive call)
@throws IOException if there is a problem with reading from the underlying stream
decodes the bytes currently captured in the streamBytes and replaces it with an image representation of the bytes
(this will either be a png or a tiff, depending on the color depth of the image)
@throws IOException
@return the bytes of the image (the format will be as specified in {@link PdfImageObject#getImageBytesType()}
@throws IOException
@since 5.0.4
Different types of data that can be stored in the bytes of a {@link PdfImageObject}
@since 5.0.4
the recommended file extension for streams of this type
@param fileExtension the recommended file extension for use with data of this type (for example, if the bytes were just saved to a file, what extension should the file have)
@return the file extension registered when this type was created
A filter that does nothing, but keeps track of the filter type that was used
@since 5.0.4
The main interface for creating a new {@link IFilterHandler}
Encapsulates filter behavior for PDF streams. Classes generally interace with this
using the static GetDefaultFilterHandlers() method, then obtain the desired {@link IFilterHandler}
via a lookup.
@since 5.0.4
The default {@link IFilterHandler}s used by iText
@return the default {@link IFilterHandler}s used by iText
The main interface for creating a new {@link IFilterHandler}
Handles FLATEDECODE filter
Handles ASCIIHEXDECODE filter
Handles ASCIIHEXDECODE filter
Handles LZWDECODE filter
Handles CCITTFAXDECODE filter
A filter that doesn't modify the stream at all
Handles RUNLENGTHDECODE filter
A utility class that makes it cleaner to process content from pages of a PdfReader
through a specified RenderListener.
@since 5.0.2
the reader this parser will process
Extracts text from a PDF file.
@since 2.1.4
Extract text from a specified page using an extraction strategy.
Also allows registration of custom ContentOperators
@param reader the reader to extract text from
@param pageNumber the page to extract text from
@param strategy the strategy to use for extracting text
@param additionalContentOperators an optional dictionary of custom IContentOperators for rendering instructions
@return the extracted text
@throws IOException if any operation fails while reading from the provided PdfReader
Extract text from a specified page using an extraction strategy.
@param reader the reader to extract text from
@param pageNumber the page to extract text from
@param strategy the strategy to use for extracting text
@return the extracted text
@throws IOException if any operation fails while reading from the provided PdfReader
@since 5.0.2
A {@link RenderFilter} that only allows text within a specified rectangular region
@since 5.0.1
the region to allow text from
Constructs a filter
@param filterRect the rectangle to filter text against. Note that this is a java.awt.Rectangle !
Constructs a filter
@param filterRect the rectangle to filter text against.
@see com.itextpdf.text.pdf.parser.RenderFilter#allowText(com.itextpdf.text.pdf.parser.TextRenderInfo)
A simple text extraction renderer.
This renderer keeps track of the current Y position of each string. If it detects
that the y position has changed, it inserts a line break into the output. If the
PDF renders text in a non-top-to-bottom fashion, this will result in the text not
being a true representation of how it appears in the PDF.
This renderer also uses a simple strategy based on the font metrics to determine if
a blank space should be inserted into the output.
@since 2.1.5
used to store the resulting String.
Creates a new text extraction renderer.
@since 5.0.1
@since 5.0.1
Returns the result so far.
@return a String with the resulting text.
Used to actually append text to the text results. Subclasses can use this to insert
text that wouldn't normally be included in text parsing (e.g. result of OCR performed against
image content)
@param text the text to append to the text results accumulated so far
Captures text using a simplified algorithm for inserting hard returns and spaces
@param renderInfo render info
no-op method - this renderer isn't interested in image events
@see com.itextpdf.text.pdf.parser.RenderListener#renderImage(com.itextpdf.text.pdf.parser.ImageRenderInfo)
@since 5.0.1
As subpath is a part of a path comprising a sequence of connected segments.
@since 5.5.6
Copy constuctor.
@param subpath
Constructs a new subpath starting at the given point.
Constructs a new subpath starting at the given point.
Sets the start point of the subpath.
@param startPoint
Sets the start point of the subpath.
@param x
@param y
@return The point this subpath starts at.
@return The last point of the subpath.
Adds a segment to the subpath.
Note: each new segment shall start at the end of the previous segment.
@param segment new segment.
@return {@link java.util.List} comprising all the segments
the subpath made on.
Checks whether subpath is empty or not.
@return true if the subpath is empty, false otherwise.
@return true
if this subpath contains only one point and it is not closed,
false
otherwise
Returns a bool
indicating whether the subpath is degenerate or not.
A degenerate subpath is the subpath consisting of a single-point closed path or of
two or more points at the same coordinates.
@return bool
value indicating whether the path is degenerate or not.
@since 5.5.6
@return {@link java.util.List} containing points of piecewise linear approximation
for this subpath.
@since 5.5.6
Returns or sets a bool
value indicating whether the subpath must be closed or not.
Ignore this value if the subpath is a rectangle because in this case it is already closed
(of course if you paint the path using re
operator)
@return bool
value indicating whether the path must be closed or not.
@since 5.5.6
Converts a tagged PDF document into an XML file.
@since 5.0.2
The reader obj from which the content streams are read.
The writer obj to which the XML will be written
Parses a string with structured content.
@param reader
the PdfReader that has access to the PDF file
@param os
the Stream to which the resulting xml will be written
@param charset
the charset to encode the data
@since 5.0.5
Parses a string with structured content.
@param reader
the PdfReader that has access to the PDF file
@param os
the Stream to which the resulting xml will be written
Inspects a child of a structured element. This can be an array or a
dictionary.
@param k
the child to inspect
@throws IOException
If the child of a structured element is an array, we need to loop over
the elements.
@param k
the child array to inspect
If the child of a structured element is a dictionary, we inspect the
child; we may also draw a tag.
@param k
the child dictionary to inspect
If the child of a structured element is a dictionary, we inspect the
child; we may also draw a tag.
@param k
the child dictionary to inspect
Searches for a tag in a page.
@param tag
the name of the tag
@param obj
an identifier to find the marked content
@param page
a page dictionary
@throws IOException
Allows you to find the rectangle that contains all the text in a page.
@since 5.0.2
Method invokes by the PdfContentStreamProcessor.
Passes a TextRenderInfo for every text chunk that is encountered.
We'll use this object to obtain coordinates.
@see com.itextpdf.text.pdf.parser.RenderListener#renderText(com.itextpdf.text.pdf.parser.TextRenderInfo)
Getter for the left margin.
@return the X position of the left margin
Getter for the bottom margin.
@return the Y position of the bottom margin
Getter for the right margin.
@return the X position of the right margin
Getter for the top margin.
@return the Y position of the top margin
Gets the width of the text block.
@return a width
Gets the height of the text block.
@return a height
@see com.itextpdf.text.pdf.parser.RenderListener#beginTextBlock()
@see com.itextpdf.text.pdf.parser.RenderListener#endTextBlock()
@see com.itextpdf.text.pdf.parser.RenderListener#renderImage(com.itextpdf.text.pdf.parser.ImageRenderInfo)
! .NET SPECIFIC !
is used for caching "UTF-16BE" encoding to improve performance
Array containing marked content info for the text.
@since 5.0.2
Creates a new TextRenderInfo object
@param string the PDF string that should be displayed
@param gs the graphics state (note: at this time, this is not immutable, so don't cache it)
@param textMatrix the text matrix at the time of the render operation
@param markedContentInfo the marked content sequence, if available
Used for creating sub-TextRenderInfos for each individual character
@param parent the parent TextRenderInfo
@param string the content of a TextRenderInfo
@param horizontalOffset the unscaled horizontal offset of the character that this TextRenderInfo represents
@since 5.3.3
@return the text to render
Checks if the text belongs to a marked content sequence
with a given mcid.
@param mcid a marked content id
@return true if the text is marked with this id
@since 5.0.2
* Checks if the text belongs to a marked content sequence
* with a given mcid.
* @param mcid a marked content id
* @param checkTheTopmostLevelOnly indicates whether to check the topmost level of marked content stack only
* @return true if the text is marked with this id
* @since 5.3.5
@return the marked content associated with the TextRenderInfo instance.
@return the unscaled (i.e. in Text space) width of the text
Gets the baseline for the text (i.e. the line that the text 'sits' on)
This value includes the Rise of the draw operation - see {@link #getRise()} for the amount added by Rise
@return the baseline line segment
@since 5.0.2
Gets the ascentline for the text (i.e. the line that represents the topmost extent that a string of the current font could have)
This value includes the Rise of the draw operation - see {@link #getRise()} for the amount added by Rise
@return the ascentline line segment
@since 5.0.2
Gets the descentline for the text (i.e. the line that represents the bottom most extent that a string of the current font could have)
This value includes the Rise of the draw operation - see {@link #getRise()} for the amount added by Rise
@return the descentline line segment
@since 5.0.2
Getter for the font
@return the font
@since iText 5.0.2
The rise represents how far above the nominal baseline the text should be rendered. The {@link #getBaseline()}, {@link #getAscentLine()} and {@link #getDescentLine()} methods already include Rise.
This method is exposed to allow listeners to determine if an explicit rise was involved in the computation of the baseline (this might be useful, for example, for identifying superscript rendering)
@return The Rise for the text draw operation, in user space units (Ts value, scaled to user space)
@since 5.3.3
@param width the width, in text space
@return the width in user space
@since 5.3.3
@param height the height, in text space
@return the height in user space
@since 5.3.3
@return The width, in user space units, of a single space character in the current font
@return the text render mode that should be used for the text. From the
PDF specification, this means:
- 0 = Fill text
- 1 = Stroke text
- 2 = Fill, then stroke text
- 3 = Invisible
- 4 = Fill text and add to path for clipping
- 5 = Stroke text and add to path for clipping
- 6 = Fill, then stroke text and add to path for clipping
- 7 = Add text to padd for clipping
@since iText 5.0.1
@return the current fill color.
@return the current stroke color.
Calculates the width of a space character. If the font does not define
a width for a standard space character \u0020, we also attempt to use
the width of \u00A0 (a non-breaking space in many fonts)
@return the width of a single space character in text space units
Gets the width of a String in text space units
@param string the string that needs measuring
@return the width of a String in text space units
Gets the width of a PDF string in text space units
@param string the string that needs measuring
@return the width of a String in text space units
Provides detail useful if a listener needs access to the position of each individual glyph in the text render operation
@return A list of {@link TextRenderInfo} objects that represent each glyph used in the draw operation. The next effect is if there was a separate Tj opertion for each character in the rendered string
@since 5.3.3
Calculates width and word spacing of a single character PDF string.
@param string a character to calculate width.
@param singleCharString true if PDF string represents single character, false otherwise.
@return array of 2 items: first item is a character width, second item is a calculated word spacing.
Decodes a PdfString (which will contain glyph ids encoded in the font's encoding)
based on the active font, and determine the unicode equivalent
@param in the String that needs to be encoded
@return the encoded String
! .NET SPECIFIC; this method is used to avoid unecessary using of StringBuilder because it is slow in .NET !
Decodes a single character PdfString (which will contain glyph ids encoded in the font's encoding)
based on the active font, and determine the unicode equivalent
@param in the String that needs to be encoded
@return the encoded String
Converts a single character string to char code.
@param string single character string to convert to.
@return char code.
Split PDF string into array of single character PDF strings.
@param string PDF string to be splitted.
@return splitted PDF string.
@return original PDF string
index of the X coordinate
index of the Y coordinate
index of the Z coordinate
the values inside the vector
Creates a new Vector
@param x the X coordinate
@param y the Y coordinate
@param z the Z coordinate
Computes the cross product of this vector and the specified matrix
@param by the matrix to cross this vector with
@return the result of the cross product
Computes the difference between this vector and the specified vector
@param v the vector to subtract from this one
@return the results of the subtraction
Computes the cross product of this vector and the specified vector
@param with the vector to cross this vector with
@return the cross product
Normalizes the vector (i.e. returns the unit vector in the same orientation as this vector)
@return the unit vector
@since 5.0.1
Multiplies the vector by a scalar
@param by the scalar to multiply by
@return the result of the scalar multiplication
@since 5.0.1
Computes the dot product of this vector with the specified vector
@param with the vector to dot product this vector with
@return the dot product
@see java.lang.Object#toString()
@since 5.0.1
@see java.lang.Object#equals(java.lang.Object)
Gets the value from a coordinate of the vector
@param index the index of the value to get (I1, I2 or I3)
@return a coordinate value
Represents a pattern. Can be used in high-level constructs (Paragraph, Cell, etc.).
The actual pattern.
Creates a color representing a pattern.
@param painter the actual pattern
Gets the pattern.
@return the pattern
Each PDF document can contain maximum 1 AcroForm.
This is a map containing FieldTemplates.
This is an array containing DocumentFields.
This is an array containing the calculationorder of the fields.
Contains the signature flags.
Creates new PdfAcroForm
Adds fieldTemplates.
Adds documentFields.
Closes the AcroForm.
Adds an object to the calculationOrder.
Adds a formfield to the AcroForm.
@param field
@param name
@param llx
@param lly
@param urx
@param ury
@param field
@param llx
@param lly
@param urx
@param ury
Sets the signature flags.
A PdfAction
defines an action that can be triggered from a PDF file.
@see PdfDictionary
A named action to go to the first page.
A named action to go to the previous page.
A named action to go to the next page.
A named action to go to the last page.
A named action to open a print dialog.
a possible submitvalue
a possible submitvalue
a possible submitvalue
a possible submitvalue
a possible submitvalue
a possible submitvalue
a possible submitvalue
a possible submitvalue
a possible submitvalue
Create an empty action.
Constructs a new PdfAction
of Subtype URI.
@param url the Url to go to
Constructs a new PdfAction
of Subtype URI.
@param url the url to go to
Constructs a new PdfAction
of Subtype GoTo.
@param destination the destination to go to
Constructs a new PdfAction
of Subtype GoToR.
@param filename the file name to go to
@param name the named destination to go to
Constructs a new PdfAction
of Subtype GoToR.
@param filename the file name to go to
@param page the page destination to go to
Implements name actions. The action can be FIRSTPAGE, LASTPAGE,
NEXTPAGE and PREVPAGE.
@param named the named action
Launchs an application or a document.
@param application the application to be launched or the document to be opened or printed.
@param parameters (Windows-specific) A parameter string to be passed to the application.
It can be null
.
@param operation (Windows-specific) the operation to perform: "open" - Open a document,
"print" - Print a document.
It can be null
.
@param defaultDir (Windows-specific) the default directory in standard DOS syntax.
It can be null
.
Launchs an application or a document.
@param application the application to be launched or the document to be opened or printed.
@param parameters (Windows-specific) A parameter string to be passed to the application.
It can be null
.
@param operation (Windows-specific) the operation to perform: "open" - Open a document,
"print" - Print a document.
It can be null
.
@param defaultDir (Windows-specific) the default directory in standard DOS syntax.
It can be null
.
@return a Launch action
Creates a Rendition action
@param file
@param fs
@param mimeType
@param ref
@return a Media Clip action
@throws IOException
Creates a JavaScript action. If the JavaScript is smaller than
50 characters it will be placed as a string, otherwise it will
be placed as a compressed stream.
@param code the JavaScript code
@param writer the writer for this action
@param unicode select JavaScript unicode. Note that the internal
Acrobat JavaScript engine does not support unicode,
so this may or may not work for you
@return the JavaScript action
Creates a JavaScript action. If the JavaScript is smaller than
50 characters it will be place as a string, otherwise it will
be placed as a compressed stream.
@param code the JavaScript code
@param writer the writer for this action
@return the JavaScript action
Add a chained action.
@param na the next action
Creates a GoTo action to an internal page.
@param page the page to go. First page is 1
@param dest the destination for the page
@param writer the writer for this action
@return a GoTo action
Creates a GoTo action to a named destination.
@param dest the named destination
@param isName if true sets the destination as a name, if false sets it as a String
@return a GoToR action
Creates a GoToR action to a named destination.
@param filename the file name to go to
@param dest the destination name
@param isName if true sets the destination as a name, if false sets it as a String
@param newWindow open the document in a new window if true
, if false the current document is replaced by the new document.
@return a GoToR action
Creates a GoToE action to an embedded file.
@param filename the root document of the target (null if the target is in the same document)
@param dest the named destination
@param isName if true sets the destination as a name, if false sets it as a String
@return a GoToE action
Creates a GoToE action to an embedded file.
@param filename the root document of the target (null if the target is in the same document)
@param target a path to the target document of this action
@param dest the destination inside the target document, can be of type PdfDestination, PdfName, or PdfString
@param newWindow if true, the destination document should be opened in a new window
@return a GoToE action
A PdfAnnotation
is a note that is associated with a page.
@see PdfDictionary
flagvalue PDF 1.7
attributevalue
Holds value of property used.
Holds value of property placeInPage.
Constructs a new PdfAnnotation
of subtype text.
Constructs a new PdfAnnotation
of subtype link (Action).
Creates a screen PdfAnnotation
@param writer
@param rect
@param clipTitle
@param fs
@param mimeType
@param playOnDisplay
@return a screen PdfAnnotation
@throws IOException
Creates a file attachment annotation.
@param writer the PdfWriter
@param rect the dimensions in the page of the annotation
@param contents the file description
@param fileStore an array with the file. If it's null
the file will be read from the disk
@param file the path to the file. It will only be used if
fileStore
is not null
@param fileDisplay the actual file name stored in the pdf
@throws IOException on error
@return the annotation
Creates a file attachment annotation
@param writer
@param rect
@param contents
@param fs
@return the annotation
@throws IOException
Creates a polygon or -line annotation
@param writer the PdfWriter
@param rect the annotation position
@param contents the textual content of the annotation
@param polygon if true, the we're creating a polygon annotation, if false, a polyline
@param vertices an array with the vertices of the polygon or -line
@since 5.0.2
Sets the annotation's highlighting mode. The values can be
HIGHLIGHT_NONE
, HIGHLIGHT_INVERT
,
HIGHLIGHT_OUTLINE
and HIGHLIGHT_PUSH
;
@param highlight the annotation's highlighting mode
Getter for property form.
@return Value of property form.
Getter for property annotation.
@return Value of property annotation.
Getter for property placeInPage.
@return Value of property placeInPage.
Sets the layer this annotation belongs to.
@param layer the layer this annotation belongs to
Sets the name of the annotation.
With this name the annotation can be identified among
all the annotations on a page (it has to be unique).
This class processes links from imported pages so that they may be active. The following example code reads a group
of files and places them all on the output PDF, four pages in a single page, keeping the links active.
String[] files = new String[] {"input1.pdf", "input2.pdf"};
String outputFile = "output.pdf";
int firstPage=1;
Document document = new Document();
PdfWriter writer = PdfWriter.GetInstance(document, new FileOutputStream(outputFile));
document.SetPageSize(PageSize.A4);
float W = PageSize.A4.GetWidth() / 2;
float H = PageSize.A4.GetHeight() / 2;
document.Open();
PdfContentByte cb = writer.GetDirectContent();
for (int i = 0; i < files.length; i++) {
PdfReader currentReader = new PdfReader(files[i]);
currentReader.ConsolidateNamedDestinations();
for (int page = 1; page <= currentReader.GetNumberOfPages(); page++) {
PdfImportedPage importedPage = writer.GetImportedPage(currentReader, page);
float a = 0.5f;
float e = (page % 2 == 0) ? W : 0;
float f = (page % 4 == 1 || page % 4 == 2) ? H : 0;
ArrayList links = currentReader.GetLinks(page);
cb.AddTemplate(importedPage, a, 0, 0, a, e, f);
for (int j = 0; j < links.Size(); j++) {
PdfAnnotation.PdfImportedLink link = (PdfAnnotation.PdfImportedLink)links.Get(j);
if (link.IsInternal()) {
int dPage = link.GetDestinationPage();
int newDestPage = (dPage-1)/4 + firstPage;
float ee = (dPage % 2 == 0) ? W : 0;
float ff = (dPage % 4 == 1 || dPage % 4 == 2) ? H : 0;
link.SetDestinationPage(newDestPage);
link.TransformDestination(a, 0, 0, a, ee, ff);
}
link.TransformRect(a, 0, 0, a, e, f);
writer.AddAnnotation(link.CreateAnnotation(writer));
}
if (page % 4 == 0)
document.NewPage();
}
if (i < files.length - 1)
document.NewPage();
firstPage += (currentReader.GetNumberOfPages()+3)/4;
}
document.Close();
Returns a String representation of the link.
@return a String representation of the imported link
@since 2.1.6
Implements the appearance stream to be used with form fields..
Implements the form XObject.
PdfContentByte
is an object containing the user positioned
text and graphic contents of a page. It knows how to apply the proper
font encoding.
The alignement is center
The alignement is left
The alignement is right
A possible line cap value
A possible line cap value
A possible line cap value
A possible line join value
A possible line join value
A possible line join value
A possible text rendering value
A possible text rendering value
A possible text rendering value
A possible text rendering value
A possible text rendering value
A possible text rendering value
A possible text rendering value
A possible text rendering value
This is the actual content
This is the writer
This is the PdfDocument
This is the GraphicState in use
The list were we save/restore the layer depth
The list were we save/restore the state
The separator between commands.
Constructs a new PdfContentByte
-object.
@param wr the writer associated to this content
Returns the string
representation of this PdfContentByte
-object.
@return a string
Checks if the content needs to be tagged.
@return false if no tags need to be added
Returns the PDF representation of this PdfContentByte
-object.
@param writer the PdfWriter
@return a byte
array with the representation
Adds the content of another PdfContent
-object to this object.
@param other another PdfByteContent
-object
Set the rendering intent, possible values are: PdfName.ABSOLUTECOLORIMETRIC,
PdfName.RELATIVECOLORIMETRIC, PdfName.SATURATION, PdfName.PERCEPTUAL.
@param ri
Modify the current clipping path by intersecting it with the current path, using the
nonzero winding number rule to determine which regions lie inside the clipping
path.
Modify the current clipping path by intersecting it with the current path, using the
even-odd rule to determine which regions lie inside the clipping path.
Changes the currentgray tint for filling paths (device dependent colors!).
Sets the color space to DeviceGray (or the DefaultGray color space),
and sets the gray tint to use for filling paths.
@param gray a value between 0 (black) and 1 (white)
Changes the current gray tint for filling paths to black.
Changes the currentgray tint for stroking paths (device dependent colors!).
Sets the color space to DeviceGray (or the DefaultGray color space),
and sets the gray tint to use for stroking paths.
@param gray a value between 0 (black) and 1 (white)
Changes the current gray tint for stroking paths to black.
Helper to validate and write the RGB color components
@param red the intensity of red. A value between 0 and 1
@param green the intensity of green. A value between 0 and 1
@param blue the intensity of blue. A value between 0 and 1
Changes the current color for filling paths (device dependent colors!).
Sets the color space to DeviceRGB (or the DefaultRGB color space),
and sets the color to use for filling paths.
Following the PDF manual, each operand must be a number between 0 (minimum intensity) and
1 (maximum intensity).
@param red the intensity of red. A value between 0 and 1
@param green the intensity of green. A value between 0 and 1
@param blue the intensity of blue. A value between 0 and 1
Changes the current color for filling paths to black.
Changes the current color for stroking paths to black.
Helper to validate and write the CMYK color components.
@param cyan the intensity of cyan. A value between 0 and 1
@param magenta the intensity of magenta. A value between 0 and 1
@param yellow the intensity of yellow. A value between 0 and 1
@param black the intensity of black. A value between 0 and 1
Changes the current color for filling paths (device dependent colors!).
Sets the color space to DeviceCMYK (or the DefaultCMYK color space),
and sets the color to use for filling paths.
Following the PDF manual, each operand must be a number between 0 (no ink) and
1 (maximum ink).
@param cyan the intensity of cyan. A value between 0 and 1
@param magenta the intensity of magenta. A value between 0 and 1
@param yellow the intensity of yellow. A value between 0 and 1
@param black the intensity of black. A value between 0 and 1
Changes the current color for filling paths to black.
Changes the current color for stroking paths to black.
Move the current point (x, y), omitting any connecting line segment.
@param x new x-coordinate
@param y new y-coordinate
Move the current point (x, y), omitting any connecting line segment.
@param x new x-coordinate
@param y new y-coordinate
Appends a straight line segment from the current point (x, y). The new current
point is (x, y).
@param x new x-coordinate
@param y new y-coordinate
Appends a straight line segment from the current point (x, y). The new current
point is (x, y).
@param x new x-coordinate
@param y new y-coordinate
Appends a Bezier curve to the path, starting from the current point.
@param x1 x-coordinate of the first control point
@param y1 y-coordinate of the first control point
@param x2 x-coordinate of the second control point
@param y2 y-coordinate of the second control point
@param x3 x-coordinaat of the ending point (= new current point)
@param y3 y-coordinaat of the ending point (= new current point)
Appends a Bezier curve to the path, starting from the current point.
@param x1 x-coordinate of the first control point
@param y1 y-coordinate of the first control point
@param x2 x-coordinate of the second control point
@param y2 y-coordinate of the second control point
@param x3 x-coordinaat of the ending point (= new current point)
@param y3 y-coordinaat of the ending point (= new current point)
Appends a Bezier curve to the path, starting from the current point.
@param x2 x-coordinate of the second control point
@param y2 y-coordinate of the second control point
@param x3 x-coordinaat of the ending point (= new current point)
@param y3 y-coordinaat of the ending point (= new current point)
Appends a Bezier curve to the path, starting from the current point.
@param x2 x-coordinate of the second control point
@param y2 y-coordinate of the second control point
@param x3 x-coordinaat of the ending point (= new current point)
@param y3 y-coordinaat of the ending point (= new current point)
Appends a Bezier curve to the path, starting from the current point.
@param x1 x-coordinate of the first control point
@param y1 y-coordinate of the first control point
@param x3 x-coordinaat of the ending point (= new current point)
@param y3 y-coordinaat of the ending point (= new current point)
Appends a Bezier curve to the path, starting from the current point.
@param x1 x-coordinate of the first control point
@param y1 y-coordinate of the first control point
@param x3 x-coordinaat of the ending point (= new current point)
@param y3 y-coordinaat of the ending point (= new current point)
Draws a circle. The endpoint will (x+r, y).
@param x x center of circle
@param y y center of circle
@param r radius of circle
Draws a circle. The endpoint will (x+r, y).
@param x x center of circle
@param y y center of circle
@param r radius of circle
Adds a rectangle to the current path.
@param x x-coordinate of the starting point
@param y y-coordinate of the starting point
@param w width
@param h height
Adds a rectangle to the current path.
@param x x-coordinate of the starting point
@param y y-coordinate of the starting point
@param w width
@param h height
Adds a variable width border to the current path.
Only use if {@link com.lowagie.text.Rectangle#isUseVariableBorders() Rectangle.isUseVariableBorders}
= true.
@param rect a Rectangle
Adds a border (complete or partially) to the current path..
@param rectangle a Rectangle
Closes the current subpath by appending a straight line segment from the current point
to the starting point of the subpath.
Ends the path without filling or stroking it.
Strokes the path.
Closes the path and strokes it.
Fills the path, using the non-zero winding number rule to determine the region to fill.
Fills the path, using the even-odd rule to determine the region to fill.
Fills the path using the non-zero winding number rule to determine the region to fill and strokes it.
Closes the path, fills it using the non-zero winding number rule to determine the region to fill and strokes it.
Fills the path, using the even-odd rule to determine the region to fill and strokes it.
Closes the path, fills it using the even-odd rule to determine the region to fill and strokes it.
Adds an Image
to the page. The Image
must have
absolute positioning.
@param image the Image
object
@throws DocumentException if the Image
does not have absolute positioning
Adds an Image
to the page. The Image
must have
absolute positioning. The image can be placed inline.
@param image the Image
object
@param inlineImage true
to place this image inline, false
otherwise
@throws DocumentException if the Image
does not have absolute positioning
Adds an Image
to the page. The positioning of the Image
is done with the transformation matrix. To position an image
at (x,y)
use AddImage(image, image_width, 0, 0, image_height, x, y).
@param image the Image
object
@param a an element of the transformation matrix
@param b an element of the transformation matrix
@param c an element of the transformation matrix
@param d an element of the transformation matrix
@param e an element of the transformation matrix
@param f an element of the transformation matrix
@throws DocumentException on error
Adds an Image
to the page. The positioning of the Image
is done with the transformation matrix. To position an image
at (x,y)
use AddImage(image, image_width, 0, 0, image_height, x, y).
@param image the Image
object
@param a an element of the transformation matrix
@param b an element of the transformation matrix
@param c an element of the transformation matrix
@param d an element of the transformation matrix
@param e an element of the transformation matrix
@param f an element of the transformation matrix
@throws DocumentException on error
adds an image with the given matrix.
@param image image to add
@param transform transform to apply to the template prior to adding it.
adds an image with the given matrix.
@param image image to add
@param transform transform to apply to the template prior to adding it.
@since 5.0.1
Adds an Image
to the page. The positioning of the Image
is done with the transformation matrix. To position an image
at (x,y)
use AddImage(image, image_width, 0, 0, image_height, x, y). The image can be placed inline.
@param image the Image
object
@param a an element of the transformation matrix
@param b an element of the transformation matrix
@param c an element of the transformation matrix
@param d an element of the transformation matrix
@param e an element of the transformation matrix
@param f an element of the transformation matrix
@param inlineImage true
to place this image inline, false
otherwise
@throws DocumentException on error
Adds an Image
to the page. The positioning of the Image
is done with the transformation matrix. To position an image
at (x,y)
use AddImage(image, image_width, 0, 0, image_height, x, y). The image can be placed inline.
@param image the Image
object
@param a an element of the transformation matrix
@param b an element of the transformation matrix
@param c an element of the transformation matrix
@param d an element of the transformation matrix
@param e an element of the transformation matrix
@param f an element of the transformation matrix
@param inlineImage true
to place this image inline, false
otherwise
@throws DocumentException on error
Adds an Image
to the page. The positioning of the Image
is done with the transformation matrix. To position an image
at (x,y)
The image can be placed inline.
@param image the Image
object
@param a an element of the transformation matrix
@param b an element of the transformation matrix
@param c an element of the transformation matrix
@param d an element of the transformation matrix
@param e an element of the transformation matrix
@param f an element of the transformation matrix
@param inlineImage true
to place this image inline, false
otherwise
@param isMCBlockOpened true
not to open MCBlock, false
otherwise
@throws DocumentException on error
Makes this PdfContentByte
empty.
Calls reset( true )
Makes this PdfContentByte
empty.
@param validateContent will call sanityCheck()
if true.
@since 2.1.6
Starts the writing of text.
@param restoreTM indicates if to restore text matrix of the previous text block.
Starts the writing of text.
Ends the writing of text and makes the current font invalid.
Saves the graphic state. saveState
and
restoreState
must be balanced.
Restores the graphic state. saveState
and
restoreState
must be balanced.
Sets the character spacing parameter.
@param charSpace a parameter
Sets the word spacing parameter.
@param wordSpace a parameter
Sets the horizontal scaling parameter.
@param scale a parameter
Set the font and the size for the subsequent text writing.
@param bf the font
@param size the font size in points
Sets the text rendering parameter.
@param rendering a parameter
Sets the text rise parameter.
This allows to write text in subscript or basescript mode.
@param rise a parameter
Sets the text rise parameter.
This allows to write text in subscript or basescript mode.
@param rise a parameter
A helper to insert into the content stream the text
converted to bytes according to the font's encoding.
@param text the text to write
Shows the text
.
@param text the text to write
Constructs a kern array for a text in a certain font
@param text the text
@param font the font
@return a PdfTextArray
Shows the text
kerned.
@param text the text to write
Moves to the next line and shows text
.
@param text the text to write
Moves to the next line and shows text string, using the given values of the character and word spacing parameters.
@param wordSpacing a parameter
@param charSpacing a parameter
@param text the text to write
Changes the text matrix.
Remark: this operation also initializes the current point position.
@param a operand 1,1 in the matrix
@param b operand 1,2 in the matrix
@param c operand 2,1 in the matrix
@param d operand 2,2 in the matrix
@param x operand 3,1 in the matrix
@param y operand 3,2 in the matrix
Changes the text matrix. The first four parameters are {1,0,0,1}.
Remark: this operation also initializes the current point position.
@param x operand 3,1 in the matrix
@param y operand 3,2 in the matrix
Moves to the start of the next line, offset from the start of the current line.
@param x x-coordinate of the new current point
@param y y-coordinate of the new current point
Moves to the start of the next line, offset from the start of the current line.
As a side effect, this sets the leading parameter in the text state.
@param x offset of the new current point
@param y y-coordinate of the new current point
Moves to the start of the next line.
Adds a named outline to the document.
@param outline the outline
@param name the name for the local destination
Computes the width of the given string taking in account
the current values of "Character spacing", "Word Spacing"
and "Horizontal Scaling".
The additional spacing is not computed for the last character
of the string.
@param text the string to get width of
@param kerned the kerning option
@return the width
Computes the width of the given string taking in account
the current values of "Character spacing", "Word Spacing"
and "Horizontal Scaling".
The spacing for the last character is also computed.
It also takes into account kerning that can be specified within TJ operator (e.g. [(Hello) 123 (World)] TJ)
@param text the string to get width of
@param kerned the kerning option
@param kerning the kerning option from TJ array
@return the width
Shows text right, left or center aligned with rotation.
@param alignment the alignment can be ALIGN_CENTER, ALIGN_RIGHT or ALIGN_LEFT
@param text the text to show
@param x the x pivot position
@param y the y pivot position
@param rotation the rotation to be applied in degrees counterclockwise
Shows text kerned right, left or center aligned with rotation.
@param alignment the alignment can be ALIGN_CENTER, ALIGN_RIGHT or ALIGN_LEFT
@param text the text to show
@param x the x pivot position
@param y the y pivot position
@param rotation the rotation to be applied in degrees counterclockwise
Concatenate a matrix to the current transformation matrix.
@param transform added to the Current Transformation Matrix
Concatenate a matrix to the current transformation matrix.
@param transform added to the Current Transformation Matrix
@since 5.0.1
Draws a partial ellipse inscribed within the rectangle x1,y1,x2,y2,
starting at startAng degrees and covering extent degrees. Angles
start with 0 to the right (+x) and increase counter-clockwise.
@param x1 a corner of the enclosing rectangle
@param y1 a corner of the enclosing rectangle
@param x2 a corner of the enclosing rectangle
@param y2 a corner of the enclosing rectangle
@param startAng starting angle in degrees
@param extent angle extent in degrees
Draws a partial ellipse inscribed within the rectangle x1,y1,x2,y2,
starting at startAng degrees and covering extent degrees. Angles
start with 0 to the right (+x) and increase counter-clockwise.
@param x1 a corner of the enclosing rectangle
@param y1 a corner of the enclosing rectangle
@param x2 a corner of the enclosing rectangle
@param y2 a corner of the enclosing rectangle
@param startAng starting angle in degrees
@param extent angle extent in degrees
Draws an ellipse inscribed within the rectangle x1,y1,x2,y2.
@param x1 a corner of the enclosing rectangle
@param y1 a corner of the enclosing rectangle
@param x2 a corner of the enclosing rectangle
@param y2 a corner of the enclosing rectangle
Draws an ellipse inscribed within the rectangle x1,y1,x2,y2.
@param x1 a corner of the enclosing rectangle
@param y1 a corner of the enclosing rectangle
@param x2 a corner of the enclosing rectangle
@param y2 a corner of the enclosing rectangle
Create a new colored tiling pattern.
@param width the width of the pattern
@param height the height of the pattern
@param xstep the desired horizontal spacing between pattern cells.
May be either positive or negative, but not zero.
@param ystep the desired vertical spacing between pattern cells.
May be either positive or negative, but not zero.
@return the PdfPatternPainter
where the pattern will be created
Create a new colored tiling pattern. Variables xstep and ystep are set to the same values
of width and height.
@param width the width of the pattern
@param height the height of the pattern
@return the PdfPatternPainter
where the pattern will be created
Create a new uncolored tiling pattern.
@param width the width of the pattern
@param height the height of the pattern
@param xstep the desired horizontal spacing between pattern cells.
May be either positive or negative, but not zero.
@param ystep the desired vertical spacing between pattern cells.
May be either positive or negative, but not zero.
@param color the default color. Can be null
@return the PdfPatternPainter
where the pattern will be created
Create a new uncolored tiling pattern.
Variables xstep and ystep are set to the same values
of width and height.
@param width the width of the pattern
@param height the height of the pattern
@param color the default color. Can be null
@return the PdfPatternPainter
where the pattern will be created
Creates a new appearance to be used with form fields.
@param width the bounding box width
@param height the bounding box height
@return the appearance created
Adds a PostScript XObject to this content.
@param psobject the object
Adds a template to this content.
@param template the template
@param a an element of the transformation matrix
@param b an element of the transformation matrix
@param c an element of the transformation matrix
@param d an element of the transformation matrix
@param e an element of the transformation matrix
@param f an element of the transformation matrix
Adds a template to this content.
@param template the template
@param a an element of the transformation matrix
@param b an element of the transformation matrix
@param c an element of the transformation matrix
@param d an element of the transformation matrix
@param e an element of the transformation matrix
@param f an element of the transformation matrix
Adds a template to this content.
@param template the template
@param a an element of the transformation matrix
@param b an element of the transformation matrix
@param c an element of the transformation matrix
@param d an element of the transformation matrix
@param e an element of the transformation matrix
@param f an element of the transformation matrix
@param tagContent true
- template content will be tagged(all that will be added after), false
- only a Do operator will be tagged.
taken into account only if isTagged()
- true
.
Adds a template to this content.
@param template the template
@param a an element of the transformation matrix
@param b an element of the transformation matrix
@param c an element of the transformation matrix
@param d an element of the transformation matrix
@param e an element of the transformation matrix
@param f an element of the transformation matrix
@param tagContent true
- template content will be tagged(all that will be added after), false
- only a Do operator will be tagged.
taken into account only if isTagged()
- true
.
Adds a template to this content.
@param template the template
@param a an element of the transformation matrix
@param b an element of the transformation matrix
@param c an element of the transformation matrix
@param d an element of the transformation matrix
@param e an element of the transformation matrix
@param f an element of the transformation matrix
@param tagContent true
- template content will be tagged(all that will be added after), false
- only a Do operator will be tagged.
taken into account only if isTagged()
- true
.
Adds a form XObject to this content.
@param formXObj the form XObject
@param name the name of form XObject in content stream. The name is changed, if if it already exists in page resources
@param a an element of the transformation matrix
@param b an element of the transformation matrix
@param c an element of the transformation matrix
@param d an element of the transformation matrix
@param e an element of the transformation matrix
@param f an element of the transformation matrix
@return Name under which XObject was stored in resources. See name
parameter
Adds a form XObject to this content.
@param formXObj the form XObject
@param name the name of form XObject in content stream. The name is changed, if if it already exists in page resources
@param a an element of the transformation matrix
@param b an element of the transformation matrix
@param c an element of the transformation matrix
@param d an element of the transformation matrix
@param e an element of the transformation matrix
@param f an element of the transformation matrix
@return Name under which XObject was stored in resources. See name
parameter
adds a template with the given matrix.
@param template template to add
@param transform transform to apply to the template prior to adding it.
adds a template with the given matrix.
@param template template to add
@param transform transform to apply to the template prior to adding it.
@param tagContent true
- template content will be tagged(all that will be added after), false
- only a Do operator will be tagged.
taken into account only if isTagged()
- true
.
adds a template with the given matrix.
@param template template to add
@param transform transform to apply to the template prior to adding it.
@param tagContent true
- template content will be tagged(all that will be added after), false
- only a Do operator will be tagged.
taken into account only if isTagged()
- true
.
adds a template with the given matrix.
@param template template to add
@param transform transform to apply to the template prior to adding it.
@since 5.0.1
Adds a template to this content.
@param template the template
@param x the x location of this template
@param y the y location of this template
Adds a template to this content.
@param template the template
@param x the x location of this template
@param y the y location of this template
Changes the current color for filling paths (device dependent colors!).
Sets the color space to DeviceCMYK (or the DefaultCMYK color space),
and sets the color to use for filling paths.
This method is described in the 'Portable Document Format Reference Manual version 1.3'
section 8.5.2.1 (page 331).
Following the PDF manual, each operand must be a number between 0 (no ink) and
1 (maximum ink). This method however accepts only ints between 0x00 and 0xFF.
@param cyan the intensity of cyan
@param magenta the intensity of magenta
@param yellow the intensity of yellow
@param black the intensity of black
Changes the current color for stroking paths (device dependent colors!).
Sets the color space to DeviceCMYK (or the DefaultCMYK color space),
and sets the color to use for stroking paths.
This method is described in the 'Portable Document Format Reference Manual version 1.3'
section 8.5.2.1 (page 331).
Following the PDF manual, each operand must be a number between 0 (miniumum intensity) and
1 (maximum intensity). This method however accepts only ints between 0x00 and 0xFF.
@param cyan the intensity of red
@param magenta the intensity of green
@param yellow the intensity of blue
@param black the intensity of black
Changes the current color for filling paths (device dependent colors!).
Sets the color space to DeviceRGB (or the DefaultRGB color space),
and sets the color to use for filling paths.
This method is described in the 'Portable Document Format Reference Manual version 1.3'
section 8.5.2.1 (page 331).
Following the PDF manual, each operand must be a number between 0 (miniumum intensity) and
1 (maximum intensity). This method however accepts only ints between 0x00 and 0xFF.
@param red the intensity of red
@param green the intensity of green
@param blue the intensity of blue
Changes the current color for stroking paths (device dependent colors!).
Sets the color space to DeviceRGB (or the DefaultRGB color space),
and sets the color to use for stroking paths.
This method is described in the 'Portable Document Format Reference Manual version 1.3'
section 8.5.2.1 (page 331).
Following the PDF manual, each operand must be a number between 0 (miniumum intensity) and
1 (maximum intensity). This method however accepts only ints between 0x00 and 0xFF.
@param red the intensity of red
@param green the intensity of green
@param blue the intensity of blue
Sets the stroke color. color
can be an
ExtendedColor
.
@param color the color
Sets the fill color. color
can be an
ExtendedColor
.
@param color the color
Sets the fill color to a spot color.
@param sp the spot color
@param tint the tint for the spot color. 0 is no color and 1
is 100% color
Sets the stroke color to a spot color.
@param sp the spot color
@param tint the tint for the spot color. 0 is no color and 1
is 100% color
Sets the fill color to a pattern. The pattern can be
colored or uncolored.
@param p the pattern
Outputs the color values to the content.
@param color The color
@param tint the tint if it is a spot color, ignored otherwise
Sets the fill color to an uncolored pattern.
@param p the pattern
@param color the color of the pattern
Sets the fill color to an uncolored pattern.
@param p the pattern
@param color the color of the pattern
@param tint the tint if the color is a spot color, ignored otherwise
Sets the stroke color to an uncolored pattern.
@param p the pattern
@param color the color of the pattern
Sets the stroke color to an uncolored pattern.
@param p the pattern
@param color the color of the pattern
@param tint the tint if the color is a spot color, ignored otherwise
Sets the stroke color to a pattern. The pattern can be
colored or uncolored.
@param p the pattern
Paints using a shading object.
@param shading the shading object
Paints using a shading pattern.
@param shading the shading pattern
Sets the shading fill pattern.
@param shading the shading pattern
Sets the shading stroke pattern
@param shading the shading pattern
Check if we have a valid PdfWriter.
Show an array of text.
@param text array of text
Implements a link to other part of the document. The jump will
be made to a local destination with the same name, that must exist.
@param name the name for this link
@param llx the lower left x corner of the activation area
@param lly the lower left y corner of the activation area
@param urx the upper right x corner of the activation area
@param ury the upper right y corner of the activation area
The local destination to where a local goto with the same
name will jump.
@param name the name of this local destination
@param destination the PdfDestination
with the jump coordinates
@return true
if the local destination was added,
false
if a local destination with the same name
already exists
Implements a link to another document.
@param filename the filename for the remote document
@param name the name to jump to
@param llx the lower left x corner of the activation area
@param lly the lower left y corner of the activation area
@param urx the upper right x corner of the activation area
@param ury the upper right y corner of the activation area
Implements a link to another document.
@param filename the filename for the remote document
@param page the page to jump to
@param llx the lower left x corner of the activation area
@param lly the lower left y corner of the activation area
@param urx the upper right x corner of the activation area
@param ury the upper right y corner of the activation area
Adds a round rectangle to the current path.
@param x x-coordinate of the starting point
@param y y-coordinate of the starting point
@param w width
@param h height
@param r radius of the arc corner
Adds a round rectangle to the current path.
@param x x-coordinate of the starting point
@param y y-coordinate of the starting point
@param w width
@param h height
@param r radius of the arc corner
Implements an action in an area.
@param action the PdfAction
@param llx the lower left x corner of the activation area
@param lly the lower left y corner of the activation area
@param urx the upper right x corner of the activation area
@param ury the upper right y corner of the activation area
Outputs a string
directly to the content.
@param s the string
Outputs a char
directly to the content.
@param c the char
Outputs a float
directly to the content.
@param n the float
Throws an error if it is a pattern.
@param t the object to check
Draws a TextField.
Draws a TextField.
Draws a TextField.
Draws a TextField.
Draws a button.
Draws a button.
Sets the graphic state
@param gstate the graphic state
Ends a layer controled graphic block. It will end the most recent open block.
Sets the default colorspace.
@param name the name of the colorspace. It can be PdfName.DEFAULTGRAY
, PdfName.DEFAULTRGB
or PdfName.DEFAULTCMYK
@param obj the colorspace. A null
or PdfNull
removes any colorspace with the same name
Concatenates a transformation to the current transformation
matrix.
@param af the transformation
Begins a marked content sequence. This sequence will be tagged with the structure struc
.
The same structure can be used several times to connect text that belongs to the same logical segment
but is in a different location, like the same paragraph crossing to another page, for example.
@param struc the tagging structure
Begins a marked content sequence. This sequence will be tagged with the structure struc
.
The same structure can be used several times to connect text that belongs to the same logical segment
but is in a different location, like the same paragraph crossing to another page, for example.
@param struc the tagging structure
Ends a marked content sequence
Begins a marked content sequence. If property is null
the mark will be of the type
BMC
otherwise it will be BDC
.
@param tag the tag
@param property the property
@param inline true
to include the property in the content or false
to include the property in the resource dictionary with the possibility of reusing
This is just a shorthand to beginMarkedContentSequence(tag, null, false)
.
@param tag the tag
Checks for any dangling state: Mismatched save/restore state, begin/end text,
begin/end layer, or begin/end marked content sequence.
If found, this function will throw. This function is called automatically
during a Reset() (from Document.NewPage() for example), and before writing
itself out in ToPdf().
One possible cause: not calling myPdfGraphics2D.Dispose() will leave dangling
SaveState() calls.
@since 2.1.6
@throws IllegalPdfSyntaxException (a runtime exception)
[SUP-1395] If set, prevents iText from marking content and creating structure tags for items added to this content stream.
(By default, iText automatically marks content using BDC/EMC operators, and adds a structure tag for the new content
at the end of the page.)
Gets the internal buffer.
@return the internal buffer
Gets the x position of the text line matrix.
@return the x position of the text line matrix
Gets the y position of the text line matrix.
@return the y position of the text line matrix
Gets the current character spacing.
@return the current character spacing
Gets the current word spacing.
@return the current word spacing
Gets the current character spacing.
@return the current character spacing
Gets the current text leading.
@return the current text leading
Gets the size of this content.
@return the size of the content
Gets the root outline.
@return the root outline
Gets the PdfWriter
in use by this object.
@return the PdfWriter
in use by this object
Gets the PdfDocument
in use by this object.
@return the PdfDocument
in use by this object
Gets a duplicate of this PdfContentByte
. All
the members are copied by reference but the buffer stays different.
@return a copy of this PdfContentByte
This class keeps the graphic state of the current page
This is the font in use
This is the color in use
This is the font size in use
The x position of the text line matrix.
The y position of the text line matrix.
The current text leading.
The current horizontal scaling
The current character spacing
The current word spacing
The indirect reference to this template
The resources used by this template
The bounding box of this template
A dictionary with additional information
@since 5.1.0
Creates a PdfTemplate
.
Creates new PdfTemplate
@param wr the PdfWriter
Gets the stream representing this template.
@param compressionLevel the compressionLevel
@return the stream representing this template
@since 2.1.3 (replacing the method without param compressionLevel)
Gets the bounding width of this template.
@return width the bounding width
Gets the bounding heigth of this template.
@return heigth the bounding height
Gets the layer this template belongs to.
@return the layer this template belongs to or null
for no layer defined
Gets the indirect reference to this template.
@return the indirect reference to this template
Constructs the resources used by this template.
@return the resources used by this template
Gets a duplicate of this PdfTemplate
. All
the members are copied by reference but the buffer stays different.
@return a copy of this PdfTemplate
Sets/gets a dictionary with extra entries, for instance /Measure.
@param additional
a PdfDictionary with additional information.
@since 5.1.0
Creates a PdfAppearance
.
Creates new PdfTemplate
@param wr the PdfWriter
Creates a new appearance to be used with form fields.
@param width the bounding box width
@param height the bounding box height
@return the appearance created
Set the font and the size for the subsequent text writing.
@param bf the font
@param size the font size in points
this is the actual array of PdfObjects
Constructs an empty PdfArray
-object.
Constructs an PdfArray
-object, containing 1 PdfObject
.
@param object a PdfObject
that has to be added to the array
Constructs a PdfArray with the elements of an ArrayList.
Throws a ClassCastException if the ArrayList contains something
that isn't a PdfObject.
@param l an ArrayList with PdfObjects
@since 2.1.3
Constructs an PdfArray
-object, containing all the PdfObject
s in a given PdfArray
.
@param array a PdfArray
that has to be added to the array
Returns the PDF representation of this PdfArray
.
@return an array of byte
s
Returns the PdfObject
with the specified index.
A possible indirect references is not resolved, so the returned
PdfObject
may be either a direct object or an indirect
reference, depending on how the object is stored in the
PdfArray
.
@param idx The index of the PdfObject
to be returned
@return A PdfObject
Overwrites a specified location of the array, returning the previous
value
@param idx The index of the element to be overwritten
@param obj new value for the specified index
@throws IndexOutOfBoundsException if the specified position doesn't exist
@return the previous value
@since 2.1.5
Remove the element at the specified position from the array.
Shifts any subsequent elements to the left (subtracts one from their
indices).
@param idx The index of the element to be removed.
@throws IndexOutOfBoundsException the specified position doesn't exist
@since 2.1.5
Returns true
if the array is empty.
@return true
if the array is empty
@since 2.1.5
Adds a PdfObject
to the PdfArray
.
@param object PdfObject
to add
@return true
Inserts the specified element at the specified position.
Shifts the element currently at that position (if any) and
any subsequent elements to the right (adds one to their indices).
@param index The index at which the specified element is to be inserted
@param element The element to be inserted
@throws IndexOutOfBoundsException if the specified index is larger than the
last position currently set, plus 1.
@since 2.1.5
Inserts a PdfObject
at the beginning of the
PdfArray
.
The PdfObject
will be the first element, any other elements
will be shifted to the right (adds one to their indices).
@param object The PdfObject
to add
Checks if the PdfArray
already contains a certain PdfObject
.
@param object PdfObject
to check
@return true
@return this PdfArray's values as a long[]
@since 5.3.5
@return this PdfArray's values as a double[]
@since 5.5.6
Overwrites a specified location of the array.
@param idx The index of the element to be overwritten
@param obj new value for the specified index
@throws IndexOutOfBoundsException if the specified position doesn't exist
@return the previous value
@since 2.1.5
Returns an ArrayList containing PdfObject
s.
@return an ArrayList
Returns the number of entries in the array.
@return the size of the ArrayList
A possible value of PdfBoolean
A possible value of PdfBoolean
the bool value of this object
Constructs a PdfBoolean
-object.
@param value the value of the new PdfObject
Constructs a PdfBoolean
-object.
@param value the value of the new PdfObject
, represented as a string
@throws BadPdfFormatException thrown if the value isn't 'true
' or 'false
'
Returns the primitive value of the PdfBoolean
-object.
@return the actual value of the object.
A PdfBorderArray
defines the border of a PdfAnnotation
.
@see PdfArray
Constructs a new PdfBorderArray
.
Constructs a new PdfBorderArray
.
A PdfBorderDictionary
define the appearance of a Border (Annotations).
@see PdfDictionary
Constructs a PdfBorderDictionary
.
The allowed attributes in variable attributes
.
The allowed attributes in variable noStroke
.
The value of this object.
The encoding.
The font for this PdfChunk
.
true
if the chunk split was cause by a newline.
The image in this PdfChunk
, if it has one
The offset in the x direction for the image
The offset in the y direction for the image
Indicates if the height and offset of the Image has to be taken into account
The leading that can overrule the existing leading.
Constructs a PdfChunk
-object.
@param string the content of the PdfChunk
-object
@param font the PdfFont
@param attributes the metrics attributes
@param noStroke the non metric attributes
Constructs a PdfChunk
-object.
@param chunk the original Chunk
-object
@param action the PdfAction
if the Chunk
comes from an Anchor
Constructs a PdfChunk
-object.
@param chunk the original Chunk
-object
@param action the PdfAction
if the Chunk
comes from an Anchor
@param tabSettings the Phrase tab settings
Returns the width of this PdfChunk
.
@return a width
Checks if the PdfChunk
split was caused by a newline.
@return true
if the PdfChunk
split was caused by a newline.
Gets the width of the PdfChunk
taking into account the
extra character and word spacing.
@param charSpacing the extra character spacing
@param wordSpacing the extra word spacing
@return the calculated width
Trims the last space.
@return the width of the space trimmed, otherwise 0
Gets an attribute. The search is made in attributes
and noStroke
.
@param name the attribute key
@return the attribute value or null if not found
Checks if the attribute exists.
@param name the attribute key
@return true
if the attribute exists
Checks if this PdfChunk
needs some special metrics handling.
@return true
if this PdfChunk
needs some special metrics handling.
Checks if this PdfChunk
is a Separator Chunk.
@return true if this chunk is a separator.
@since 2.1.2
Checks if this PdfChunk
is a horizontal Separator Chunk.
@return true if this chunk is a horizontal separator.
@since 2.1.2
Checks if this PdfChunk
is a tab Chunk.
@return true if this chunk is a separator.
@since 2.1.2
Correction for the tab position based on the left starting position.
@param newValue the new value for the left X.
@since 2.1.2
Checks if there is an image in the PdfChunk
.
@return true
if an image is present
Tells you if this string is in Chinese, Japanese, Korean or Identity-H.
Returns the font of this Chunk
.
@return a PdfFont
Returns the color of this Chunk
.
@return a BaseColor
Gets the text displacement relatiev to the baseline.
@return a displacement in points
Gets the image in the PdfChunk
.
@return the image or null
Returns a scalePercentage in case the image needs to be scaled.
Sets a scale percentage in case the image needs to be scaled.
Gets the image offset in the x direction
@return the image offset in the x direction
Gets the image offset in the y direction
@return Gets the image offset in the y direction
sets the value.
Gets the encoding of this string.
@return a string
A PdfColor
defines a Color (it's a PdfArray
containing 3 values).
@see PdfDictionary
Constructs a new PdfColor
.
@param red a value between 0 and 255
@param green a value between 0 and 255
@param blue a value between 0 and 255
Parses the page or template content.
@author Paulo Soares
Commands have this type.
Holds value of property tokeniser.
Creates a new instance of PdfContentParser
@param tokeniser the tokeniser with the content
Parses a single command from the content. Each command is output as an array of arguments
having the command itself as the last element. The returned array will be empty if the
end of content was reached.
@param ls an ArrayList
to use. It will be cleared before using. If it's
null
will create a new ArrayList
@return the same ArrayList
given as argument or a new one
@throws IOException on error
Gets the tokeniser.
@return the tokeniser.
Reads a dictionary. The tokeniser must be positioned past the "<<" token.
@return the dictionary
@throws IOException on error
Reads an array. The tokeniser must be positioned past the "[" token.
@return an array
@throws IOException on error
Reads a pdf object.
@return the pdf object
@throws IOException on error
Reads the next token skipping over the comments.
@return true
if a token was read, false
if the end of content was reached
@throws IOException on error
Sets the tokeniser.
@param tokeniser the tokeniser
PdfContents
is a PdfStream
containing the contents (text + graphics) of a PdfPage
.
Constructs a PdfContents
-object, containing text and general graphics.
@param under the direct content that is under all others
@param content the graphics in a page
@param text the text in a page
@param secondContent the direct content that is over all others
@throws BadPdfFormatException on error
Make copies of PDF documents. Documents can be edited after reading and
before writing them out.
@author Mark Thompson
Holds value of property rotateContents.
Constructor
@param document
@param os outputstream
Grabs a page from the input document
@param reader the reader of the document
@param pageNumber which page to get
@return the page
Translate a PRIndirectReference to a PdfIndirectReference
In addition, translates the object numbers, and copies the
referenced object to the output file.
NB: PRIndirectReferences (and PRIndirectObjects) really need to know what
file they came from, because each file has its own namespace. The translation
we do from their namespace to ours is *at best* heuristic, and guaranteed to
fail under some circumstances.
Translate a PRIndirectReference to a PdfIndirectReference
In addition, translates the object numbers, and copies the
referenced object to the output file.
NB: PRIndirectReferences (and PRIndirectObjects) really need to know what
file they came from, because each file has its own namespace. The translation
we do from their namespace to ours is *at best* heuristic, and guaranteed to
fail under some circumstances.
Translate a PRDictionary to a PdfDictionary. Also translate all of the
objects contained in it.
Translate a PRDictionary to a PdfDictionary. Also translate all of the
objects contained in it.
Translate a PRStream to a PdfStream. The data part copies itself.
Translate a PRArray to a PdfArray. Also translate all of the objects contained
in it
Translate a PRArray to a PdfArray. Also translate all of the objects contained
in it
Translate a PR-object to a Pdf-object
Translate a PR-object to a Pdf-object
convenience method. Given an importedpage, set our "globals"
convenience method. Given a reader, set our "globals"
Add an imported page to our output
@param iPage an imported page
@throws IOException, BadPdfFormatException
Adds a blank page.
@param rect The page dimension
@param rotation The rotation angle in degrees
@since 2.1.5
@throws DocumentException
Copy document fields to a destination document.
@param reader a document where fields are copied from.
@throws DocumentException
@throws IOException
Setting page events isn't possible with Pdf(Smart)Copy.
Use the PageStamp class if you want to add content to copied pages.
@see com.itextpdf.text.pdf.PdfWriter#setPageEvent(com.itextpdf.text.pdf.PdfPageEvent)
Checks if the content is automatically adjusted to compensate
the original page rotation.
@return the auto-rotation status
Flags the content to be automatically adjusted to compensate
the original page rotation. The default is true
.
@param rotateContents true
to set auto-rotation, false
otherwise
This class holds information about indirect references, since they are
renumbered by iText.
Creates a new instance of StampContent
Gets a duplicate of this PdfContentByte
. All
the members are copied by reference but the buffer stays different.
@return a copy of this PdfContentByte
Concatenates PDF documents including form fields. The rules for the form field
concatenation are the same as in Acrobat. All the documents are kept in memory unlike
PdfCopy.
@author Paulo Soares
Creates a new instance.
@param os the output stream
@throws DocumentException on error
@throws IOException on error
Creates a new instance.
@param os the output stream
@param pdfVersion the pdf version the output will have
@throws DocumentException on error
@throws IOException on error
Concatenates a PDF document.
@param reader the PDF document
@throws DocumentException on error
Concatenates a PDF document selecting the pages to keep. The pages are described as a
List
of Integer
. The page ordering can be changed but
no page repetitions are allowed.
@param reader the PDF document
@param pagesToKeep the pages to keep
@throws DocumentException on error
Concatenates a PDF document selecting the pages to keep. The pages are described as
ranges. The page ordering can be changed but
no page repetitions are allowed.
@param reader the PDF document
@param ranges the comma separated ranges as described in {@link SequenceList}
@throws DocumentException on error
Sets the encryption options for this document. The userPassword and the
ownerPassword can be null or have zero length. In this case the ownerPassword
is replaced by a random string. The open permissions for the document can be
AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations,
AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting.
The permissions can be combined by ORing them.
@param userPassword the user password. Can be null or empty
@param ownerPassword the owner password. Can be null or empty
@param permissions the user permissions
@param strength128Bits true
for 128 bit key length, false
for 40 bit key length
@throws DocumentException if the document is already open
Sets the encryption options for this document. The userPassword and the
ownerPassword can be null or have zero length. In this case the ownerPassword
is replaced by a random string. The open permissions for the document can be
AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations,
AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting.
The permissions can be combined by ORing them.
@param strength true for 128 bit key length. false for 40 bit key length
@param userPassword the user password. Can be null or empty
@param ownerPassword the owner password. Can be null or empty
@param permissions the user permissions
@throws DocumentException if the document is already open
Closes the output document.
Opens the document. This is usually not needed as AddDocument() will do it
automatically.
Adds JavaScript to the global document
@param js the JavaScript
Sets the document's compression to the new 1.5 mode with object streams and xref
streams. It can be set at any time but once set it can't be unset.
@see com.lowagie.text.pdf.interfaces.PdfEncryptionSettings#setEncryption(byte[], byte[], int, int)
@see com.lowagie.text.pdf.interfaces.PdfViewerPreferences#addViewerPreference(com.lowagie.text.pdf.PdfName, com.lowagie.text.pdf.PdfObject)
@see com.lowagie.text.pdf.interfaces.PdfEncryptionSettings#setEncryption(java.security.cert.Certificate[], int[], int)
Sets the bookmarks. The list structure is defined in
{@link SimpleBookmark}.
@param outlines the bookmarks or null
to remove any
Gets the underlying PdfWriter.
@return the underlying PdfWriter
Gets the 1.5 compression status.
@return true
if the 1.5 compression is on
@see com.lowagie.text.pdf.interfaces.PdfViewerPreferences#setViewerPreferences(int)
@author psoares
Sets a reference to "visited" in the copy process.
@param ref the reference that needs to be set to "visited"
@return true if the reference was set to visited
Checks if a reference has already been "visited" in the copy process.
@param ref the reference that needs to be checked
@return true if the reference was already visited
Checks if a reference refers to a page object.
@param ref the reference that needs to be checked
@return true is the reference refers to a page object.
Allows you to add one (or more) existing PDF document(s) to
create a new PDF and add the form of another PDF document to
this new PDF.
@since 2.1.5
@deprecated since 5.5.2
The class with the actual implementations.
Creates a new instance.
@param os the output stream
@throws DocumentException on error
Concatenates a PDF document.
@param reader the PDF document
@throws DocumentException on error
Concatenates a PDF document selecting the pages to keep. The pages are described as a
List
of Integer
. The page ordering can be changed but
no page repetitions are allowed.
@param reader the PDF document
@param pagesToKeep the pages to keep
@throws DocumentException on error
Concatenates a PDF document selecting the pages to keep. The pages are described as
ranges. The page ordering can be changed but
no page repetitions are allowed.
@param reader the PDF document
@param ranges the comma separated ranges as described in {@link SequenceList}
@throws DocumentException on error
Copies the form fields of this PDFDocument onto the PDF-Document which was added
@param reader the PDF document
@throws DocumentException on error
Sets the encryption options for this document. The userPassword and the
ownerPassword can be null or have zero length. In this case the ownerPassword
is replaced by a random string. The open permissions for the document can be
AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations,
AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting.
The permissions can be combined by ORing them.
@param userPassword the user password. Can be null or empty
@param ownerPassword the owner password. Can be null or empty
@param permissions the user permissions
@param strength128Bits true
for 128 bit key length, false
for 40 bit key length
@throws DocumentException if the document is already open
Sets the encryption options for this document. The userPassword and the
ownerPassword can be null or have zero length. In this case the ownerPassword
is replaced by a random string. The open permissions for the document can be
AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations,
AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting.
The permissions can be combined by ORing them.
@param strength true for 128 bit key length. false for 40 bit key length
@param userPassword the user password. Can be null or empty
@param ownerPassword the owner password. Can be null or empty
@param permissions the user permissions
@throws DocumentException if the document is already open
Closes the output document.
Opens the document. This is usually not needed as addDocument() will do it
automatically.
Adds JavaScript to the global document
@param js the JavaScript
@see com.lowagie.text.pdf.interfaces.PdfEncryptionSettings#setEncryption(byte[], byte[], int, int)
@see com.lowagie.text.pdf.interfaces.PdfViewerPreferences#addViewerPreference(com.lowagie.text.pdf.PdfName, com.lowagie.text.pdf.PdfObject)
@see com.lowagie.text.pdf.interfaces.PdfEncryptionSettings#setEncryption(java.security.cert.Certificate[], int[], int)
Sets the bookmarks. The list structure is defined in
SimpleBookmark#
.
@param outlines the bookmarks or null
to remove any
Gets the underlying PdfWriter.
@return the underlying PdfWriter
Gets the 1.5 compression status.
@return true
if the 1.5 compression is on
@see com.lowagie.text.pdf.interfaces.PdfViewerPreferences#setViewerPreferences(int)
Allows you to add one (or more) existing PDF document(s)
and add the form(s) of (an)other PDF document(s).
@since 2.1.5
@deprecated since 5.5.2
This sets up the output document
@param os The Outputstream pointing to the output document
@throws DocumentException
This method feeds in the source document
@param reader The PDF reader containing the source document
@throws DocumentException
This merge fields is slightly different from the mergeFields method
of PdfCopyFields.
A PdfDashPattern
defines a dash pattern as described in
the PDF Reference Manual version 1.3 p 325 (section 8.4.3).
@see PdfArray
This is the length of a dash.
This is the length of a gap.
This is the phase.
Constructs a new PdfDashPattern
.
Constructs a new PdfDashPattern
.
Constructs a new PdfDashPattern
.
Constructs a new PdfDashPattern
.
Returns the PDF representation of this PdfArray
.
@return an array of byte
s
The value of this object.
The encoding.
Constructs an empty PdfString
-object.
Constructs a PdfString
-object.
@param value the content of the string
Constructs a PdfString
-object.
@param value the content of the string
@param encoding an encoding
Constructs a PdfString
-object.
@param bytes an array of byte
Returns the PDF representation of this PdfString
.
@return an array of byte
s
Returns the string
value of the PdfString
-object.
@return a string
Gets the encoding of this string.
@return a string
Constructs a PdfDate
-object.
@param d the date that has to be turned into a PdfDate
-object
Constructs a PdfDate
-object, representing the current day and time.
Adds a number of leading zeros to a given string
in order to get a string
of a certain length.
@param i a given number
@param length the length of the resulting string
@return the resulting string
Gives the W3C format of the PdfDate.
@return a formatted date
Gives the W3C format of the PdfDate.
@param d the date in the format D:YYYYMMDDHHmmSSOHH'mm'
@return a formatted date
A PdfColor
defines a Color (it's a PdfArray
containing 3 values).
@see PdfDictionary
This is a possible destination type
This is a possible destination type
This is a possible destination type
This is a possible destination type
This is a possible destination type
This is a possible destination type
This is a possible destination type
This is a possible destination type
Is the indirect reference to a page already added?
Creates a PdfDestination based on a String.
Valid Strings are for instance the values returned by SimpleNamedDestination:
"Fit", "XYZ 36 806 0",...
@param dest a String notation of a destination.
@since iText 5.0
Checks if an indirect reference to a page has been added.
@return true
or false
Adds the indirect reference of the destination page.
@param page an indirect reference
@return true if the page reference was added
Beginning with BaseVersion 1.7, the extensions dictionary lets developers
designate that a given document contains extensions to PDF. The presence
of the extension dictionary in a document indicates that it may contain
developer-specific PDF properties that extend a particular base version
of the PDF specification.
The extensions dictionary enables developers to identify their own extensions
relative to a base version of PDF. Additionally, the convention identifies
extension levels relative to that base version. The intent of this dictionary
is to enable developers of PDF-producing applications to identify company-specific
specifications (such as this one) that PDF-consuming applications use to
interpret the extensions.
@since 2.1.6
An instance of this class for Adobe 1.7 Extension level 3.
An instance of this class for ETSI 1.7 Extension level 2.
An instance of this class for ETSI 1.7 Extension level 5.
The prefix used in the Extensions dictionary added to the Catalog.
The base version.
The extension level within the baseversion.
Creates a PdfDeveloperExtension object.
@param prefix the prefix referring to the developer
@param baseversion the number of the base version
@param extensionLevel the extension level within the baseverion.
Generations the developer extension dictionary corresponding
with the prefix.
@return a PdfDictionary
Gets the prefix name.
@return a PdfName
Gets the baseversion name.
@return a PdfName
Gets the extension level within the baseversion.
@return an integer
The characters to be applied the hanging punctuation.
Constructs a new PDF document.
@throws DocumentException on error
The PdfWriter
.
Adds a PdfWriter
to the PdfDocument
.
@param writer the PdfWriter
that writes everything
what is added to this document to an outputstream.
@throws DocumentException on error
This is the PdfContentByte object, containing the text.
This is the PdfContentByte object, containing the borders and other Graphics.
This represents the leading of the lines.
This is the current height of the document.
Signals that onParagraph is valid (to avoid that a Chapter/Section title is treated as a Paragraph).
@since 2.1.2
This represents the current alignment of the PDF Elements.
The current active PdfAction
when processing an Anchor
.
The current tab settings.
@return the current
@since 5.4.0
Signals that the current leading has to be subtracted from a YMark object when positive
and save current leading
@since 2.1.2
Save current @leading
Restore @leading from leadingStack
Signals that an Element
was added to the Document
.
@param element the element to add
@return true
if the element was added, false
if not.
@throws DocumentException when a document isn't open yet, or has been closed
Makes a new page and sends it to the PdfWriter
.
@return true if new page was added
@throws DocumentException on error
Sets the pagesize.
@param pageSize the new pagesize
@return true
if the page size was set
margin in x direction starting from the left. Will be valid in the next page
margin in x direction starting from the right. Will be valid in the next page
margin in y direction starting from the top. Will be valid in the next page
margin in y direction starting from the bottom. Will be valid in the next page
Sets the margins.
@param marginLeft the margin on the left
@param marginRight the margin on the right
@param marginTop the margin on the top
@param marginBottom the margin on the bottom
@return a bool
@see com.lowagie.text.DocListener#setMarginMirroring(bool)
@see com.lowagie.text.DocListener#setMarginMirroring(boolean)
@since 2.1.6
Sets the page number to 0.
Signals that OnOpenDocument should be called.
The line that is currently being written.
The lines that are written until now.
Adds the current line to the list of lines and also adds an empty line.
@throws DocumentException on error
line.height() is usually the same as the leading
We should take leading into account if it is not the same as the line.height
@return float combined height of the line
@since 5.5.1
If the current line is not empty or null, it is added to the arraylist
of lines and a new empty line is added.
@throws DocumentException on error
Gets the current vertical page position.
@param ensureNewLine Tells whether a new line shall be enforced. This may cause side effects
for elements that do not terminate the lines they've started because those lines will get
terminated.
@return The current vertical page position.
Holds the type of the last element, that has been added to the document.
Ensures that a new line has been started.
Writes all the lines to the text-object.
@return the displacement that was caused
@throws DocumentException on error
Calls addSpacing(float, float, Font, boolean (false)).
Adds extra space.
some meta information about the Document.
Gets the PdfCatalog
-object.
@param pages an indirect reference to this document pages
@return PdfCatalog
This is the root outline of the document.
This is the current PdfOutline
in the hierarchy of outlines.
Adds a named outline to the document .
@param outline the outline to be added
@param name the name of this local destination
Contains the Viewer preferences of this PDF document.
@see com.lowagie.text.pdf.interfaces.PdfViewerPreferences#addViewerPreference(com.lowagie.text.pdf.PdfName, com.lowagie.text.pdf.PdfObject)
Implements a link to other part of the document. The jump will
be made to a local destination with the same name, that must exist.
@param name the name for this link
@param llx the lower left x corner of the activation area
@param lly the lower left y corner of the activation area
@param urx the upper right x corner of the activation area
@param ury the upper right y corner of the activation area
Implements a link to another document.
@param filename the filename for the remote document
@param name the name to jump to
@param llx the lower left x corner of the activation area
@param lly the lower left y corner of the activation area
@param urx the upper right x corner of the activation area
@param ury the upper right y corner of the activation area
Implements a link to another document.
@param filename the filename for the remote document
@param page the page to jump to
@param llx the lower left x corner of the activation area
@param lly the lower left y corner of the activation area
@param urx the upper right x corner of the activation area
@param ury the upper right y corner of the activation area
Implements an action in an area.
@param action the PdfAction
@param llx the lower left x corner of the activation area
@param lly the lower left y corner of the activation area
@param urx the upper right x corner of the activation area
@param ury the upper right y corner of the activation area
Stores the destinations keyed by name. Value is
Object[]{PdfAction,PdfIndirectReference,PdfDestintion}
.
The local destination to where a local goto with the same
name will jump to.
@param name the name of this local destination
@param destination the PdfDestination
with the jump coordinates
@return true
if the local destination was added,
false
if a local destination with the same name
already existed
Stores a list of document level JavaScript actions.
This is the size of the next page.
This is the size of the several boxes of the current Page.
This is the size of the several boxes that will be used in
the next page.
Gives the size of a trim, art, crop or bleed box, or null if not defined.
@param boxName crop, trim, art or bleed
This checks if the page is empty.
This are the page resources of the current Page.
Holds value of property strictImageSequence.
This is the position where the image ends.
Method added by Pelikan Stephan
@see com.lowagie.text.DocListener#clearTextWrap()
This is the image that could not be shown on a previous page.
Adds an image to the document.
@param image the Image
to add
@throws PdfException on error
@throws DocumentException on error
Adds a PdfPTable
to the document.
@param ptable the PdfPTable
to be added to the document.
@throws DocumentException on error
Getter for the current leading.
@return the current leading
@since 2.1.2
Getter and setter for the current tab stops.
@since 5.4.0
Use this method to set the XMP Metadata.
@param xmpMetadata The xmpMetadata to set.
@throws IOException
Sets the page number.
@param pageN the new page number
Gets the indentation on the left side.
@return a margin
Gets the indentation on the right side.
@return a margin
Gets the indentation on the top side.
@return a margin
Gets the indentation on the bottom side.
@return a margin
Gets the root outline. All the outlines must be created with a parent.
The first level is created with this outline.
@return the root outline
@see com.lowagie.text.pdf.interfaces.PdfViewerPreferences#setViewerPreferences(int)
Sets the collection dictionary.
@param collection a dictionary of type PdfCollection
Gets the AcroForm object.
@return the PdfAcroform object of the PdfDocument
Sets the display duration for the page (for presentations)
@param seconds the number of seconds to display the page
Sets the transition for the page
@param transition the PdfTransition object
Setter for property strictImageSequence.
@param strictImageSequence New value of property strictImageSequence.
Construct a PdfInfo
-object.
Constructs a PdfInfo
-object.
@param author name of the author of the document
@param title title of the document
@param subject subject of the document
Adds the title of the document.
@param title the title of the document
Adds the subject to the document.
@param subject the subject of the document
Adds some keywords to the document.
@param keywords the keywords of the document
Adds the name of the author to the document.
@param author the name of the author
Adds the name of the creator to the document.
@param creator the name of the creator
Adds the name of the producer to the document.
Adds the date of creation to the document.
Constructs a PdfCatalog
.
@param pages an indirect reference to the root of the document's Pages tree.
@param writer the writer the catalog applies to
Adds the names of the named destinations to the catalog.
@param localDestinations the local destinations
@param documentJavaScript the javascript used in the document
@param writer the writer the catalog applies to
Sets the document level additional actions.
@param actions dictionary of actions
This represents the current indentation of the PDF Elements on the left side.
Indentation to the left caused by a section.
This represents the current indentation of the PDF Elements on the left side.
This is the indentation caused by an image on the left.
This represents the current indentation of the PDF Elements on the right side.
Indentation to the right caused by a section.
This is the indentation caused by an image on the right.
This represents the current indentation of the PDF Elements on the top side.
This represents the current indentation of the PDF Elements on the bottom side.
@since 5.0.1
Extends PdfStream and should be used to create Streams for Embedded Files
(file attachments).
@since 2.1.3
Creates a Stream object using an InputStream and a PdfWriter object
@param in the InputStream that will be read to get the Stream object
@param writer the writer to which the stream will be added
Creates a Stream object using a byte array
@param fileStore the bytes for the stream
@see com.lowagie.text.pdf.PdfDictionary#toPdf(com.lowagie.text.pdf.PdfWriter, java.io.OutputStream)
Supports fast encodings for winansi and PDFDocEncoding.
@author Paulo Soares
Checks is text
only has PdfDocEncoding characters.
@param text the String
to test
@return true
if only PdfDocEncoding characters are present
Adds an extra encoding.
@param name the name of the encoding. The encoding recognition is case insensitive
@param enc the conversion class
@author Paulo Soares
The encryption key for a particular object/generation
The encryption key length for a particular object/generation
The global encryption key
Work area to prepare the object/generation bytes
The message digest algorithm MD5
The encryption key for the owner
The encryption key for the user
The public key security handler for certificate encryption
The generic key length. It may be 40 or 128.
Indicates if the encryption is only necessary for embedded files.
@since 2.1.3
Indicates if only the embedded files have to be encrypted.
@return if true only the embedded files will be encrypted
@since 2.1.3
ownerKey, documentID must be setuped
mkey must be setuped
Computes user password if standard encryption handler is used with Standard40, Standard128 or AES128 algorithm (Revision 2 - 4).
@param ownerPassword owner password of the encrypted document.
@return user password, or null if revision 5 (AES256) or greater of standard encryption handler was used.
This class takes any PDF and returns exactly the same but
encrypted. All the content, links, outlines, etc, are kept.
It is also possible to change the info dictionary.
Entry point to encrypt a PDF document. The encryption parameters are the same as in
PdfWriter
. The userPassword and the
ownerPassword can be null or have zero length. In this case the ownerPassword
is replaced by a random string. The open permissions for the document can be
AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations,
AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting.
The permissions can be combined by ORing them.
@param reader the read PDF
@param os the output destination
@param userPassword the user password. Can be null or empty
@param ownerPassword the owner password. Can be null or empty
@param permissions the user permissions
@param strength128Bits true
for 128 bit key length, false
for 40 bit key length
@throws DocumentException on error
@throws IOException on error
Entry point to encrypt a PDF document. The encryption parameters are the same as in
PdfWriter
. The userPassword and the
ownerPassword can be null or have zero length. In this case the ownerPassword
is replaced by a random string. The open permissions for the document can be
AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations,
AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting.
The permissions can be combined by ORing them.
@param reader the read PDF
@param os the output destination
@param userPassword the user password. Can be null or empty
@param ownerPassword the owner password. Can be null or empty
@param permissions the user permissions
@param strength128Bits true
for 128 bit key length, false
for 40 bit key length
@param newInfo an optional String
map to add or change
the info dictionary. Entries with null
values delete the key in the original info dictionary
@throws DocumentException on error
@throws IOException on error
Entry point to encrypt a PDF document. The encryption parameters are the same as in
PdfWriter
. The userPassword and the
ownerPassword can be null or have zero length. In this case the ownerPassword
is replaced by a random string. The open permissions for the document can be
AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations,
AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting.
The permissions can be combined by ORing them.
@param reader the read PDF
@param os the output destination
@param strength true
for 128 bit key length, false
for 40 bit key length
@param userPassword the user password. Can be null or empty
@param ownerPassword the owner password. Can be null or empty
@param permissions the user permissions
@throws DocumentException on error
@throws IOException on error
Entry point to encrypt a PDF document. The encryption parameters are the same as in
PdfWriter
. The userPassword and the
ownerPassword can be null or have zero length. In this case the ownerPassword
is replaced by a random string. The open permissions for the document can be
AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations,
AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting.
The permissions can be combined by ORing them.
@param reader the read PDF
@param os the output destination
@param strength true
for 128 bit key length, false
for 40 bit key length
@param userPassword the user password. Can be null or empty
@param ownerPassword the owner password. Can be null or empty
@param permissions the user permissions
@param newInfo an optional String
map to add or change
the info dictionary. Entries with null
values delete the key in the original info dictionary
@throws DocumentException on error
@throws IOException on error
Entry point to encrypt a PDF document. The encryption parameters are the same as in
PdfWriter
. The userPassword and the
ownerPassword can be null or have zero length. In this case the ownerPassword
is replaced by a random string. The open permissions for the document can be
AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations,
AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting.
The permissions can be combined by ORing them.
@param reader the read PDF
@param os the output destination
@param type the type of encryption. It can be one of STANDARD_ENCRYPTION_40, STANDARD_ENCRYPTION_128 or ENCRYPTION_AES128.
Optionally DO_NOT_ENCRYPT_METADATA can be ored to output the metadata in cleartext
@param userPassword the user password. Can be null or empty
@param ownerPassword the owner password. Can be null or empty
@param permissions the user permissions
@param newInfo an optional String
map to add or change
the info dictionary. Entries with null
values delete the key in the original info dictionary
@throws DocumentException on error
@throws IOException on error
Entry point to encrypt a PDF document. The encryption parameters are the same as in
PdfWriter
. The userPassword and the
ownerPassword can be null or have zero length. In this case the ownerPassword
is replaced by a random string. The open permissions for the document can be
AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations,
AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting.
The permissions can be combined by ORing them.
@param reader the read PDF
@param os the output destination
@param type the type of encryption. It can be one of STANDARD_ENCRYPTION_40, STANDARD_ENCRYPTION_128 or ENCRYPTION_AES128.
Optionally DO_NOT_ENCRYPT_METADATA can be ored to output the metadata in cleartext
@param userPassword the user password. Can be null or empty
@param ownerPassword the owner password. Can be null or empty
@param permissions the user permissions
values delete the key in the original info dictionary
@throws DocumentException on error
@throws IOException on error
Give you a verbose analysis of the permissions.
@param permissions the permissions value of a PDF file
@return a String that explains the meaning of the permissions value
Tells you if printing is allowed.
@param permissions the permissions value of a PDF file
@return true if printing is allowed
@since 2.0.7
Tells you if modifying content is allowed.
@param permissions the permissions value of a PDF file
@return true if modifying content is allowed
@since 2.0.7
Tells you if copying is allowed.
@param permissions the permissions value of a PDF file
@return true if copying is allowed
@since 2.0.7
Tells you if modifying annotations is allowed.
@param permissions the permissions value of a PDF file
@return true if modifying annotations is allowed
@since 2.0.7
Tells you if filling in fields is allowed.
@param permissions the permissions value of a PDF file
@return true if filling in fields is allowed
@since 2.0.7
Tells you if repurposing for screenreaders is allowed.
@param permissions the permissions value of a PDF file
@return true if repurposing for screenreaders is allowed
@since 2.0.7
Tells you if document assembly is allowed.
@param permissions the permissions value of a PDF file
@return true if document assembly is allowed
@since 2.0.7
Tells you if degraded printing is allowed.
@param permissions the permissions value of a PDF file
@return true if degraded printing is allowed
@since 2.0.7
Signals that an unspecified problem while constructing a PDF document.
@see BadPdfFormatException
Specifies a file or an URL. The file can be extern or embedded.
@author Paulo Soares
Creates a new instance of PdfFileSpecification. The static methods are preferred.
Creates a file specification of type URL.
@param writer the PdfWriter
@param url the URL
@return the file specification
Creates a file specification with the file embedded. The file may
come from the file system or from a byte array. The data is flate compressed.
@param writer the PdfWriter
@param filePath the file path
@param fileDisplay the file information that is presented to the user
@param fileStore the byte array with the file. If it is not null
it takes precedence over filePath
@throws IOException on error
@return the file specification
Creates a file specification with the file embedded. The file may
come from the file system or from a byte array. The data is flate compressed.
@param writer the PdfWriter
@param filePath the file path
@param fileDisplay the file information that is presented to the user
@param fileStore the byte array with the file. If it is not null
it takes precedence over filePath
@param compressionLevel the compression level to be used for compressing the file
it takes precedence over filePath
@throws IOException on error
@return the file specification
@since 2.1.3
Creates a file specification with the file embedded. The file may
come from the file system or from a byte array.
@param writer the PdfWriter
@param filePath the file path
@param fileDisplay the file information that is presented to the user
@param fileStore the byte array with the file. If it is not null
it takes precedence over filePath
@param compress sets the compression on the data. Multimedia content will benefit little
from compression
@throws IOException on error
@return the file specification
Creates a file specification with the file embedded. The file may
come from the file system or from a byte array.
@param writer the PdfWriter
@param filePath the file path
@param fileDisplay the file information that is presented to the user
@param fileStore the byte array with the file. If it is not null
it takes precedence over filePath
@param compress sets the compression on the data. Multimedia content will benefit little
from compression
@param mimeType the optional mimeType
@param fileParameter the optional extra file parameters such as the creation or modification date
@throws IOException on error
@return the file specification
Creates a file specification with the file embedded. The file may
come from the file system or from a byte array.
@param writer the PdfWriter
@param filePath the file path
@param fileDisplay the file information that is presented to the user
@param fileStore the byte array with the file. If it is not null
it takes precedence over filePath
@param mimeType the optional mimeType
@param fileParameter the optional extra file parameters such as the creation or modification date
@param compressionLevel the level of compression
@throws IOException on error
@return the file specification
@since 2.1.3
Creates a file specification for an external file.
@param writer the PdfWriter
@param filePath the file path
@return the file specification
Adds the unicode file name (the key /UF). This entry was introduced
in PDF 1.7. The filename must have the slash and backslash escaped
according to the file specification rules.
@param filename the filename
@param unicode if true, the filename is UTF-16BE encoded; otherwise PDFDocEncoding is used;
Adds a description for the file that is specified here.
@param description some text
@param unicode if true, the text is added as a unicode string
Adds the Collection item dictionary.
Gets the indirect reference to this file specification.
Multiple invocations will retrieve the same value.
@throws IOException on error
@return the indirect reference
Sets the file name (the key /F) string as an hex representation
to support multi byte file names. The name must have the slash and
backslash escaped according to the file specification rules
@param fileName the file name as a byte array
Sets a flag that indicates whether an external file referenced by the file
specification is volatile. If the value is true, applications should never
cache a copy of the file.
@param volatile_file if true, the external file should not be cached
the font metrics.
the size.
Compares this PdfFont
with another
@param object the other PdfFont
@return a value
Returns the approximative width of 1 character of this font.
@return a width in Text Space
Returns the width of a certain character of this font.
@param character a certain character
@return a width in Text Space
Returns the size of this font.
@return a size
Implements form fields.
@author Paulo Soares
Allows text fields to support rich text.
@since 5.0.6
Holds value of property parent.
Constructs a new PdfAnnotation
of subtype link (Action).
Creates new PdfFormField
Getter for property parent.
@return Value of property parent.
Sets the rich value for this field.
It is suggested that the regular value of this field be set to an
equivalent value. Rich text values are only supported since PDF 1.5,
and require that the FF_RV flag be set. See PDF Reference chapter
12.7.3.4 for details.
@param rv HTML markup for the rich value of this field
@since 5.0.6
PdfFormObject
is a type of XObject containing a template-object.
This is a PdfNumber representing 0.
This is a PdfNumber representing 1.
This is the 1 - matrix.
Constructs a PdfFormXObject
-object.
@param template the template
@param compressionLevel the compression level for the stream
@since 2.1.3 (Replacing the existing constructor with param compressionLevel)
Implements PDF functions.
@author Paulo Soares
Creates new PdfFunction
The graphic state dictionary.
@author Paulo Soares
A possible blend mode
A possible blend mode
A possible blend mode
A possible blend mode
A possible blend mode
A possible blend mode
A possible blend mode
A possible blend mode
A possible blend mode
A possible blend mode
A possible blend mode
A possible blend mode
A possible blend mode
Sets the flag whether to apply overprint for stroking.
@param ov
Sets the flag whether to apply overprint for non stroking painting operations.
@param ov
Sets the flag whether to toggle knockout behavior for overprinted objects.
@param ov - accepts 0 or 1
Sets the current stroking alpha constant, specifying the constant shape or
constant opacity value to be used for stroking operations in the transparent
imaging model.
@param n
Sets the current stroking alpha constant, specifying the constant shape or
constant opacity value to be used for nonstroking operations in the transparent
imaging model.
@param n
The alpha source flag specifying whether the current soft mask
and alpha constant are to be interpreted as shape values (true)
or opacity values (false).
@param v
Determines the behaviour of overlapping glyphs within a text object
in the transparent imaging model.
@param v
The current blend mode to be used in the transparent imaging model.
@param bm
Set the rendering intent, possible values are: PdfName.ABSOLUTECOLORIMETRIC,
PdfName.RELATIVECOLORIMETRIC, PdfName.SATURATION, PdfName.PERCEPTUAL.
@param ri
A PdfICCBased
defines a ColorSpace
@see PdfStream
Creates an ICC stream.
@param profile an ICC profile
Creates an ICC stream.
@param compressionLevel the compressionLevel
@param profile an ICC profile
@since 2.1.3 (replacing the constructor without param compressionLevel)
PdfImage
is a PdfStream
containing an image-Dictionary
and -stream.
This is the PdfName
of the image.
Constructs a PdfImage
-object.
@param image the Image
-object
@param name the PdfName
for this image
@throws BadPdfFormatException on error
Called when no resource name is provided in our constructor. This generates a
name that is required to be unique within a given resource dictionary.
@since 5.0.1
Returns the PdfName
of the image.
@return the name
Represents an imported page.
@author Paulo Soares
True if the imported page has been copied to a writer.
@since iText 5.0.4
Always throws an error. This operation is not allowed.
@param image dummy
@param a dummy
@param b dummy
@param c dummy
@param d dummy
@param e dummy
@param f dummy
@throws DocumentException dummy
Always throws an error. This operation is not allowed.
@param template dummy
@param a dummy
@param b dummy
@param c dummy
@param d dummy
@param e dummy
@param f dummy
Gets the stream representing this page.
@param compressionLevel the compressionLevel
@return the stream representing this page
@since 2.1.3 (replacing the method without param compressionLevel)
Always throws an error. This operation is not allowed.
@param bf dummy
@param size dummy
Checks if the page has to be copied.
@return true if the page has to be copied.
@since iText 5.0.4
Indicate that the resources of the imported page have been copied.
@since iText 5.0.4
Reads the content from this PdfImportedPage
-object from a reader.
@return self
Always throws an error. This operation is not allowed.
@return dummy
The object number
the generation number
Constructs a PdfIndirectObject
.
@param number the objecti number
@param objecti the direct objecti
Constructs a PdfIndirectObject
.
@param number the objecti number
@param generation the generation number
@param objecti the direct objecti
Writes eficiently to a stream
@param os the stream to write to
@throws IOException on write error
Returns a PdfIndirectReference
to this PdfIndirectObject
.
@return a PdfIndirectReference
the object number
the generation number
Constructs a PdfIndirectReference
.
@param type the type of the PdfObject
that is referenced to
@param number the object number.
@param generation the generation number.
Constructs a PdfIndirectReference
.
@param type the type of the PdfObject
that is referenced to
@param number the object number.
Returns the number of the object.
@return a number.
Returns the generation of the object.
@return a number.
An optional content group is a dictionary representing a collection of graphics
that can be made visible or invisible dynamically by users of viewer applications.
In iText they are referenced as layers.
@author Paulo Soares
Holds value of property on.
Holds value of property onPanel.
Creates a title layer. A title layer is not really a layer but a collection of layers
under the same title heading.
@param title the title text
@param writer the PdfWriter
@return the title layer
Creates a new layer.
@param name the name of the layer
@param writer the writer
Adds a child layer. Nested layers can only have one parent.
@param child the child layer
Used by the creating application to store application-specific
data associated with this optional content group.
@param creator a text string specifying the application that created the group
@param subtype a string defining the type of content controlled by the group. Suggested
values include but are not limited to Artwork, for graphic-design or publishing
applications, and Technical, for technical designs such as building plans or
schematics
Specifies the language of the content controlled by this
optional content group
@param lang a language string which specifies a language and possibly a locale
(for example, es-MX represents Mexican Spanish)
@param preferred used by viewer applications when there is a partial match but no exact
match between the system language and the language strings in all usage dictionaries
Specifies a range of magnifications at which the content
in this optional content group is best viewed.
@param min the minimum recommended magnification factors at which the group
should be ON. A negative value will set the default to 0
@param max the maximum recommended magnification factor at which the group
should be ON. A negative value will set the largest possible magnification supported by the
viewer application
Specifies that the content in this group is intended for
use in printing
@param subtype a name specifying the kind of content controlled by the group;
for example, Trapping, PrintersMarks and Watermark
@param printstate indicates that the group should be
set to that state when the document is printed from a viewer application
One of more users for whom this optional content group is primarily intended.
@param type should be "Ind" (Individual), "Ttl" (Title), or "Org" (Organization).
@param names one or more names
@since 5.0.2
Gets the parent layer.
@return the parent layer or null
if the layer has no parent
Gets the children layers.
@return the children layers or null
if the layer has no children
Gets the PdfIndirectReference
that represents this layer.
@return the PdfIndirectReference
that represents this layer
Sets the name of this layer.
@param name the name of this layer
Gets the dictionary representing the layer. It just returns this
.
@return the dictionary representing the layer
Gets the initial visibility of the layer.
@return the initial visibility of the layer
Specifies the recommended state for content in this
group when the document (or part of it) is saved by a viewer application to a format
that does not support optional content (for example, an earlier version of
PDF or a raster image format).
@param export the export state
Indicates that the group should be set to that state when the
document is opened in a viewer application.
@param view the view state
Indicates that the group contains a pagination artifact.
@param pe one of the following names: "HF" (Header Footer),
"FG" (Foreground), "BG" (Background), or "L" (Logo).
@since 5.0.2
Gets the layer visibility in Acrobat's layer panel
@return the layer visibility in Acrobat's layer panel
Sets the visibility of the layer in Acrobat's layer panel. If false
the layer cannot be directly manipulated by the user. Note that any children layers will
also be absent from the panel.
@param onPanel the visibility of the layer in Acrobat's layer panel
Content typically belongs to a single optional content group,
and is visible when the group is ON and invisible when it is OFF. To express more
complex visibility policies, content should not declare itself to belong to an optional
content group directly, but rather to an optional content membership dictionary
represented by this class.
@author Paulo Soares
Visible only if all of the entries are ON.
Visible if any of the entries are ON.
Visible if any of the entries are OFF.
Visible only if all of the entries are OFF.
Creates a new, empty, membership layer.
@param writer the writer
Adds a new member to the layer.
@param layer the new member to the layer
Gets the PdfIndirectReference
that represents this membership layer.
@return the PdfIndirectReference
that represents this layer
Gets the member layers.
@return the member layers
Sets the visibility policy for content belonging to this
membership dictionary. Possible values are ALLON, ANYON, ANYOFF and ALLOFF.
The default value is ANYON.
@param type the visibility policy
Sets the visibility expression for content belonging to this
membership dictionary.
@param ve A (nested) array of which the first value is /And, /Or, or /Not
followed by a series of indirect references to OCGs or other visibility
expressions.
@since 5.0.2
Gets the dictionary representing the membership layer. It just returns this
.
@return the dictionary representing the layer
PdfLine
defines an array with PdfChunk
-objects
that fit into 1 line.
The arraylist containing the chunks.
The left indentation of the line.
The width of the line.
The alignment of the line.
The heigth of the line.
true
if the chunk splitting was caused by a newline.
The original width.
Constructs a new PdfLine
-object.
@param left the limit of the line at the left
@param right the limit of the line at the right
@param alignment the alignment of the line
@param height the height of the line
Creates a PdfLine object.
@param left the left offset
@param originalWidth the original width of the line
@param remainingWidth bigger than 0 if the line isn't completely filled
@param alignment the alignment of the line
@param newlineSplit was the line splitted (or does the paragraph end with this line)
@param line an array of PdfChunk objects
@param isRTL do you have to read the line from Right to Left?
Adds a PdfChunk
to the PdfLine
.
@param chunk the PdfChunk
to add
@param currentLeading new value for the height of the line
@return null
if the chunk could be added completely; if not
a PdfChunk
containing the part of the chunk that could
not be added is returned
Adds a PdfChunk
to the PdfLine
.
@param chunk the PdfChunk
to add
@return null
if the chunk could be added completely; if not
a PdfChunk
containing the part of the chunk that could
not be added is returned
Returns an iterator of PdfChunk
s.
@return an Iterator
Checks if this line has to be justified.
@return true
if the alignment equals ALIGN_JUSTIFIED and there is some width left.
Adds extra indentation to the left (for Paragraph.setFirstLineIndent).
Get the string representation of what is in this line.
@return a string
Gets a PdfChunk
by index.
@param idx the index
@return the PdfChunk
or null if beyond the array
Gets the difference between the "normal" leading and the maximum
size (for instance when there are images in the chunk and the leading
has to be taken into account).
@return an extra leading for images
@since 2.1.5
Gets the number of separators in the line.
Returns -1 if there's a tab in the line.
@return the number of separators in the line
@since 2.1.2
Returns the number of chunks in the line.
@return a value
Returns the height of the line.
@return a value
Returns the left indentation of the line taking the alignment of the line into account.
@return a value
Returns the width that is left, after a maximum of characters is added to the line.
@return a value
Returns the number of space-characters in this line.
@return a value
Returns the listsymbol of this line.
@return a PdfChunk
if the line has a listsymbol; null
otherwise
Return the indentation needed to show the listsymbol.
@return a value
Checks if a newline caused the line split.
@return true
if a newline caused the line split
Gets the index of the last PdfChunk
with metric attributes
@return the last PdfChunk
with metric attributes
Gets the original width of the line.
@return the original width of the line
Gets the maximum size of the ascender for all the fonts used
in this line.
@return maximum size of all the ascenders used in this line
Gets the biggest descender for all the fonts used
in this line. Note that this is a negative number.
@return maximum size of all the ascenders used in this line
a Literal
A name
@since 2.1.6
A name
A name
A name
A name
@since 2.1.5 renamed from ABSOLUTECALORIMETRIC
A name
A name
A name
A name
@since 2.1.6
A name
@since 2.1.6
a name used in PDF structure
@since 2.1.6
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
@since 5.4.5
A name
@since 5.0.3
A name
A name
A name
Use ALT to specify alternate texts in Tagged PDF.
For alternate ICC profiles, use {@link #ALTERNATE}
Use ALTERNATE only in ICC profiles. It specifies an alternative color
space, in case the primary one is not supported, for legacy purposes.
For various types of alternate texts in Tagged PDF, use {@link #ALT}
A name
@since 5.5.8
A name
@since 5.4.5
A name
@since 5.4.3
A name
@since 2.1.6
A name
A name
A name
A name
A name
A name
A name
@since 2.1.6
A name
A name
@since 5.4.2
A name
A name
A name
A name
A name
@since 2.1.6
A name
@since 2.1.6
A name
@since 5.4.2
A name
A name
A name
A name
@since 2.1.6
A name
@since 5.3.5
A name
A name
A name
@since 2.1.6
A name
A name
A name
A name
@since 2.1.6
A name
A name
@since 2.1.6
A name
@since 2.1.6
A name
A name
A name
A name
A name
A name
@since 2.1.6
A name
A name
A name
A name
A name
@since 5.4.0
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
@since 5.4.5
A name
@since 2.1.6
A name
A name
A name
@since 5.4.4
A name
A name
@since 2.1.6
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
@since 2.0.7
A name
A name
A name
A name
@since 5.3.2
A name
@since 5.1.0
A name
@since 2.1.6
A name
A name
@since 2.1.6
A name
@since 5.3.4
A name
A name
A name
@since 5.4.4
A name
A name
A name
A name
A name
A name
A name
@since 5.4.0
A name
@since 5.4.0
A name
A name
@since 2.1.6
A name
@since 5.4.2
A name
@since 2.1.6
A name
@since 2.1.6
A name
A name
A name
A name
A name
A name of a base 14 type 1 font
A name of a base 14 type 1 font
A name of a base 14 type 1 font
A name of a base 14 type 1 font
A name
A name
A name
A name
A name
A name
A name
@since 2.1.6
A name
@since 2.1.6
A name of an attribute.
@since 5.1.0
A name
A name
A name
A name
A name of an attribute.
@since 5.1.0
A name
A name
@since 5.4.0
A name
@since 2.1.6
A name
A name
A name
@since 2.1.6
A name
@since 2.1.5 renamed from DEFAULTCRYPTFILER
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
@since 5.2.1
A name
A name
A name
A name
A name
A name
A name
A name
A name
@since 5.2.1
A name
A name
A name
@since 5.1.3
A name
@since 2.1.6
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
@since 2.1.3
A name
@since 2.1.3
A name
@since 2.1.6
A name
A name
A name
A name
A name
A name
A name
A name
@since 5.3.4
A name
@since 5.3.4
A name
A name
A name of an attribute.
@since 5.1.0
A name
@since 5.4.3
A name
A name
A name
@since 2.1.6
A name
@since 2.1.6
A name
A name
A name
A name
A name
A name
@since 2.1.6
A name
A name
@since 5.1.0
A name
A name
A name
A name
A name
A name
A name
@since 2.1.6
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
@since 2.1.6
A name
@since 2.1.6
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
@since 2.1.6
A name
A name
A name
@since 2.1.6
A name
A name
A name
A name
A name
A name
A name
A name
A name of an attribute.
A name of an attribute.
A name of an attribute.
@since 5.1.0
A name of an attribute.
@since 5.1.0
A name of an attribute.
@since 5.1.0
A name of an attribute.
A name of an attribute.
A name
@since 5.4.5
A name of an attribute.
A name of an attribute.
A name of an attribute.
@since 5.1.0
A name of an attribute.
A name of an attribute.
A name of an attribute.
A name of an attribute.
A name of an attribute.
A name
@since 2.1.6
A name
@since 2.1.6
A name
@since 2.1.6
A name
@since 2.1.6
A name
@since 2.1.6
A name
@since 2.1.6
A name
@since 5.4.5
A name
@since 5.4.5
A name
@since 2.1.6
A name
@since 5.4.0
A name of an attribute.
A name
A name of a base 14 type 1 font
A name of a base 14 type 1 font
A name of a base 14 type 1 font
A name of a base 14 type 1 font
A name
A name
A name
A name
A name
A name
A name
@since 2.1.6
A name
@since 5.4.5
A name
@since 5.4.5
A name
A name
@since 5.4.3
A name
A name
A name
A name
A name
A name
@since 5.5.3
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
@since 2.1.6
A name
A name
A name
A name
A name
A name
A name
@since 2.1.6
A name
A name
A name
@since 2.1.5
A name
@since 2.1.5
A name
A name
A name
@since 5.3.4
A name
A name
A name
A name
A name
A name
@since 5.1.4
An entry specifying the natural language, and optionally locale. Use this
to specify the Language attribute on a Tagged Pdf element.
For the content usage dictionary, use {@link #LANGUAGE}
A dictionary type, strictly for use in the content usage dictionary. For
dictionary entries in Tagged Pdf, use {@link #LANG}
A name
A name
A name
A name
A name
@since 5.5.0
A name
@since 2.1.6
A name
@since 2.1.6
A name
A name
A name
@since 2.1.6
A name
A name
A name
@since 2.1.6
A name
@since 5.3.5
A name
A name
@since 5.4.0
A name
A name
@since 5.4.0
A name
A name
A name
@since 2.1.2
A name
@since 5.4.0
A name
@since 5.4.0
A name of an attribute.
@since 5.1.0
A name
A name
A name
@since 5.2.1
A name
@since 2.1.6
A name
A name of an encoding
A name of an encoding
A name
A name
A name
A name
@since 2.1.6 renamed from MAX
A name
@since 2.1.6
A name
A name
A name
A name
A name
@since 5.1.0
A name
A name
@since 2.1.6 renamed from MIN
A name
@since 2.1.6
A name
A name
A name
A name
@since 5.4.3
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
@since 2.1.6
A name
@since 2.1.6
A name
@since 2.1.6
A name
A name.
@since 5.4.5
A name
A name
A name
A name
A name
A name
A name
@since 2.1.6
A name
@since 2.1.6
A name
@since 5.1.0
A name
A name
A name
A name used with Document Structure
@since 2.1.5
a name used with Document Structure
@since 2.1.5
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
@since 5.4.3
A name
A name
A name
A name
A name
@since 2.1.6
A name
A name
A name
A name
A name
A name
@since 5.5.4
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name used in defining Document Structure.
@since 2.1.5
A name
@since 2.1.6
A name
@since 2.1.6
A name
A name
A name
@since 5.4.4
A name
@since 2.1.6
A name
A name
A name
@since 5.1.0
A name
A name
A name
A name
@since 2.1.6
A name
A name
@since 5.5.0
A name
@since 2.1.6
A name
@since 2.1.6
A name
@since 5.0.2
A name
@since 5.0.2
A name
A name
@since 2.1.6
A name
A name
A name
@since 2.1.6
A name
A name.
@since 5.4.5
A name
A name
A name
A name
A name
A name
@since 5.4.3
A name
@since 5.4.4
A name
A name
A name
A name
@since 2.1.6
A name
A name
A name of an attribute.
@since 5.1.0
A name
A name
A name
A name
@since 5.1.0
A name
A name
@since 2.1.6
A name
A name
A name
@since 2.1.6
A name
A name
A name
A name
@since 5.4.3
A name
@since 5.4.4
A name
A name
A name
@since 5.1.0
A name
A name
A name
A name
@since 5.4.4
A name
A name
A name
A name
@since 2.1.5 renamed from RELATIVECALORIMETRIC
A name
A name
@since 5.5.4
A name
A name
A name
A name
@since 2.1.6
A name
@since 2.1.6
A name
@since 2.1.6
A name
@since 2.1.6
A name
@since 2.1.6
A name
@since 2.1.6
A name
@since 2.1.6
A name
@since 2.1.6
A name
@since 2.1.6
A name
@since 2.1.6
A name
@since 2.1.6
A name
@since 2.1.6
A name
@since 2.1.6
A name
@since 2.1.6
A name
@since 5.1.0
A name
@since 5.4.4
A name
@since 5.4.4
A name
A name
A name
A name
@since 5.4.0
A name
A name
@since 5.4.0
A name
@since 5.4.3
A name
@since 5.1.0
A name
@since 2.1.6
A name
A name
A name
A name
A name
A name
@since 5.4.0
A name
A name
@since 2.1.6
A name
A name
A name
A name
@since 2.1.6
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
@since 2.1.6
A name
@since 5.3.4
A name
@since 5.3.4
A name
A name
@since 2.1.6
A name
A name
A name
@since 2.1.3
A name
@since 5.1.0
A name
A name
A name
A name
@since 5.3.4
A name
@since 5.3.4
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name of a base 14 type 1 font
T is very commonly used for various dictionary entries, including title
entries in a Tagged PDF element dictionary, and target dictionaries.
A name
@since 2.1.6
A name
@since 2.1.6
A name
@since 2.1.5
A name
@since 2.1.6
A name
@since 2.1.6
A name
@since 5.3.5
A name
@since 5.4.3
A name
A name
@since 5.3.4
A name
@since 5.3.5
A name
@since 5.3.5
A name
@since 5.3.5
A name
@since 5.3.4
A name
@since 2.1.6
A name
@since 2.1.6
A name
@since 2.1.6
A name
A name
A name
A name
@since 2.1.6
A name
A name of a base 14 type 1 font
A name of a base 14 type 1 font
A name of a base 14 type 1 font
A name of a base 14 type 1 font
Use Title for the document's top level title (optional), and for document
outline dictionaries, which can store bookmarks.
For all other uses of a title entry, including Tagged PDF, use {@link #T}
A name
A name
A name
@since 2.1.6
A name
@since 2.1.6
A name
A name
@since 2.1.6
A name
A name
A name
@since 2.1.6
A name
A name
A name
A name
A name
@since 2.1.6
A name
@since 5.4.3
A name
A name
A name
A name
A name
@since 5.4.4
A name
A name
A name
A name
A name
A name
A name
A name
A name of an attribute.
A name of an attribute.
A name
A name of an attribute.
A name of an attribute.
A name of an attribute.
A name
@since 5.2.1
A name
@since 5.4.0
A name
@since 5.4.0
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
A name
@since 5.4.0
A name
A name
A name
@since 2.1.6
A name
A name
A name
@since 5.0.2
A name
@since 2.1.6
A name
A name
@since 2.1.6
A name
A name
A name
A name
@since 5.1.0
A name
A name
A name
@since 2.1.6
A name
@since 5.1.0
A name of an attribute.
A name of an attribute.
A name
@since 2.1.6
A name
@since 5.4.5
A name of an attribute.
A name of an attribute.
A name of an attribute.
A name
A name of an encoding
A name of an encoding
A name
@since 2.1.6
A name
@since 2.1.6
A name of an encoding
A name
A name of an attribute.
@since 5.1.0
A name
A name of an encoding
A name
@since 5.4.3
A name
A name
@since 2.1.6
A name
@since 2.1.6
A name
A name
A name
A name
@since 5.1.0
A name
A name
A name
A name
A name
A name
A name of a base 14 type 1 font
A name
map strings to all known static names
@since 2.1.6
Use reflection to cache all the static public readonly names so
future PdfName
additions don't have to be "added twice".
A bit less efficient (around 50ms spent here on a 2.2ghz machine),
but Much Less error prone.
@since 2.1.6
Constructs a new PdfName
. The name length will be checked.
@param name the new name
Constructs a new PdfName
.
@param name the new name
@param lengthCheck if true
check the lenght validity, if false
the name can
have any length
Indicates whether some other object is "equal to" this one.
@param obj the reference object with which to compare.
@return true
if this object is the same as the obj
argument; false
otherwise.
Returns a hash code value for the object. This method is
supported for the benefit of hashtables such as those provided by
java.util.Hashtable
.
@return a hash code value for this object.
Encodes a plain name given in the unescaped form "AB CD" into "/AB#20CD".
@param name the name to encode
@return the encoded name
@since 2.1.5
Decodes an escaped name in the form "/AB#20CD" into "AB CD".
@param name the name to decode
@return the decoded name
Creates a name tree.
@author Paulo Soares
Creates a name tree.
@param items the item of the name tree. The key is a String
and the value is a PdfObject
. Note that although the
keys are strings only the lower byte is used and no check is made for chars
with the same lower byte and different upper byte. This will generate a wrong
tree name.
@param writer the writer
@throws IOException on error
@return the dictionary with the name tree. This dictionary is the one
generally pointed to by the key /Dests, for example
This is an instance of the PdfNull
-object.
actual value of this PdfNumber
, represented as a double
Constructs a PdfNumber
-object.
@param content value of the new PdfNumber
-object
Constructs a new int PdfNumber
-object.
@param value value of the new PdfNumber
-object
Constructs a new long PdfNumber
-object.
@param value value of the new PdfNumber
-object
Constructs a new REAL PdfNumber
-object.
@param value value of the new PdfNumber
-object
Constructs a new REAL PdfNumber
-object.
@param value value of the new PdfNumber
-object
Increments the value of the PdfNumber
-object with 1.
Returns the primitive int
value of this object.
@return a value
Returns the primitive long
value of this object.
@return a value
Returns the primitive double
value of this object.
@return a value
Creates a number tree.
@author Paulo Soares
Creates a number tree.
@param items the item of the number tree. The key is an Integer
and the value is a PdfObject
.
@param writer the writer
@throws IOException on error
@return the dictionary with the number tree.
the PdfIndirectReference
of this object
value of the Count-key
value of the Parent-key
value of the Destination-key
The PdfAction
for this outline.
Holds value of property tag.
Holds value of property open.
Holds value of property color.
Holds value of property style.
Helper for the constructors.
@param parent the parent outline
@param title the title for this outline
@param open true
if the children are visible
Set the page of the PdfDestination
-object.
@param pageReference indirect reference to the page
@return true
if this page was set as the PdfDestination
-page.
Returns the PDF representation of this PdfOutline
.
@param writer the encryption information
@param os
@throws IOException
Gets the indirect reference of this PdfOutline
.
@return the PdfIndirectReference
to this outline.
Gets the parent of this PdfOutline
.
@return the PdfOutline
that is the parent of this outline.
Gets the destination for this outline.
@return the destination
returns the level of this outline.
@return a level
Getter for property tag.
@return Value of property tag.
Setter for property open.
@param open New value of property open.
value of the Rotate key for a page in PORTRAIT
value of the Rotate key for a page in LANDSCAPE
value of the Rotate key for a page in INVERTEDPORTRAIT
value of the Rotate key for a page in SEASCAPE
value of the MediaBox key
Constructs a PdfPage
.
@param mediaBox a value for the MediaBox key
@param resources an indirect reference to a PdfResources
-object
@param rotate a value for the Rotate key
@throws DocumentException
Constructs a PdfPage
.
@param mediaBox a value for the MediaBox key
@param resources an indirect reference to a PdfResources
-object
@throws DocumentException
Adds an indirect reference pointing to a PdfContents
-object.
@param contents an indirect reference to a PdfContents
-object
Rotates the mediabox, but not the text in it.
@return a PdfRectangle
Returns the MediaBox of this Page.
@return a PdfRectangle
Page labels are used to identify each
page visually on the screen or in print.
@author Paulo Soares
Logical pages will have the form 1,2,3,...
Logical pages will have the form I,II,III,IV,...
Logical pages will have the form i,ii,iii,iv,...
Logical pages will have the form of uppercase letters
(A to Z for the first 26 pages, AA to ZZ for the next 26, and so on)
Logical pages will have the form of uppercase letters
(a to z for the first 26 pages, aa to zz for the next 26, and so on)
No logical page numbers are generated but fixed text may
still exist
Dictionary values to set the logical page styles
The sequence of logical pages. Will contain at least a value for page 1
Creates a new PdfPageLabel with a default logical page 1
Adds or replaces a page label.
@param page the real page to start the numbering. First page is 1
@param numberStyle the numbering style such as LOWERCASE_ROMAN_NUMERALS
@param text the text to prefix the number. Can be null
or empty
@param firstPage the first logical page number
Adds or replaces a page label.
@param page the real page to start the numbering. First page is 1
@param numberStyle the numbering style such as LOWERCASE_ROMAN_NUMERALS
@param text the text to prefix the number. Can be null
or empty
@param firstPage the first logical page number
@param includeFirstPage If true, the page label will be added to the first page if it is page 1.
If the first page is not page 1 or this value is false, the value will not be added to the dictionary.
Adds or replaces a page label. The first logical page has the default
of 1.
@param page the real page to start the numbering. First page is 1
@param numberStyle the numbering style such as LOWERCASE_ROMAN_NUMERALS
@param text the text to prefix the number. Can be null
or empty
Adds or replaces a page label. There is no text prefix and the first
logical page has the default of 1.
@param page the real page to start the numbering. First page is 1
@param numberStyle the numbering style such as LOWERCASE_ROMAN_NUMERALS
Adds or replaces a page label.
Removes a page label. The first page lagel can not be removed, only changed.
@param page the real page to remove
Gets the page label dictionary to insert into the document.
@return the page label dictionary
Retrieves the page labels from a PDF as an array of String objects.
@param reader a PdfReader object that has the page labels you want to retrieve
@return a String array or null
if no page labels are present
Retrieves the page labels from a PDF as an array of {@link PdfPageLabelFormat} objects.
@param reader a PdfReader object that has the page labels you want to retrieve
@return a PdfPageLabelEntry array, containing an entry for each format change
or null
if no page labels are present
Creates a page label format.
@param physicalPage the real page to start the numbering. First page is 1
@param numberStyle the numbering style such as LOWERCASE_ROMAN_NUMERALS
@param prefix the text to prefix the number. Can be null
or empty
@param logicalPage the first logical page number
Constructs a PdfPages
-object.
A PdfPattern
defines a ColorSpace
@see PdfStream
Creates a PdfPattern object.
@param painter a pattern painter instance
Creates a PdfPattern object.
@param painter a pattern painter instance
@param compressionLevel the compressionLevel for the stream
@since 2.1.3
Implements the pattern.
Creates a PdfPattern
.
Creates new PdfPattern
@param wr the PdfWriter
Gets the stream representing this pattern
@return the stream representing this pattern
Gets the stream representing this pattern
@param compressionLevel the compression level of the stream
@return the stream representing this pattern
@since 2.1.3
@see com.lowagie.text.pdf.PdfContentByte#setGrayFill(float)
@see com.lowagie.text.pdf.PdfContentByte#resetGrayFill()
@see com.lowagie.text.pdf.PdfContentByte#setGrayStroke(float)
@see com.lowagie.text.pdf.PdfContentByte#resetGrayStroke()
@see com.lowagie.text.pdf.PdfContentByte#setRGBColorFillF(float, float, float)
@see com.lowagie.text.pdf.PdfContentByte#resetRGBColorFill()
@see com.lowagie.text.pdf.PdfContentByte#setRGBColorStrokeF(float, float, float)
@see com.lowagie.text.pdf.PdfContentByte#resetRGBColorStroke()
@see com.lowagie.text.pdf.PdfContentByte#setCMYKColorFillF(float, float, float, float)
@see com.lowagie.text.pdf.PdfContentByte#resetCMYKColorFill()
@see com.lowagie.text.pdf.PdfContentByte#setCMYKColorStrokeF(float, float, float, float)
@see com.lowagie.text.pdf.PdfContentByte#resetCMYKColorStroke()
@see com.lowagie.text.pdf.PdfContentByte#addImage(com.lowagie.text.Image, float, float, float, float, float, float)
@see com.lowagie.text.pdf.PdfContentByte#setCMYKColorFill(int, int, int, int)
@see com.lowagie.text.pdf.PdfContentByte#setCMYKColorStroke(int, int, int, int)
@see com.lowagie.text.pdf.PdfContentByte#setRGBColorFill(int, int, int)
@see com.lowagie.text.pdf.PdfContentByte#setRGBColorStroke(int, int, int)
@see com.lowagie.text.pdf.PdfContentByte#setColorStroke(java.awt.Color)
@see com.lowagie.text.pdf.PdfContentByte#setColorFill(java.awt.Color)
@see com.lowagie.text.pdf.PdfContentByte#setColorFill(com.lowagie.text.pdf.PdfSpotColor, float)
@see com.lowagie.text.pdf.PdfContentByte#setColorStroke(com.lowagie.text.pdf.PdfSpotColor, float)
@see com.lowagie.text.pdf.PdfContentByte#setPatternFill(com.lowagie.text.pdf.PdfPatternPainter)
@see com.lowagie.text.pdf.PdfContentByte#setPatternFill(com.lowagie.text.pdf.PdfPatternPainter, java.awt.Color, float)
@see com.lowagie.text.pdf.PdfContentByte#setPatternStroke(com.lowagie.text.pdf.PdfPatternPainter, java.awt.Color, float)
@see com.lowagie.text.pdf.PdfContentByte#setPatternStroke(com.lowagie.text.pdf.PdfPatternPainter)
Gets a duplicate of this PdfPatternPainter
. All
the members are copied by reference but the buffer stays different.
@return a copy of this PdfPatternPainter
A cell in a PdfPTable.
Holds value of property verticalAlignment.
Holds value of property paddingLeft.
Holds value of property paddingLeft.
Holds value of property paddingTop.
Holds value of property paddingBottom.
Holds value of property fixedHeight.
Fixed height of the cell.
Holds value of property noWrap.
Holds value of property table.
Holds value of property minimumHeight.
This field is used to cache the height which is calculated on getMaxHeight() method call;
this helps to avoid unnecessary recalculations on table drawing.
Holds value of property colspan.
Holds value of property rowspan.
@since 2.1.6
Holds value of property image.
Holds value of property cellEvent.
Holds value of property useDescender.
Increases padding to include border if true
The text in the cell.
The rotation of the cell. Possible values are
0, 90, 180 and 270.
Constructs an empty PdfPCell
.
The default padding is 2.
Constructs a PdfPCell
with a Phrase
.
The default padding is 2.
@param phrase the text
Constructs a PdfPCell
with an Image
.
The default padding is 0.
@param image the Image
Constructs a PdfPCell
with an Image
.
The default padding is 0.25 for a border width of 0.5.
@param image the Image
@param fit true
to fit the image to the cell
Constructs a PdfPCell
with a PdfPtable
.
This constructor allows nested tables.
The default padding is 0.
@param table The PdfPTable
Constructs a PdfPCell
with a PdfPtable
.
This constructor allows nested tables.
@param table The PdfPTable
@param style The style to apply to the cell (you could use getDefaultCell())
@since 2.1.0
Constructs a deep copy of a PdfPCell
.
@param cell the PdfPCell
to duplicate
Adds an iText element to the cell.
@param element
Sets the leading fixed and variable. The resultant leading will be
fixedLeading+multipliedLeading*maxFontSize where maxFontSize is the
size of the bigest font in the line.
@param fixedLeading the fixed leading
@param multipliedLeading the variable leading
Tells you whether the cell has a fixed height.
@return true is a fixed height was set.
@since 2.1.5
Tells you whether the cell has a minimum height.
@return true if a minimum height was set.
@since 2.1.5
Returns the height of the cell.
@return the height of the cell
@since 3.0.0
Gets the Phrase
from this cell.
@return the Phrase
Gets the horizontal alignment for the cell.
@return the horizontal alignment for the cell
Gets the vertical alignment for the cell.
@return the vertical alignment for the cell
Gets the effective left padding. This will include
the left border width if {@link #UseBorderPadding} is true.
@return effective value of property paddingLeft.
@return Value of property paddingLeft.
Gets the effective right padding. This will include
the right border width if {@link #UseBorderPadding} is true.
@return effective value of property paddingRight.
Getter for property paddingRight.
@return Value of property paddingRight.
Gets the effective top padding. This will include
the top border width if {@link #isUseBorderPadding()} is true.
@return effective value of property paddingTop.
Getter for property paddingTop.
@return Value of property paddingTop.
/** Gets the effective bottom padding. This will include
* the bottom border width if {@link #UseBorderPadding} is true.
* @return effective value of property paddingBottom.
Getter for property paddingBottom.
@return Value of property paddingBottom.
Sets the padding of the contents in the cell (space between content and border).
@param padding
Adjusts effective padding to include border widths.
@param use adjust effective padding if true
Gets the fixed leading
@return the leading
Gets the variable leading
@return the leading
Gets the first paragraph line indent.
@return the indent
Gets the extra space between paragraphs.
@return the extra space between paragraphs
Getter for property fixedHeight.
@return Value of property fixedHeight.
Gets the height which was calculated on last call of getMaxHeight().
If cell's bBox and content wasn't changed this value is actual maxHeight of the cell.
@return max height which was calculated on last call of getMaxHeight(); if getMaxHeight() wasn't called the return value is 0
Setter for property noWrap.
@param noWrap New value of property noWrap.
Getter for property table.
@return Value of property table.
Getter for property minimumHeight.
@return Value of property minimumHeight.
Getter for property colspan.
@return Value of property colspan.
Getter for property rowspan.
@return Value of property rowspan.
Gets the following paragraph lines indent.
@return the indent
Gets the right paragraph lines indent.
@return the indent
Gets the space/character extra spacing ratio for
fully justified text.
@return the space/character extra spacing ratio
Gets the run direction of the text content in the cell
@return One of the following values: PdfWriter.RUN_DIRECTION_DEFAULT, PdfWriter.RUN_DIRECTION_NO_BIDI, PdfWriter.RUN_DIRECTION_LTR or PdfWriter.RUN_DIRECTION_RTL.
Getter for property image.
@return Value of property image.
Gets the cell event for this cell.
@return the cell event
Gets the arabic shaping options.
@return the arabic shaping options
Gets state of first line height based on max ascender
@return true if an ascender is to be used.
Getter for property useDescender.
@return Value of property useDescender.
Gets the ColumnText with the content of the cell.
@return a columntext object
Returns the list of composite elements of the column.
@return a List object.
@since 2.1.1
Sets the rotation of the cell. Possible values are
0, 90, 180 and 270.
@param rotation the rotation of the cell
this is a possible style.
this is a possible style.
this is a possible style.
this is a possible style.
A row in a PdfPTable.
@author Paulo Soares
the bottom limit (bottom right y)
the right limit
@since 2.1.5
True if the table may not break after this row.
extra heights that needs to be added to a cell because of rowspans.
@since 2.1.6
Constructs a new PdfPRow with the cells in the array that was passed
as a parameter.
@param cells
Makes a copy of an existing row.
@param row
Sets the widths of the columns in the row.
@param widths
@return true if everything went right
Initializes the extra heights array.
@since 2.1.6
Sets an extra height for a cell.
@param cell the index of the cell that needs an extra height
@param height the extra height
@since 2.1.6
Calculates the heights of each cell in the row.
@return the maximum height of the row.
Writes the border and background of one cell in the row.
@param xPos The x-coordinate where the table starts on the canvas
@param yPos The y-coordinate where the table starts on the canvas
@param currentMaxHeight The height of the cell to be drawn.
@param cell
@param canvases
@since 2.1.6 extra parameter currentMaxHeight
@since 2.1.6 private is now protected
@since 2.1.6 private is now protected
@since 3.0.0 protected is now public static
* Writes a number of cells (not necessarily all cells).
*
* @param colStart The first column to be written.
* Remember that the column index starts with 0.
* @param colEnd The last column to be written.
* Remember that the column index starts with 0.
* If -1, all the columns to the end are written.
* @param xPos The x-coordinate where the table starts on the canvas
* @param yPos The y-coordinate where the table starts on the canvas
* @param reusable if set to false, the content in the cells is "consumed";
* if true, you can reuse the cells, the row, the parent table as many times you want.
* @since 5.1.0 added the reusable parameter
Checks if the dimensions of the columns were calculated.
@return true if the dimensions of the columns were calculated
Copies the content of a specific row in a table to this row.
Don't do this if the rows have a different number of cells.
@param table the table from which you want to copy a row
@param idx the index of the row that needs to be copied
@since 5.1.0
Splits a row to newHeight.
The returned row is the remainder. It will return null if the newHeight
was so small that only an empty row would result.
@param new_height the new height
@return the remainder row or null if the newHeight was so small that only
an empty row would result
Split rowspan of cells with rowspan on next page by inserting copies with the remaining rowspan
and reducing the previous rowspan appropriately, i.e. if a cell with rowspan 7 gets split after 3 rows
of that rowspan have been laid out, its column on the next page should start with an empty cell
having the same attributes and rowspan 7 - 3 = 4.
@since iText 5.4.3
Returns the array of cells in the row.
Please be extremely careful with this method.
Use the cells as read only objects.
@return an array of cells
@since 2.1.1
Checks if a cell in the row has a rowspan greater than 1.
@since 5.1.0
Gets the maximum height of the row (i.e. of the 'highest' cell).
@return the maximum height of the row
Implements the PostScript XObject.
Creates a new instance of PdfPSXObject
Constructs a PSXObject
@param wr
Gets the stream representing this object.
@param compressionLevel the compressionLevel
@return the stream representing this template
@since 2.1.3 (replacing the method without param compressionLevel)
@throws IOException
Gets a duplicate of this PdfPSXObject
. All
the members are copied by reference but the buffer stays different.
@return a copy of this PdfPSXObject
This is a table that can be put at an absolute position but can also
be added to the document as the class Table
.
In the last case when crossing pages the table always break at full rows; if a
row is bigger than the page it is dropped silently to avoid infinite loops.
A PdfPTableEvent can be associated to the table to do custom drawing
when the table is rendered.
@author Paulo Soares
The index of the original PdfcontentByte
.
The index of the duplicate PdfContentByte
where the background will be drawn.
The index of the duplicate PdfContentByte
where the border lines will be drawn.
The index of the duplicate PdfContentByte
where the text will be drawn.
The current column index.
@since 5.1.0 renamed from currentColIdx
Holds value of property headerRows.
Holds value of property widthPercentage.
Holds value of property horizontalAlignment.
Holds value of property skipFirstHeader.
Holds value of property skipLastFooter.
@since 2.1.6
Holds value of property lockedWidth.
Holds value of property splitRows.
The spacing before the table.
The spacing after the table.
Holds value of property extendLastRow.
Holds value of property headersInEvent.
Holds value of property splitLate.
Defines if the table should be kept
on one page if possible
Indicates if the PdfPTable is complete once added to the document.
@since iText 2.0.8
Keeps track of the completeness of the current row.
@since 2.1.6
Constructs a PdfPTable
with the relative column widths.
@param relativeWidths the relative column widths
Constructs a PdfPTable
with numColumns
columns.
@param numColumns the number of columns
Constructs a copy of a PdfPTable
.
@param table the PdfPTable
to be copied
Makes a shallow copy of a table (format without content).
@param table
@return a shallow copy of the table
Copies the format of the sourceTable without copying the content.
@param sourceTable
@since 2.1.6 private is now protected
Sets the relative widths of the table.
@param relativeWidths the relative widths of the table.
@throws DocumentException if the number of widths is different than the number
of columns
Sets the relative widths of the table.
@param relativeWidths the relative widths of the table.
@throws DocumentException if the number of widths is different than the number
of columns
@since 2.1.6 private is now protected
Sets the full width of the table from the absolute column width.
@param columnWidth the absolute width of each column
@throws DocumentException if the number of widths is different than the number
of columns
Sets the percentage width of the table from the absolute column width. Warning: Don't use this with setLockedWidth(true). These two settings don't mix.
@param columnWidth the absolute width of each column
@param pageSize the page size
@throws DocumentException
Calculates the heights of the table.
@return the total height of the table. Note that it will be 0 if you didn't
specify the width of the table with SetTotalWidth().
and made it public
Changes the number of columns. Any existing rows will be deleted.
@param the new number of columns
Adds a cell element.
@param cell the cell element
When updating the row index, cells with rowspan should be taken into account.
This is what happens in this method.
@since 2.1.6
Added by timmo3. This will return the correct cell taking it's cellspan into account
@param row the row index
@param col the column index
@return PdfPCell at the given row and position or null otherwise
Checks if there are rows above belonging to a rowspan.
@param currRow the current row to check
@param currCol the current column to check
@return true if there's a cell above that belongs to a rowspan
@since 2.1.6
Adds a cell element.
@param text the text for the cell
Adds a nested table.
@param table the table to be added to the cell
Adds an Image as Cell.
@param image the Image
to add to the table.
This image will fit in the cell
Adds a cell element.
@param phrase the Phrase
to be added to the cell
Writes the selected rows and columns to the document.
This method does not clip the columns; this is only important
if there are columns with colspan at boundaries.
canvases
is obtained from beginWritingRows()
.
The table event is only fired for complete rows.
@param colStart the first column to be written, zero index
@param colEnd the last column to be written + 1. If it is -1 all the
columns to the end are written
@param rowStart the first row to be written, zero index
@param rowEnd the last row to be written + 1. If it is -1 all the
rows to the end are written
@param xPos the x write coordinate
@param yPos the y write coordinate
@param canvases an array of 4 PdfContentByte
obtained from
beginWritingRows()
@param reusable if set to false, the content in the cells is "consumed";
if true, you can reuse the cells, the row, the parent table as many times you want.
@return the y coordinate position of the bottom of the last row
@see #beginWritingRows(com.itextpdf.text.pdf.PdfContentByte)
@since 5.1.0 added the reusable parameter
Writes the selected rows to the document.
@param rowStart the first row to be written, zero index
@param rowEnd the last row to be written + 1. If it is -1 all the
rows to the end are written
@param xPos the x write coodinate
@param yPos the y write coodinate
@param canvas the PdfContentByte
where the rows will
be written to
@return the y coordinate position of the bottom of the last row
Writes the selected rows and columns to the document.
This method clips the columns; this is only important
if there are columns with colspan at boundaries.
The table event is only fired for complete rows.
@param colStart the first column to be written, zero index
@param colEnd the last column to be written + 1. If it is -1 all the
columns to the end are written
@param rowStart the first row to be written, zero index
@param rowEnd the last row to be written + 1. If it is -1 all the
rows to the end are written
@param xPos the x write coordinate
@param yPos the y write coordinate
@param canvas the PdfContentByte
where the rows will
be written to
@return the y coordinate position of the bottom of the last row
@param reusable if set to false, the content in the cells is "consumed";
if true, you can reuse the cells, the row, the parent table as many times you want.
@since 5.1.0 added the reusable parameter
Finishes writing the table.
@param canvases the array returned by beginWritingRows()
Gets the height of a particular row.
@param idx the row index (starts at 0)
@return the height of a particular row
Gets the height of a particular row.
@param idx the row index (starts at 0)
@param firsttime is this the first time the row heigh is calculated?
@return the height of a particular row
@since 5.0.0
Gets the maximum height of a cell in a particular row (will only be different
from getRowHeight is one of the cells in the row has a rowspan > 1).
@param rowIndex the row index
@param cellIndex the cell index
@return the height of a particular row including rowspan
@since 2.1.6
Checks if a cell in a row has a rowspan greater than 1.
@since 5.1.0
Makes sure the footers value is lower than the headers value.
@since 5.0.1
Deletes a row from the table.
@param rowNumber the row to be deleted
@return true
if the row was deleted
Deletes the last row in the table.
@return true
if the last row was deleted
Removes all of the rows except headers
@since iText 2.0.8
@see com.lowagie.text.Element#isContent()
@since iText 2.0.8
@see com.lowagie.text.Element#isNestable()
Processes the element by adding it (or the different parts) to an
ElementListener
.
@param listener an ElementListener
@return true
if the element was processed successfully
Gets a row with a given index.
@param idx
@return the row at position idx
Returns the index of the last completed row.
@return the index of a row
Defines where the table may be broken (if necessary).
@param breakPoints int[]
@throws System.IndexOutOfRangeException if a row index is passed that is out of bounds
Defines which rows should not allow a page break (if possible).
@param rows int[]
@throws System.IndexOutOfRangeException if a row index is passed that is out of bounds
Defines a range of rows that should not allow a page break (if possible).
@param start int
@param end int
@throws System.IndexOutOfRangeException if a row index is passed that is out of bounds
Defines a range of rows (from the parameter to the last row) that should not allow a page break (if possible).
The equivalent of calling {@link #keepRowsTogether(int,int) keepRowsTogether(start, rows.size()}.
@param start int
@throws System.IndexOutOfRangeException if a row index is passed that is out of bounds
Gets an arraylist with a selection of rows.
@param start the first row in the selection
@param end the first row that isn't part of the selection
@return a selection of rows
@since 2.1.6
Calculates the extra height needed in a row because of rowspans.
@param start the index of the start row (the one to adjust)
@param end the index of the end row on the page
@since 2.1.6
When set the last row on every page will be extended to fill
all the remaining space to the bottom boundary; except maybe the
row.
@param extendLastRows true to extend the last row on each page; false otherwise
@param extendFinalRow false if you don't want to extend the row of the complete table
@since iText 5.0.0
* Gets the value of the last row extension, taking into account
* if the row is reached or not.
*
* @return true if the last row will extend;
* false otherwise
* @since iText 5.0.0
Completes the current row with the default cell. An incomplete row will be dropped
but calling this method will make sure that it will be present in the table.
@since iText 2.0.8
@see com.lowagie.text.LargeElement#flushContent()
Gets row index where cell overlapping (rowIdx, colIdx) starts
@param rowIdx
@param colIdx
@return row index
@since iText 5.4.3
Determine which rows fit on the page, respecting isSplitLate().
Note: sets max heights of the inspected rows as a side effect,
just like PdfPTable.getRowHeight(int, boolean) does.
Respect row.getMaxHeights() if it has been previously set (which might be independent of the height of
individual cells).
The last row written on the page will be chosen by the caller who might choose not
the calculated one but an earlier one (due to mayNotBreak settings on the rows).
The height of the chosen last row has to be corrected if splitLate == true
by calling FittingRows.correctLastRowChosen() by the caller to avoid splitting the content of
cells with open rowspans.
@since iText 5.4.3
Gets the full width of the table.
@return the full width of the table
Gets the default PdfPCell
that will be used as
reference for all the addCell
methods except
addCell(PdfPCell)
.
@return default PdfPCell
Gets the number of rows in this table.
@return the number of rows in this table
Gets the total height of the table.
@return the total height of the table
Gets the height of the rows that constitute the header as defined by
setHeaderRows()
.
@return the height of the rows that constitute the header and footer
Gets the height of the rows that constitute the header as defined by
setFooterRows()
.
@return the height of the rows that constitute the footer
@since 2.1.1
Returns the number of columns.
@return the number of columns.
@since 2.1.1
Gets all the chunks in this element.
@return an List
Gets the type of the text element.
@return a type
Gets an arraylist with all the rows in the table.
@return an arraylist
Sets the table event for this table.
@param event the table event for this table
Gets the absolute sizes of each column width.
@return he absolute sizes of each column width
Tells you if the last footer needs to be skipped
(for instance if the footer says "continued on the next page")
@return Value of property skipLastFooter.
@since 2.1.6
If true the table will be kept on one page if it fits, by forcing a
new page if it doesn't fit on the current page. The default is to
split the table over multiple pages.
@param p_KeepTogether whether to try to keep the table on one page
@since iText 2.0.8
@see com.lowagie.text.LargeElement#isComplete()
@since iText 5.4.3
Correct chosen last fitting row so that the content of all cells with open rowspans will fit on the page,
i.e. the cell content won't be split.
(Only to be used with splitLate == true)
@since iText 5.4.3
@author Aiken Sam (aikensam@ieee.org)
Instance of PdfReader in each output document.
@author Paulo Soares
Gets the content stream of a page as a PdfStream object.
@param pageNumber the page of which you want the stream
@param compressionLevel the compression level you want to apply to the stream
@return a PdfStream object
@since 2.1.3 (the method already existed without param compressionLevel)
A PdfArray object consisting of nothing but PdfNumber objects
@since 5.1.0
Creates a PdfArray consisting of PdfNumber objects.
@param numbers float values
Creates a PdfArray consisting of PdfNumber objects.
@param numbers a List containing PdfNumber objects
lower left x
lower left y
upper right x
upper right y
Constructs a PdfRectangle
-object.
@param llx lower left x
@param lly lower left y
@param urx upper right x
@param ury upper right y
@since rugPdf0.10
Constructs a PdfRectangle
-object starting from the origin (0, 0).
@param urx upper right x
@param ury upper right y
Constructs a PdfRectangle
-object with a Rectangle
-object.
@param rectangle a Rectangle
Overrides the add
-method in PdfArray
in order to prevent the adding of extra object to the array.
@param object PdfObject
to add (will not be added here)
@return false
Block changes to the underlying PdfArray
@param values stuff we'll ignore. Ha!
@return false. You can't add anything to a PdfRectangle
@since 2.1.5
Block changes to the underlying PdfArray
@param values stuff we'll ignore. Ha!
@return false. You can't add anything to a PdfRectangle
@since 2.1.5
Block changes to the underlying PdfArray
@param object Ignored.
@since 2.1.5
Returns the lower left x-coordinate, considering a given margin.
@param margin a margin
@return the lower left x-coordinate
Returns the upper right x-coordinate, considering a given margin.
@param margin a margin
@return the upper right x-coordinate
Returns the upper right y-coordinate, considering a given margin.
@param margin a margin
@return the upper right y-coordinate
Returns the lower left y-coordinate, considering a given margin.
@param margin a margin
@return the lower left y-coordinate
Returns the high level version of this PdfRectangle
@return this PdfRectangle translated to class Rectangle
Returns the lower left x-coordinate.
@return the lower left x-coordinaat
Returns the upper right x-coordinate.
@return the upper right x-coordinate
Returns the upper right y-coordinate.
@return the upper right y-coordinate
Returns the lower left y-coordinate.
@return the lower left y-coordinate
Returns the width of the rectangle.
@return a width
Returns the height of the rectangle.
@return a height
Swaps the values of urx and ury and of lly and llx in order to rotate the rectangle.
@return a PdfRectangle
A Rendition dictionary (pdf spec 1.5)
Constructs a PDF ResourcesDictionary.
Implements the shading dictionary (or stream).
@author Paulo Soares
Holds value of property bBox.
Holds value of property antiAlias.
Creates new PdfShading
Implements the shading pattern dictionary.
@author Paulo Soares
Creates new PdfShadingPattern
Implements the signature dictionary.
@author Paulo Soares
Creates new PdfSignature
Sets the signature creator name in the
{@link PdfSignatureBuildProperties} dictionary.
@param name
Gets the {@link PdfSignatureBuildProperties} instance if it exists, if
not it adds a new one and returns this.
@return {@link PdfSignatureBuildProperties}
Class that takes care of the cryptographic options
and appearances that form a signature.
Approval signature
Author signature, no changes allowed
Author signature, form filling allowed
Author signature, form filling and annotations allowed
An appearance that can be used for layer 1 (if acro6Layers is false).
extra space at the top.
margin for the content inside the signature rectangle.
Constructs a PdfSignatureAppearance object.
@param writer the writer to which the signature will be written.
The certification level
The caption for the reason for signing.
The caption for the location of signing.
The reason for signing.
Holds value of property location.
Holds value of property signDate.
Holds value of the application that creates the signature
The contact name of the signer.
The file right before the signature is added (can be null).
The bytes of the file right before the signature is added (if raf is null)
Array containing the byte positions of the bytes that need to be hashed.
@return the underlying source
@throws IOException
The signing certificate
Adds the appropriate developer extension.
The crypto dictionary
Holds value of property signatureEvent.
The name of the field
Gets a new signature field name that
doesn't clash with any existing name.
@return a new signature field name
The page where the signature will appear.
The coordinates of the rectangle for a visible signature,
or a zero-width, zero-height rectangle for an invisible signature.
rectangle that represent the position and dimension of the signature in the page.
Gets the visibility status of the signature.
@return the visibility status of the signature
Sets the signature to be visible. It creates a new visible signature field.
@param pageRect the position and dimension of the field in the page
@param page the page to place the field. The fist page is 1
@param fieldName the field name or null
to generate automatically a new field name
Sets the signature to be visible. An empty signature field with the same name must already exist.
@param fieldName the existing empty signature field name
The rendering mode chosen for visible signatures
The image that needs to be used for a visible signature
Appearance compliant with the recommendations introduced in Acrobat 6?
Layers for a visible signature.
Indicates if we need to reuse the existing appearance as layer 0.
A background image for the text in layer 2.
the scaling to be applied to the background image.t
The text that goes in Layer 2 of the signature appearance.
Font for the text in Layer 2.
Run direction for the text in layers 2 and 4.
The text that goes in Layer 4 of the appearance.
Template containing all layers drawn on top of each other.
The PdfStamper that creates the signed PDF.
Sets the PdfStamper
@param stamper PdfStamper
The PdfStamperImp object corresponding with the stamper.
A byte buffer containing the bytes of the Stamper.
OutputStream for the bytes of the stamper.
Temporary file in case you don't want to sign in memory.
Name and content of keys that can only be added in the close() method.
Length of the output.
Indicates if the stamper has already been pre-closed.
Signature field lock dictionary.
Checks if the document is in the process of closing.
@return true
if the document is in the process of closing,
false
otherwise
Adds keys to the signature dictionary that define
the certification level and the permissions.
This method is only used for Certifying signatures.
@param crypto the signature dictionary
Adds keys to the signature dictionary that define
the field permissions.
This method is only used for signatures that lock fields.
@param crypto the signature dictionary
Sets the document type to certified instead of simply signed.
@param certificationLevel the values can be: NOT_CERTIFIED
, CERTIFIED_NO_CHANGES_ALLOWED
,
CERTIFIED_FORM_FILLING
and CERTIFIED_FORM_FILLING_AND_ANNOTATIONS
Gets and setsthe signing reason.
@return the signing reason
Sets the caption for signing reason.
@param reasonCaption the signing reason caption
Gets and sets the signing location.
@return the signing location
Sets the caption for the signing location.
@param locationCaption the signing location caption
Gets the signature creator.
@return the signature creator
Sets the name of the application used to create the signature.
@param signatureCreator the name of the signature creating application
Gets the signing contact.
@return the signing contact
Gets the signature date.
@return the signature date
Gets the user made signature dictionary. This is the dictionary at the /V key.
@return the user made signature dictionary
Sets the certificate used to provide the text in the appearance.
This certificate doesn't take part in the actual signing process.
@param signCertificate the certificate
Sets the signature event to allow modification of the signature dictionary.
@param signatureEvent the signature event
Gets the field name.
@return the field name
Gets the page number of the field.
@return the page number of the field
Gets the rectangle representing the signature dimensions.
@return the rectangle representing the signature dimensions. It may be null
or have zero width or height for invisible signatures
Gets the rectangle that represent the position and dimension of the signature in the page.
@return the rectangle that represent the position and dimension of the signature in the page
Gets the rendering mode for this signature.
@return the rendering mode for this signature
@since 5.0.1
Sets the Image object to render when Render is set to RenderingMode.GRAPHIC
or RenderingMode.GRAPHIC_AND_DESCRIPTION
.
@param signatureGraphic image rendered. If null
the mode is defaulted
to RenderingMode.DESCRIPTION
Acrobat 6.0 and higher recommends that only layer n0 and n2 be present.
Use this method with value false
if you want to ignore this recommendation.
@param acro6Layers if true
only the layers n0 and n2 will be present
@deprecated Adobe no longer supports Adobe Acrobat / Reader versions older than 9
Indicates that the existing appearances needs to be reused as layer 0.
Gets the background image for the layer 2.
@return the background image for the layer 2
Sets the scaling to be applied to the background image. If it's zero the image
will fully fill the rectangle. If it's less than zero the image will fill the rectangle but
will keep the proportions. If it's greater than zero that scaling will be applied.
In any of the cases the image will always be centered. It's zero by default.
@param imageScale the scaling to be applied to the background image
Sets the signature text identifying the signer.
@param text the signature text identifying the signer. If null
or not set
a standard description will be used
Sets the n2 and n4 layer font. If the font size is zero, auto-fit will be used.
@param layer2Font the n2 and n4 font
Sets the run direction in the n2 and n4 layer.
@param runDirection the run direction
Sets the text identifying the signature status. Will be ignored if acro6Layers is true.
@param text the text identifying the signature status. If null
or not set
the description "Signature Not Verified" will be used
Gets the PdfStamper
associated with this instance.
@return the PdfStamper
associated with this instance
Getter for the byte buffer.
Gets the temporary file.
@return the temporary file or null
is the document is created in memory
Signature field lock dictionary.
If a signature is created on an existing signature field, then its /Lock dictionary
takes the precedence (if it exists).
An interface to retrieve the signature dictionary for modification.
Allows modification of the signature dictionary.
@param sig the signature dictionary
Signature rendering modes
@since 5.0.1
The rendering mode is just the description.
The rendering mode is the name of the signer and the description.
The rendering mode is an image and the description.
The rendering mode is just an image.
PdfSmartCopy has the same functionality as PdfCopy,
but when resources (such as fonts, images,...) are
encountered, a reference to these resources is saved
in a cache, so that they can be reused.
This requires more memory, but reduces the file size
of the resulting PDF document.
the cache with the streams and references.
Creates a PdfSmartCopy instance.
Translate a PRIndirectReference to a PdfIndirectReference
In addition, translates the object numbers, and copies the
referenced object to the output file if it wasn't available
in the cache yet. If it's in the cache, the reference to
the already used stream is returned.
NB: PRIndirectReferences (and PRIndirectObjects) really need to know what
file they came from, because each file has its own namespace. The translation
we do from their namespace to ours is *at best* heuristic, and guaranteed to
fail under some circumstances.
A PdfSpotColor
defines a ColorSpace
@see PdfDictionary
Constructs a new PdfSpotColor
.
@param name a string value
@param tint a tint value between 0 and 1
@param altcs a altnative colorspace value
The writer
Replaces a page from this document with a page from other document. Only the content
is replaced not the fields and annotations. This method must be called before
getOverContent() or getUndercontent() are called for the same page.
@param r the PdfReader
from where the new page will be imported
@param pageImported the page number of the imported page
@param pageReplaced the page to replace in this document
Inserts a blank page. All the pages above and including pageNumber
will
be shifted up. If pageNumber
is bigger than the total number of pages
the new page will be the last one.
@param pageNumber the page number position where the new page will be inserted
@param mediabox the size of the new page
Gets a PdfContentByte
to write under the page of
the original document.
@param pageNum the page number where the extra content is written
@return a PdfContentByte
to write under the page of
the original document
Gets a PdfContentByte
to write over the page of
the original document.
@param pageNum the page number where the extra content is written
@return a PdfContentByte
to write over the page of
the original document
Sets the encryption options for this document. The userPassword and the
ownerPassword can be null or have zero length. In this case the ownerPassword
is replaced by a random string. The open permissions for the document can be
AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations,
AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting.
The permissions can be combined by ORing them.
@param userPassword the user password. Can be null or empty
@param ownerPassword the owner password. Can be null or empty
@param permissions the user permissions
@param strength128Bits true
for 128 bit key length, false
for 40 bit key length
@throws DocumentException if anything was already written to the output
Sets the encryption options for this document. The userPassword and the
ownerPassword can be null or have zero length. In this case the ownerPassword
is replaced by a random string. The open permissions for the document can be
AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations,
AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting.
The permissions can be combined by ORing them.
@param userPassword the user password. Can be null or empty
@param ownerPassword the owner password. Can be null or empty
@param permissions the user permissions
@param encryptionType the type of encryption. It can be one of STANDARD_ENCRYPTION_40, STANDARD_ENCRYPTION_128 or ENCRYPTION_AES128.
Optionally DO_NOT_ENCRYPT_METADATA can be ored to output the metadata in cleartext
@throws DocumentException if the document is already open
Sets the encryption options for this document. The userPassword and the
ownerPassword can be null or have zero length. In this case the ownerPassword
is replaced by a random string. The open permissions for the document can be
AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations,
AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting.
The permissions can be combined by ORing them.
@param strength true
for 128 bit key length, false
for 40 bit key length
@param userPassword the user password. Can be null or empty
@param ownerPassword the owner password. Can be null or empty
@param permissions the user permissions
@throws DocumentException if anything was already written to the output
Sets the encryption options for this document. The userPassword and the
ownerPassword can be null or have zero length. In this case the ownerPassword
is replaced by a random string. The open permissions for the document can be
AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations,
AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting.
The permissions can be combined by ORing them.
@param encryptionType the type of encryption. It can be one of STANDARD_ENCRYPTION_40, STANDARD_ENCRYPTION_128 or ENCRYPTION_AES128.
Optionally DO_NOT_ENCRYPT_METADATA can be ored to output the metadata in cleartext
@param userPassword the user password. Can be null or empty
@param ownerPassword the owner password. Can be null or empty
@param permissions the user permissions
@throws DocumentException if the document is already open
Sets the certificate encryption options for this document. An array of one or more public certificates
must be provided together with an array of the same size for the permissions for each certificate.
The open permissions for the document can be
AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations,
AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting.
The permissions can be combined by ORing them.
Optionally DO_NOT_ENCRYPT_METADATA can be ored to output the metadata in cleartext
@param certs the public certificates to be used for the encryption
@param permissions the user permissions for each of the certicates
@param encryptionType the type of encryption. It can be one of STANDARD_ENCRYPTION_40, STANDARD_ENCRYPTION_128 or ENCRYPTION_AES128.
@throws DocumentException if the encryption was set too late
Gets a page from other PDF document. Note that calling this method more than
once with the same parameters will retrieve the same object.
@param reader the PDF document where the page is
@param pageNumber the page number. The first page is 1
@return the template representing the imported page
Adds an annotation of form field in a specific page. This page number
can be overridden with {@link PdfAnnotation#setPlaceInPage(int)}.
@param annot the annotation
@param page the page
Adds an empty signature.
@param name the name of the signature
@param page the page number
@param llx lower left x coordinate of the signature's position
@param lly lower left y coordinate of the signature's position
@param urx upper right x coordinate of the signature's position
@param ury upper right y coordinate of the signature's position
@return a signature form field
@since 2.1.4
Adds the comments present in an FDF file.
@param fdf the FDF file
@throws IOException on error
Sets the thumbnail image for a page.
@param image the image
@param page the page
@throws PdfException on error
@throws DocumentException on error
Adds a JavaScript action at the document level. When the document
opens all this JavaScript runs. The existing JavaScript will be replaced.
@param name the name for the JavaScript snippet in the name tree
@param js the JavaScript code
Adds a file attachment at the document level. Existing attachments will be kept.
@param description the file description
@param fileStore an array with the file. If it's null
the file will be read from the disk
@param file the path to the file. It will only be used if
fileStore
is not null
@param fileDisplay the actual file name stored in the pdf
@throws IOException on error
Adds a file attachment at the document level. Existing attachments will be kept.
@param description the file description
@param fs the file specification
Adds or replaces the Collection Dictionary in the Catalog.
@param collection the new collection dictionary.
Adds a viewer preference
@param preferences the viewer preferences
@see PdfViewerPreferences#addViewerPreference
Sets the document's compression to the new 1.5 mode with object streams and xref
streams. Be attentive!!! If you want set full compression , you should set immediately after creating PdfStamper,
before editing the document.It can be set once and it can't be unset.
Sets the open and close page additional action.
@param actionType the action type. It can be PdfWriter.PAGE_OPEN
or PdfWriter.PAGE_CLOSE
@param action the action to perform
@param page the page where the action will be applied. The first page is 1
@throws PdfException if the action type is invalid
Sets the display duration for the page (for presentations)
@param seconds the number of seconds to display the page. A negative value removes the entry
@param page the page where the duration will be applied. The first page is 1
Sets the transition for the page
@param transition the transition object. A null
removes the transition
@param page the page where the transition will be applied. The first page is 1
Gets the PdfLayer objects in an existing document as a Map
with the names/titles of the layers as keys.
@return a Map with all the PdfLayers in the document (and the name/title of the layer as key)
@since 2.1.2
Gets the optional String
map to add or change values in
the info dictionary.
@return the map or null
An optional String
map to add or change values in
the info dictionary. Entries with null
values delete the key in the original info dictionary
@param moreInfo additional entries to the info dictionary
Gets the signing instance. The appearances and other parameters can the be set.
@return the signing instance
Gets the xml signing instance. The appearances and other parameters can the be set.
@return the signing instance
Checks if the content is automatically adjusted to compensate
the original page rotation.
@return the auto-rotation status
Flags the content to be automatically adjusted to compensate
the original page rotation. The default is true
.
@param rotateContents true
to set auto-rotation, false
otherwise
Gets the underlying PdfWriter.
@return the underlying PdfWriter
Gets the underlying PdfReader.
@return the underlying PdfReader
Gets the AcroFields
object that allows to get and set field values
and to merge FDF forms.
@return the AcroFields
object
Determines if the fields are flattened on close. The fields added with
{@link #addAnnotation(PdfAnnotation,int)} will never be flattened.
@param flat true
to flatten the fields, false
to keep the fields
Determines if the FreeText annotations are flattened on close.
@param flat true
to flatten the FreeText annotations, false
(the default) to keep the FreeText annotations as active content.
Flatten annotations with an appearance stream on close().
@param flat boolean to indicate whether iText should flatten annotations or not.
Sets the bookmarks. The list structure is defined in
{@link SimpleBookmark}.
@param outlines the bookmarks or null
to remove any
Adds a JavaScript action at the document level. When the document
opens all this JavaScript runs. The existing JavaScript will be replaced.
@param js the JavaScript code
Sets the viewer preferences.
@param preferences the viewer preferences
@see PdfViewerPreferences#setViewerPreferences(int)
Sets the XMP metadata.
@param xmp
@see PdfWriter#setXmpMetadata(byte[])
Gets the 1.5 compression status.
@return true
if the 1.5 compression is on
Integer(page number) -> PageStamp
Holds value of property rotateContents.
Creates new PdfStamperImp.
@param reader the read PDF
@param os the output destination
@param pdfVersion the new pdf version or '\0' to keep the same version as the original
document
@param append
@throws DocumentException on error
@throws IOException
@param reader
@param openFile
@throws IOException
@param reader
@param fdf
@throws IOException
@see com.lowagie.text.pdf.PdfWriter#getPageReference(int)
@see com.lowagie.text.pdf.PdfWriter#addAnnotation(com.lowagie.text.pdf.PdfAnnotation)
Adds or replaces the Collection Dictionary in the Catalog.
@param collection the new collection dictionary.
Adds a viewer preference
@param preferences the viewer preferences
@see PdfViewerPreferences#addViewerPreference
Always throws an UnsupportedOperationException
.
@param actionType ignore
@param action ignore
@throws PdfException ignore
@see PdfStamper#setPageAction(PdfName, PdfAction, int)
Sets the open and close page additional action.
@param actionType the action type. It can be PdfWriter.PAGE_OPEN
or PdfWriter.PAGE_CLOSE
@param action the action to perform
@param page the page where the action will be applied. The first page is 1
@throws PdfException if the action type is invalid
Sets the display duration for the page (for presentations)
@param seconds the number of seconds to display the page. A negative value removes the entry
@param page the page where the duration will be applied. The first page is 1
Sets the transition for the page
@param transition the transition object. A null
removes the transition
@param page the page where the transition will be applied. The first page is 1
Getter for property append.
@return Value of property append.
Additional-actions defining the actions to be taken in
response to various trigger events affecting the document
as a whole. The actions types allowed are: DOCUMENT_CLOSE
,
WILL_SAVE
, DID_SAVE
, WILL_PRINT
and DID_PRINT
.
@param actionType the action type
@param action the action to execute in response to the trigger
@throws PdfException on invalid action type
@see com.lowagie.text.pdf.PdfWriter#setOpenAction(com.lowagie.text.pdf.PdfAction)
@see com.lowagie.text.pdf.PdfWriter#setOpenAction(java.lang.String)
Reads the OCProperties dictionary from the catalog of the existing document
and fills the documentOCG, documentOCGorder and OCGRadioGroup variables in PdfWriter.
Note that the original OCProperties of the existing document can contain more information.
@since 2.1.2
Recursive method to reconstruct the documentOCGorder variable in the writer.
@param parent a parent PdfLayer (can be null)
@param arr an array possibly containing children for the parent PdfLayer
@param ocgmap a Hashtable with indirect reference Strings as keys and PdfLayer objects as values.
@since 2.1.2
Gets the PdfLayer objects in an existing document as a Map
with the names/titles of the layers as keys.
@return a Map with all the PdfLayers in the document (and the name/title of the layer as key)
@since 2.1.2
If true, annotations with an appearance stream will be flattened.
@since 5.5.3
@param flatAnnotations boolean
Sets the viewer preferences.
@param preferences the viewer preferences
@see PdfWriter#setViewerPreferences(int)
Set the signature flags.
@param f the flags. This flags are ORed with current ones
Always throws an UnsupportedOperationException
.
@param seconds ignore
Always throws an UnsupportedOperationException
.
@param transition ignore
@see com.lowagie.text.pdf.PdfWriter#setThumbnail(com.lowagie.text.Image)
This is a node in a document logical structure. It may contain a mark point or it may contain
other nodes.
@author Paulo Soares
Holds value of property kids.
Holds value of property reference.
Creates a new instance of PdfStructureElement.
@param parent the parent of this node
@param structureType the type of structure. It may be a standard type or a user type mapped by the role map
Creates a new instance of PdfStructureElement.
@param root the structure tree root
@param structureType the type of structure. It may be a standard type or a user type mapped by the role map
Gets the first entarance of attribute.
@returns PdfObject
@since 5.3.4
Sets the attribute value.
@since 5.3.4
Gets the parent of this node.
@return the parent of this node
Gets the reference this object will be written to.
@return the reference this object will be written to
The structure tree root corresponds to the highest hierarchy level in a tagged PDF.
@author Paulo Soares
Holds value of property writer.
Creates a new instance of PdfStructureTreeRoot
Maps the user tags to the standard tags. The mapping will allow a standard application to make some sense of the tagged
document whatever the user tags may be.
@param used the user tag
@param standard the standard tag
Gets the first entarance of attribute.
@returns PdfObject
@since 5.3.4
Sets the attribute value.
@since 5.3.4
Gets the writer.
@return the writer
Gets the reference this object will be written to.
@return the reference this object will be written to
Adds a PdfNumber
to the PdfArray
.
@param number displacement of the string
Out Vertical Split
Out Horizontal Split
In Vertical Split
IN Horizontal Split
Vertical Blinds
Vertical Blinds
Inward Box
Outward Box
Left-Right Wipe
Right-Left Wipe
Bottom-Top Wipe
Top-Bottom Wipe
Dissolve
Left-Right Glitter
Top-Bottom Glitter
Diagonal Glitter
duration of the transition effect
type of the transition effect
Constructs a Transition
.
Constructs a Transition
.
@param type type of the transition effect
Constructs a Transition
.
@param type type of the transition effect
@param duration duration of the transition effect
The transparency group dictionary.
@author Paulo Soares
Constructs a transparencyGroup.
Determining the initial backdrop against which its stack is composited.
@param isolated
Determining whether the objects within the stack are composited with one another or only with the group's backdrop.
@param knockout
An array specifying a visibility expression, used to compute visibility
of content based on a set of optional content groups.
@since 5.0.2
A boolean operator.
A boolean operator.
A boolean operator.
Creates a visibility expression.
@param type should be AND, OR, or NOT
@see com.itextpdf.text.pdf.PdfArray#add(int, com.itextpdf.text.pdf.PdfObject)
@see com.itextpdf.text.pdf.PdfArray#add(com.itextpdf.text.pdf.PdfObject)
@see com.itextpdf.text.pdf.PdfArray#addFirst(com.itextpdf.text.pdf.PdfObject)
@see com.itextpdf.text.pdf.PdfArray#add(float[])
@see com.itextpdf.text.pdf.PdfArray#add(int[])
@author psoares
Serial version UID
Creates a new instance of PdfIsoConformanceException.
Creates a new instance of PdfIsoConformanceException.
@param s
Creates a new instance of PdfXConformanceException.
Creates a new instance of PdfXConformanceException.
@param s
Converts a PFM file into an AFM file.
Creates a new instance of Pfm2afm
Converts a PFM file into an AFM file.
@param inp the PFM file
@param outp the AFM file
@throws IOException on error
Translate table from 1004 to psstd. 1004 is an extension of the
Windows translate table used in PM.
Character class. This is a minor attempt to overcome the problem that
in the pfm file, all unused characters are given the width of space.
Note that this array isn't used in iText.
Windows character names. Give a name to the used locations
for when the all flag is specified.
This class captures an AcroForm on input. Basically, it extends Dictionary
by indexing the fields of an AcroForm
@author Mark Thompson
Constructor
@param reader reader of the input file
Given the title (/T) of a reference, return the associated reference
@param name a string containing the path
@return a reference to the field, or null
Read, and comprehend the acroform
@param root the docment root
After reading, we index all of the fields. Recursive.
@param fieldlist An array of fields
@param fieldDict the last field dictionary we encountered (recursively)
@param parentPath the pathname of the field, up to this point or null
merge field attributes from two dictionaries
@param parent one dictionary
@param child the other dictionary
@return a merged dictionary
stack a level of dictionary. Merge in a dictionary from this level
Number of fields found
@return size
This class holds the information for a single field
Returns the name of the widget annotation (the /NM entry).
@return a String or null (if there's no /NM key)
Constructs a PdfIndirectReference
.
@param reader a PdfReader
@param number the object number.
@param generation the generation number.
Constructs a PdfIndirectReference
.
@param reader a PdfReader
@param number the object number.
Creates a new PDF stream object that will replace a stream
in a existing PDF file.
@param reader the reader that holds the existing PDF
@param conts the new content
@param compressionLevel the compression level for the content
@since 2.1.3 (replacing the existing constructor without param compressionLevel)
Sets the data associated with the stream, either compressed or
uncompressed. Note that the data will never be compressed if
Document.compress is set to false.
@param data raw data, decrypted and uncompressed.
@param compress true if you want the stream to be compresssed.
@since iText 2.1.1
Sets the data associated with the stream, either compressed or
uncompressed. Note that the data will never be compressed if
Document.compress is set to false.
@param data raw data, decrypted and uncompressed.
@param compress true if you want the stream to be compresssed.
@param compressionLevel a value between -1 and 9 (ignored if compress == false)
@since iText 2.1.3
Sets the data associated with the stream, as-is. This method will not
remove or change any existing filter: the data has to match an existing
filter or an appropriate filter has to be set.
@param data data, possibly encrypted and/or compressed
@since 5.5.0
Sets the data associated with the stream
@param data raw data, decrypted and uncompressed.
@author Paulo Soares
Creates a PRTokeniser for the specified {@link RandomAccessSource}.
The beginning of the file is read to determine the location of the header, and the data source is adjusted
as necessary to account for any junk that occurs in the byte source before the header
@param file the source
Is a certain character a whitespace? Currently checks on the following: '0', '9', '10', '12', '13', '32'.
The same as calling {@link #isWhitespace(int, boolean) isWhiteSpace(ch, true)}.
@param ch int
@return boolean
@since 5.5.1
Checks whether a character is a whitespace. Currently checks on the following: '0', '9', '10', '12', '13', '32'.
@param ch int
@param isWhitespace boolean
@return boolean
@since 5.5.1
Reads data into the provided byte[]. Checks on leading whitespace.
See {@link #isWhitespace(int) isWhiteSpace(int)} or {@link #isWhitespace(int, boolean) isWhiteSpace(int, boolean)}
for a list of whitespace characters.
The same as calling {@link #readLineSegment(byte[], boolean) readLineSegment(input, true)}.
@param input byte[]
@return boolean
@throws IOException
@since 5.5.1
Reads data into the provided byte[]. Checks on leading whitespace.
See {@link #isWhitespace(int) isWhiteSpace(int)} or {@link #isWhitespace(int, boolean) isWhiteSpace(int, boolean)}
for a list of whitespace characters.
@param input byte[]
@param isNullWhitespace boolean to indicate whether '0' is whitespace or not.
If in doubt, use true or overloaded method {@link #readLineSegment(byte[]) readLineSegment(input)}
@return boolean
@throws IOException
@since 5.5.1
A layout option
A layout option
A layout option
A layout option
A layout option
A layout option
A layout option
An icon scaling option
An icon scaling option
An icon scaling option
An icon scaling option
Holds value of property layout.
Holds value of property image.
Holds value of property template.
Holds value of property scaleIcon.
Holds value of property proportionalIcon.
Holds value of property iconVerticalAdjustment.
Holds value of property iconHorizontalAdjustment.
Holds value of property iconFitToBounds.
Creates a new instance of PushbuttonField
@param writer the document PdfWriter
@param box the field location and dimensions
@param fieldName the field name. If null
only the widget keys
will be included in the field allowing it to be used as a kid field.
Gets the button appearance.
@throws IOException on error
@throws DocumentException on error
@return the button appearance
Holds value of property iconReference.
Sets the icon and label layout. Possible values are LAYOUT_LABEL_ONLY
,
LAYOUT_ICON_ONLY
, LAYOUT_ICON_TOP_LABEL_BOTTOM
,
LAYOUT_LABEL_TOP_ICON_BOTTOM
, LAYOUT_ICON_LEFT_LABEL_RIGHT
,
LAYOUT_LABEL_LEFT_ICON_RIGHT
and LAYOUT_LABEL_OVER_ICON
.
The default is LAYOUT_LABEL_ONLY
.
@param layout New value of property layout.
Sets the icon as an image.
@param image the image
Sets the icon as a template.
@param template the template
Sets the way the icon will be scaled. Possible values are
SCALE_ICON_ALWAYS
, SCALE_ICON_NEVER
,
SCALE_ICON_IS_TOO_BIG
and SCALE_ICON_IS_TOO_SMALL
.
The default is SCALE_ICON_ALWAYS
.
@param scaleIcon the way the icon will be scaled
Sets the way the icon is scaled. If true
the icon is scaled proportionally,
if false
the scaling is done anamorphicaly.
@param proportionalIcon the way the icon is scaled
A number between 0 and 1 indicating the fraction of leftover space to allocate at the bottom of the icon.
A value of 0 positions the icon at the bottom of the annotation rectangle.
A value of 0.5 centers it within the rectangle. The default is 0.5.
@param iconVerticalAdjustment a number between 0 and 1 indicating the fraction of leftover space to allocate at the bottom of the icon
A number between 0 and 1 indicating the fraction of leftover space to allocate at the left of the icon.
A value of 0 positions the icon at the left of the annotation rectangle.
A value of 0.5 centers it within the rectangle. The default is 0.5.
@param iconHorizontalAdjustment a number between 0 and 1 indicating the fraction of leftover space to allocate at the left of the icon
Gets the pushbutton field.
@throws IOException on error
@throws DocumentException on error
@return the pushbutton field
If true
the icon will be scaled to fit fully within the bounds of the annotation,
if false
the border width will be taken into account. The default
is false
.
@param iconFitToBounds if true
the icon will be scaled to fit fully within the bounds of the annotation,
if false
the border width will be taken into account
Sets the reference to an existing icon.
@param iconReference the reference to an existing icon
A simple, fast array of bits, represented compactly by an array of ints internally.
@author Sean Owen
@param i bit to get
@return true iff bit i is set
Sets bit i.
@param i bit to set
Flips bit i.
@param i bit to set
Sets a block of 32 bits, starting at bit i.
@param i first bit to set
@param newBits the new value of the next 32 bits. Note again that the least-significant bit
corresponds to bit i, the next-least-significant to i+1, and so on.
Clears all bits (sets to false).
Efficient method to check if a range of bits is set, or not set.
@param start start of range, inclusive.
@param end end of range, exclusive
@param value if true, checks that bits in range are set, otherwise checks that they are not set
@return true iff all bits are set or not set in range, according to value argument
@throws IllegalArgumentException if end is less than or equal to start
@return underlying array of ints. The first element holds the first 32 bits, and the least
significant bit is bit 0.
Reverses all bits in the array.
Represents a 2D matrix of bits. In function arguments below, and throughout the common
module, x is the column position, and y is the row position. The ordering is always x, y.
The origin is at the top-left.
Internally the bits are represented in a 1-D array of 32-bit ints. However, each row begins
with a new int. This is done intentionally so that we can copy out a row into a BitArray very
efficiently.
The ordering of bits is row-major. Within each int, the least significant bits are used first,
meaning they represent lower x values. This is compatible with BitArray's implementation.
@author Sean Owen
@author dswitkin@google.com (Daniel Switkin)
Gets the requested bit, where true means black.
@param x The horizontal component (i.e. which column)
@param y The vertical component (i.e. which row)
@return value of given bit in matrix
Sets the given bit to true.
@param x The horizontal component (i.e. which column)
@param y The vertical component (i.e. which row)
Flips the given bit.
@param x The horizontal component (i.e. which column)
@param y The vertical component (i.e. which row)
Clears all bits (sets to false).
Sets a square region of the bit matrix to true.
@param left The horizontal position to begin at (inclusive)
@param top The vertical position to begin at (inclusive)
@param width The width of the region
@param height The height of the region
A fast method to retrieve one row of data from the matrix as a BitArray.
@param y The row to retrieve
@param row An optional caller-allocated BitArray, will be allocated if null or too small
@return The resulting BitArray - this reference should always be used even when passing
your own row
@return The width of the matrix
@return The height of the matrix
This method is for compatibility with older code. It's only logical to call if the matrix
is square, so I'm throwing if that's not the case.
@return row/column dimension of this matrix
JAVAPORT: This should be combined with BitArray in the future, although that class is not yet
dynamically resizeable. This implementation is reasonable but there is a lot of function calling
in loops I'd like to get rid of.
@author satorux@google.com (Satoru Takabayashi) - creator
@author dswitkin@google.com (Daniel Switkin) - ported from C++
This class implements an array of unsigned bytes.
@author dswitkin@google.com (Daniel Switkin)
Access an unsigned byte at location index.
@param index The index in the array to access.
@return The unsigned value of the byte as an int.
Encapsulates a Character Set ECI, according to "Extended Channel Interpretations" 5.3.1.1
of ISO 18004.
@author Sean Owen
@param name character set ECI encoding name
@return {@link CharacterSetECI} representing ECI for character encoding, or null if it is legal
but unsupported
These are a set of hints that you may pass to Writers to specify their behavior.
@author dswitkin@google.com (Daniel Switkin)
Specifies what degree of error correction to use, for example in QR Codes (type Integer).
Specifies what character encoding to use where applicable (type String)
@author satorux@google.com (Satoru Takabayashi) - creator
@author dswitkin@google.com (Daniel Switkin) - ported from C++
Encode "bytes" with the error correction level "ecLevel". The encoding mode will be chosen
internally by ChooseMode(). On success, store the result in "qrCode".
We recommend you to use QRCode.EC_LEVEL_L (the lowest level) for
"getECLevel" since our primary use is to show QR code on desktop screens. We don't need very
strong error correction for this purpose.
Note that there is no way to encode bytes in MODE_KANJI. We might want to add EncodeWithMode()
with which clients can specify the encoding mode. For now, we don't need the functionality.
@return the code point of the table used in alphanumeric mode or
-1 if there is no corresponding code in the table.
Choose the best mode by examining the content. Note that 'encoding' is used as a hint;
if it is Shift_JIS, and the input is only double-byte Kanji, then we return {@link Mode#KANJI}.
Initialize "qrCode" according to "numInputBytes", "ecLevel", and "mode". On success,
modify "qrCode".
Terminate bits as described in 8.4.8 and 8.4.9 of JISX0510:2004 (p.24).
Get number of data bytes and number of error correction bytes for block id "blockID". Store
the result in "numDataBytesInBlock", and "numECBytesInBlock". See table 12 in 8.5.1 of
JISX0510:2004 (p.30)
Interleave "bits" with corresponding error correction bytes. On success, store the result in
"result". The interleave rule is complicated. See 8.6 of JISX0510:2004 (p.37) for details.
Append mode info. On success, store the result in "bits".
Append length info. On success, store the result in "bits".
Append "bytes" in "mode" mode (encoding) into "bits". On success, store the result in "bits".
See ISO 18004:2006, 6.5.1. This enum encapsulates the four error correction levels
defined by the QR code standard.
@author Sean Owen
L = ~7% correction
M = ~15% correction
Q = ~25% correction
H = ~30% correction
@param bits int containing the two bits encoding a QR Code's error correction level
@return {@link ErrorCorrectionLevel} representing the encoded error correction level
Encapsulates a QR Code's format information, including the data mask used and
error correction level.
@author Sean Owen
@see ErrorCorrectionLevel
See ISO 18004:2006, Annex C, Table C.1
Offset i holds the number of 1 bits in the binary representation of i
@param maskedFormatInfo1 format info indicator, with mask still applied
@param maskedFormatInfo2 second copy of same info; both are checked at the same time
to establish best match
@return information about the format it specifies, or null
if doesn't seem to match any known pattern
This class contains utility methods for performing mathematical operations over
the Galois Field GF(256). Operations use a given primitive polynomial in calculations.
Throughout this package, elements of GF(256) are represented as an int
for convenience and speed (but at the cost of memory).
Only the bottom 8 bits are really used.
@author Sean Owen
Create a representation of GF(256) using the given primitive polynomial.
@param primitive irreducible polynomial whose coefficients are represented by
the bits of an int, where the least-significant bit represents the constant
coefficient
@return the monomial representing coefficient * x^degree
Implements both addition and subtraction -- they are the same in GF(256).
@return sum/difference of a and b
@return 2 to the power of a in GF(256)
@return base 2 log of a in GF(256)
@return multiplicative inverse of a
@param a
@param b
@return product of a and b in GF(256)
Represents a polynomial whose coefficients are elements of GF(256).
Instances of this class are immutable.
Much credit is due to William Rucklidge since portions of this code are an indirect
port of his C++ Reed-Solomon implementation.
@author Sean Owen
@param field the {@link GF256} instance representing the field to use
to perform computations
@param coefficients coefficients as ints representing elements of GF(256), arranged
from most significant (highest-power term) coefficient to least significant
@throws IllegalArgumentException if argument is null or empty,
or if leading coefficient is 0 and this is not a
constant polynomial (that is, it is not the monomial "0")
@return degree of this polynomial
@return true iff this polynomial is the monomial "0"
@return coefficient of x^degree term in this polynomial
@return evaluation of this polynomial at a given point
@author satorux@google.com (Satoru Takabayashi) - creator
@author dswitkin@google.com (Daniel Switkin) - ported from C++
@author satorux@google.com (Satoru Takabayashi) - creator
@author dswitkin@google.com (Daniel Switkin) - ported from C++
See ISO 18004:2006, 6.4.1, Tables 2 and 3. This enum encapsulates the various modes in which
data can be encoded to bits in the QR code standard.
@author Sean Owen
@param bits four bits encoding a QR Code data mode
@return {@link Mode} encoded by these bits
@throws IllegalArgumentException if bits do not correspond to a known mode
@param version version in question
@return number of bits used, in this QR Code symbol {@link Version}, to encode the
count of characters that will follow encoded in this {@link Mode}
@author satorux@google.com (Satoru Takabayashi) - creator
@author dswitkin@google.com (Daniel Switkin) - ported from C++
This object renders a QR Code as a ByteMatrix 2D array of greyscale values.
@author dswitkin@google.com (Daniel Switkin)
Implements Reed-Solomon enbcoding, as the name implies.
@author Sean Owen
@author William Rucklidge
Thrown when an exception occurs during Reed-Solomon decoding, such as when
there are too many errors to correct.
@author Sean Owen
See ISO 18004:2006 Annex D
@author Sean Owen
See ISO 18004:2006 Annex D.
Element i represents the raw version bits that specify version i + 7
Deduces version information purely from QR Code dimensions.
@param dimension dimension in modules
@return {@link Version} for a QR Code of that dimension
@throws FormatException if dimension is not 1 mod 4
See ISO 18004:2006 Annex E
See ISO 18004:2006 6.5.1 Table 9
Encapsulates a set of error-correction blocks in one symbol version. Most versions will
use blocks of differing sizes within one version, so, this encapsulates the parameters for
each set of blocks. It also holds the number of error-correction codewords per block since it
will be the same across all blocks within one version.
Encapsualtes the parameters for one error-correction block in one symbol version.
This includes the number of data codewords, and the number of times a block with these
parameters is used consecutively in the QR code version's format.
A base class which covers the range of exceptions which may occur when encoding a barcode using
the Writer framework.
@author dswitkin@google.com (Daniel Switkin)
A field with the symbol check
A field with the symbol circle
A field with the symbol cross
A field with the symbol diamond
A field with the symbol square
A field with the symbol star
Holds value of property checkType.
Holds value of property onValue.
Holds value of property checked.
Creates a new instance of RadioCheckField
@param writer the document PdfWriter
@param box the field location and dimensions
@param fieldName the field name. It must not be null
@param onValue the value when the field is checked
Gets the field appearance.
@param isRadio true
for a radio field and false
for a check field
@param on true
for the checked state, false
otherwise
@throws IOException on error
@throws DocumentException on error
@return the appearance
Gets the special field appearance for the radio circle.
@param on true
for the checked state, false
otherwise
@return the appearance
Gets a radio group. It's composed of the field specific keys, without the widget
ones. This field is to be used as a field aggregator with {@link PdfFormField#addKid(PdfFormField) AddKid()}.
@param noToggleToOff if true
, exactly one radio button must be selected at all
times; clicking the currently selected button has no effect.
If false
, clicking
the selected button deselects it, leaving no button selected.
@param radiosInUnison if true
, a group of radio buttons within a radio button field that
use the same value for the on state will turn on and off in unison; that is if
one is checked, they are all checked. If false
, the buttons are mutually exclusive
(the same behavior as HTML radio buttons)
@return the radio group
Gets a radio or check field.
@param isRadio true
to get a radio field, false
to get
a check field
@throws IOException on error
@throws DocumentException on error
@return the field
Sets the checked symbol. It can be
TYPE_CHECK
,
TYPE_CIRCLE
,
TYPE_CROSS
,
TYPE_DIAMOND
,
TYPE_SQUARE
and
TYPE_STAR
.
@param checkType the checked symbol
Sets the value when the field is checked.
@param onValue the value when the field is checked
Sets the state of the field to checked or unchecked.
@param checked the state of the field, true
for checked
and false
for unchecked
Gets the radio field. It's only composed of the widget keys and must be used
with {@link #getRadioGroup(bool,bool)}.
@return the radio field
@throws IOException on error
@throws DocumentException on error
Gets the check field.
@return the check field
@throws IOException on error
@throws DocumentException on error
Intended to be layered on top of a low level RandomAccessSource object. Provides
functionality useful during parsing:
- tracks current position in the file
- allows single byte pushback
- allows reading of multi-byte data structures (int, long, String) for both Big and Little Endian representations
- allows creation of independent 'views' of the underlying data source
@author Paulo Soares, Kevin Day
The source that backs this object
The physical location in the underlying byte source.
the pushed back byte, if any
Whether there is a pushed back byte
@deprecated use {@link RandomAccessFileOrArray#RandomAccessFileOrArray(RandomAccessSource)} instead
@param filename
@throws IOException
Creates an independent view of the specified source. Closing the new object will not close the source.
Closing the source will have adverse effect on the behavior of the new view.
@deprecated use {@link RandomAccessFileOrArray#createView()} instead
@param source the source for the new independent view
Creates an independent view of this object (with it's own file pointer and pushback queue). Closing the new object will not close this object.
Closing this object will have adverse effect on the view.
@return the new view
Creates a RandomAccessFileOrArray that wraps the specified byte source. The byte source will be closed when
this RandomAccessFileOrArray is closed.
@param byteSource the byte source to wrap
Constructs a new RandomAccessFileOrArrayObject
@param filename the file to open (can be a file system file or one of the following url strings: file://, http://, https://, jar:, wsjar:, vfszip:
@param forceRead if true, the entire file will be read into memory
@param plainRandomAccess if true, a regular RandomAccessFile is used to access the file contents. If false, a memory mapped file will be used, unless the file cannot be mapped into memory, in which case regular RandomAccessFile will be used
@throws IOException if there is a failure opening or reading the file
@deprecated use {@link RandomAccessSourceFactory#createBestSource(String)} and {@link RandomAccessFileOrArray#RandomAccessFileOrArray(RandomAccessSource)} instead
@param url
@throws IOException
@deprecated use {@link RandomAccessSourceFactory#createSource(URL)} and {@link RandomAccessFileOrArray#RandomAccessFileOrArray(RandomAccessSource)} instead
@param is
@throws IOException
@deprecated use {@link RandomAccessSourceFactory#createSource(InputStream)} and {@link RandomAccessFileOrArray#RandomAccessFileOrArray(RandomAccessSource)} instead
@param arrayIn
@throws IOException
@deprecated use {@link RandomAccessSourceFactory#createSource(byte[])} and {@link RandomAccessFileOrArray#RandomAccessFileOrArray(RandomAccessSource)} instead
Pushes a byte back. The next get() will return this byte instead of the value from the underlying data source
@param b the byte to push
Reads a single byte
@return the byte, or -1 if EOF is reached
@throws IOException
This class allows you to sign with either an RSACryptoServiceProvider/DSACryptoServiceProvider from a X509Certificate2,
or from manually created RSACryptoServiceProvider/DSACryptoServiceProvider.
Depending on the certificate's CSP, sometimes you will not be able to sign with SHA-256/SHA-512 hash algorithm with
RSACryptoServiceProvider taken directly from the certificate.
This class allows you to use a workaround in this case and sign with certificate's private key and SHA-256/SHA-512 anyway.
An example of a workaround for CSP that does not support SHA-256/SHA-512:
if (certificate.PrivateKey is RSACryptoServiceProvider)
{
RSACryptoServiceProvider rsa = (RSACryptoServiceProvider)certificate.PrivateKey;
// Modified by J. Arturo
// Workaround for SHA-256 and SHA-512
if (rsa.CspKeyContainerInfo.ProviderName == "Microsoft Strong Cryptographic Provider" ||
rsa.CspKeyContainerInfo.ProviderName == "Microsoft Enhanced Cryptographic Provider v1.0" ||
rsa.CspKeyContainerInfo.ProviderName == "Microsoft Base Cryptographic Provider v1.0")
{
string providerName = "Microsoft Enhanced RSA and AES Cryptographic Provider";
int providerType = 24;
Type CspKeyContainerInfo_Type = typeof(CspKeyContainerInfo);
FieldInfo CspKeyContainerInfo_m_parameters = CspKeyContainerInfo_Type.GetField("m_parameters", BindingFlags.NonPublic | BindingFlags.Instance);
CspParameters parameters = (CspParameters)CspKeyContainerInfo_m_parameters.GetValue(rsa.CspKeyContainerInfo);
var cspparams = new CspParameters(providerType, providerName, rsa.CspKeyContainerInfo.KeyContainerName);
cspparams.Flags = parameters.Flags;
using (var rsaKey = new RSACryptoServiceProvider(cspparams))
{
// use rsaKey now
}
}
else
{
// Use rsa directly
}
}
Interface that needs to be implemented to do the actual signing.
For instance: you'll have to implement this interface if you want
to sign a PDF using a smart card.
@author Paulo Soares
Returns the hash algorithm.
@return the hash algorithm (e.g. "SHA-1", "SHA-256,...")
Returns the encryption algorithm used for signing.
@return the encryption algorithm ("RSA" or "DSA")
Signs it using the encryption algorithm in combination with
the digest algorithm.
@param message the message you want to be hashed and signed
@return a signed message digest
@throws GeneralSecurityException
The hash algorithm.
The encryption algorithm (obtained from the private key)
Returns the encryption algorithm used for signing.
@return the encryption algorithm ("RSA" or "DSA")
@see com.itextpdf.text.pdf.security.ExternalSignature#getEncryptionAlgorithm()
Produces a blank (or empty) signature. Useful for deferred signing with
MakeSignature.signExternalContainer().
@author Paulo Soares
Interface to sign a document. The signing is fully done externally, including the container composition.
@author Paulo Soares
Produces the container with the signature.
@param data the data to sign
@return a container with the signature and other objects, like CRL and OCSP. The container will generally be a PKCS7 one.
@throws GeneralSecurityException
Modifies the signature dictionary to suit the container. At least the keys PdfName.FILTER and
PdfName.SUBFILTER will have to be set.
@param signDic the signature dictionary
Helps to locate xml stream
Constructor for XPath2 expression
Get XPath2 expression
Get XmlNamespaceManager to resolve namespace conflicts
Class that signs your XML.
Signs the xml using the enveloped mode, with optional xpath transform (see XmlSignatureAppearance).
@param sap the XmlSignatureAppearance
@param externalSignature the interface providing the actual signing
@param keyInfo KeyInfo for verification
@throws GeneralSecurityException
@throws IOException
@throws DocumentException
Signs the xml with XAdES BES using the enveloped mode, with optional xpath transform (see XmlSignatureAppearance).
@param sap the XmlSignatureAppearance
@param externalSignature the interface providing the actual signing
@param chain the certificate chain
@param includeSignaturePolicy if true SignaturePolicyIdentifier will be included (XAdES-EPES)
@throws GeneralSecurityException
@throws IOException
@throws DocumentException
Signs the xml with XAdES BES using the enveloped mode, with optional xpath transform (see XmlSignatureAppearance).
@param sap the XmlSignatureAppearance
@param externalSignature the interface providing the actual signing
@param chain the certificate chain
@throws GeneralSecurityException
@throws IOException
@throws DocumentException
Signs the xml with XAdES BES using the enveloped mode, with optional xpath transform (see XmlSignatureAppearance).
@param sap the XmlSignatureAppearance
@param externalSignature the interface providing the actual signing
@param chain the certificate chain
@throws GeneralSecurityException
@throws IOException
@throws DocumentException
Signs the xml using the enveloped mode, with optional xpath transform (see XmlSignatureAppearance).
@param sap the XmlSignatureAppearance
@param externalSignature the interface providing the actual signing
@param chain the certificate chain
@throws GeneralSecurityException
@throws IOException
@throws DocumentException
Signs the xml using the enveloped mode, with optional xpath transform (see XmlSignatureAppearance).
@param sap the XmlSignatureAppearance
@param externalSignature the interface providing the actual signing
@param publicKey PublicKey for verification
@throws GeneralSecurityException
@throws IOException
@throws DocumentException
A dictionary that stores the name of the application that signs the PDF.
Creates new PdfSignatureAppDictionary
Sets the signature created property in the Prop_Build dictionary's App
dictionary
@param name
Dictionary that stores signature build properties.
@author Kwinten Pisman
Creates new PdfSignatureBuildProperties
Gets the {@link PdfSignatureAppDictionary} from this dictionary. If it
does not exist, it adds a new {@link PdfSignatureAppDictionary} and
returns this instance.
@return {@link PdfSignatureAppDictionary}
Sets the signatureCreator property in the underlying
{@link PdfSignatureAppDictionary} dictionary.
@param name
Class that encapsulates the signature policy information
@author J. Arturo
Sample:
SignaturePolicyInfo spi = new SignaturePolicyInfo("2.16.724.1.3.1.1.2.1.9",
"G7roucf600+f03r/o0bAOQ6WAs0=", "SHA-1", "https://sede.060.gob.es/politica_de_firma_anexo_1.pdf");
Generates a list of numbers from a string.
@param ranges the comma separated ranges
@param maxNumber the maximum number in the range
@return a list with the numbers as Integer
Implements a shading pattern as a Color
.
@author Paulo Soares
Creates a new instance of SimpleBookmark
Gets number of indirect. If type of directed indirect is PAGES, it refers PAGE object through KIDS.
(Contributed by Kazuya Ujihara)
@param indirect
2004-06-13
Gets a List
with the bookmarks. It returns null
if
the document doesn't have any bookmarks.
@param reader the document
@return a List
with the bookmarks or null
if the
document doesn't have any
Gets a List
with the bookmarks that are children of outline
. It returns null
if
the document doesn't have any bookmarks.
@param reader the document
@param outline the outline dictionary to get bookmarks from
@param includeRoot indicates if to include outline
parameter itself into returned list of bookmarks
@return a List
with the bookmarks or null
if the
document doesn't have any
Removes the bookmark entries for a number of page ranges. The page ranges
consists of a number of pairs with the start/end page range. The page numbers
are inclusive.
@param list the bookmarks
@param pageRange the page ranges, always in pairs.
For the pages in range add the pageShift
to the page number.
The page ranges
consists of a number of pairs with the start/end page range. The page numbers
are inclusive.
@param list the bookmarks
@param pageShift the number to add to the pages in range
@param pageRange the page ranges, always in pairs. It can be null
to include all the pages
Exports the bookmarks to XML. Only of use if the generation is to be include in
some other XML document.
@param list the bookmarks
@param out the export destination. The writer is not closed
@param indent the indentation level. Pretty printing significant only. Use -1
for no indents.
@param onlyASCII codes above 127 will always be escaped with &#nn; if true
,
whatever the encoding
@throws IOException on error
Exports the bookmarks to XML.
@param list the bookmarks
@param wrt the export destination. The writer is not closed
@param encoding the encoding according to IANA conventions
@param onlyASCII codes above 127 will always be escaped with &#nn; if true
,
whatever the encoding
@throws IOException on error
Import the bookmarks from XML.
@param in the XML source. The stream is not closed
@throws IOException on error
@return the bookmarks
Import the bookmarks from XML.
@param in the XML source. The reader is not closed
@throws IOException on error
@return the bookmarks
@author Paulo Soares
Exports the bookmarks to XML.
@param names the names
@param wrt the export destination. The writer is not closed
@param encoding the encoding according to IANA conventions
@param onlyASCII codes above 127 will always be escaped with &#nn; if true
,
whatever the encoding
@throws IOException on error
Import the names from XML.
@param inp the XML source. The stream is not closed
@throws IOException on error
@return the names
Import the names from XML.
@param inp the XML source. The reader is not closed
@throws IOException on error
@return the names
@author psoares
Creates a new instance of StampContent
Gets a duplicate of this PdfContentByte
. All
the members are copied by reference but the buffer stays different.
@return a copy of this PdfContentByte
Creates a new instance of StandardDecryption
Escapes a byte
array according to the PDF conventions.
@param b the byte
array to escape
@return an escaped byte
array
Escapes a byte
array according to the PDF conventions.
@param b the byte
array to escape
Converts an array of unsigned 16bit numbers to an array of bytes.
The input values are presented as chars for convenience.
@param chars the array of 16bit numbers that should be converted
@return the resulting byte array, twice as large as the input
Supports text, combo and list fields generating the correct appearances.
All the option in the Acrobat GUI are supported in an easy to use API.
@author Paulo Soares
Holds value of property defaultText.
Holds value of property choices.
Holds value of property choiceExports.
Holds value of property choiceSelection.
Represents the /TI value
Creates a new TextField
.
@param writer the document PdfWriter
@param box the field location and dimensions
@param fieldName the field name. If null
only the widget keys
will be included in the field allowing it to be used as a kid field.
Obfuscates a password String
.
Every character is replaced by an asterisk (*).
@param text
@return String
@since 2.1.5
Get the PdfAppearance
of a text or combo field
@throws IOException on error
@throws DocumentException on error
@return A PdfAppearance
Get the PdfAppearance
of a list field
@throws IOException on error
@throws DocumentException on error
@return A PdfAppearance
Gets a new text field.
@throws IOException on error
@throws DocumentException on error
@return a new text field
Gets a new combo field.
@throws IOException on error
@throws DocumentException on error
@return a new combo field
Gets a new list field.
@throws IOException on error
@throws DocumentException on error
@return a new list field
Sets extra margins in text fields to better mimic the Acrobat layout.
@param extraMarginLeft the extra marging left
@param extraMarginTop the extra margin top
Holds value of property substitutionFonts.
Holds value of property extensionFont.
Sets the default text. It is only meaningful for text fields.
@param defaultText the default text
Sets the choices to be presented to the user in list/combo
fields.
@param choices the choices to be presented to the user
Sets the export values in list/combo fields. If this array
is null
then the choice values will also be used
as the export values.
@param choiceExports the export values in list/combo fields
Sets the zero based index of the selected item.
@param choiceSelection the zero based index of the selected item
Sets the top visible choice for lists;
@since 5.5.3
@param visibleTopChoice index of the first visible item (zero-based array)
Returns the index of the top visible choice of a list. Default is -1.
@return the index of the top visible choice
Sets a list of substitution fonts. The list is composed of BaseFont
and can also be null
. The fonts in this list will be used if the original
font doesn't contain the needed glyphs.
@param substitutionFonts the list
Sets the extensionFont. This font will be searched before the
substitution fonts. It may be null
.
@param extensionFont New value of property extensionFont.
Subsets a True Type font by removing the unneeded glyphs from
the font.
@author Paulo Soares
Contains the location of the several tables. The key is the name of
the table and the value is an int[3]
where position 0
is the checksum, position 1 is the offset from the start of the file
and position 2 is the length of the table.
The file in use.
The file name.
Creates a new TrueTypeFontSubSet
@param directoryOffset The offset from the start of the file to the table directory
@param fileName the file name of the font
@param glyphsUsed the glyphs used
@param includeCmap true
if the table cmap is to be included in the generated font
Does the actual work of subsetting the font.
@throws IOException on error
@throws DocumentException on error
@return the subset font
Reads a string
from the font file as bytes using the Cp1252
encoding.
@param length the length of bytes to read
@return the string
read
@throws IOException the font file could not be read
Represents a True Type font with Unicode encoding. All the character
in the font can be used directly by using the encoding Identity-H or
Identity-V. This is the only way to represent some character sets such
as Thai.
@author Paulo Soares
Creates a new TrueType font addressed by Unicode characters. The font
will always be embedded.
@param ttFile the location of the font on file. The file must end in '.ttf'.
The modifiers after the name are ignored.
@param enc the encoding to be applied to this font
@param emb true if the font is to be embedded in the PDF
@param ttfAfm the font as a byte
array
@throws DocumentException the font is invalid
@throws IOException the font file could not be read
Gets the width of a char
in normalized 1000 units.
@param char1 the unicode char
to get the width of
@return the width in normalized 1000 units
Gets the width of a string
in normalized 1000 units.
@param text the string
to get the witdth of
@return the width in normalized 1000 units
Creates a ToUnicode CMap to allow copy and paste from Acrobat.
@param metrics metrics[0] contains the glyph index and metrics[2]
contains the Unicode code
@throws DocumentException on error
@return the stream representing this CMap or null
Gets an hex string in the format "<HHHH>".
@param n the number
@return the hex string
Generates the CIDFontTyte2 dictionary.
@param fontDescriptor the indirect reference to the font descriptor
@param subsetPrefix the subset prefix
@param metrics the horizontal width metrics
@return a stream
Generates the font dictionary.
@param descendant the descendant dictionary
@param subsetPrefix the subset prefix
@param toUnicode the ToUnicode stream
@return the stream
The method used to sort the metrics array.
@param o1 the first element
@param o2 the second element
@return the comparisation
Outputs to the writer the font dictionaries and streams.
@param writer the writer for this document
@param ref the font indirect reference
@param parms several parameters that depend on the font type
@throws IOException on error
@throws DocumentException error in generating the object
Returns a PdfStream object with the full font program.
@return a PdfStream with the font program
@since 2.1.3
A forbidden operation. Will throw a null pointer exception.
@param text the text
@return always null
Gets the glyph index and metrics for a character.
@param c the character
@return an int
array with {glyph index, width}
Checks if a character exists in this font.
@param c the character to check
@return true
if the character has a glyph,
false
otherwise
Sets the character advance.
@param c the character
@param advance the character advance normalized to 1000 units
@return true
if the advance was set,
false
otherwise
Reads a Type1 font
@author Paulo Soares
The PFB file if the input was made with a byte
array.
The Postscript font name.
The full name of the font.
The family name of the font.
The weight of the font: normal, bold, etc.
The italic angle of the font, usually 0.0 or negative.
true
if all the characters have the same
width.
The character set of the font.
The llx of the FontBox.
The lly of the FontBox.
The lurx of the FontBox.
The ury of the FontBox.
The underline position.
The underline thickness.
The font's encoding name. This encoding is 'StandardEncoding' or
'AdobeStandardEncoding' for a font that can be totally encoded
according to the characters names. For all other names the
font is treated as symbolic.
A variable.
A variable.
A variable.
A variable.
A variable.
A variable.
Represents the section CharMetrics in the AFM file. Each
value of this array contains a Object[4]
with an
Integer, Integer, String and int[]. This is the code, width, name and char bbox.
The key is the name of the char and also an Integer with the char number.
Represents the section KernPairs in the AFM file. The key is
the name of the first character and the value is a Object[]
with 2 elements for each kern pair. Position 0 is the name of
the second character and position 1 is the kerning distance. This is
repeated for all the pairs.
The file in use.
true
if this font is one of the 14 built in fonts.
Types of records in a PFB file. ASCII is 1 and BINARY is 2.
They have to appear in the PFB file in this sequence.
Creates a new Type1 font.
@param ttfAfm the AFM file if the input is made with a byte
array
@param pfb the PFB file if the input is made with a byte
array
@param afmFile the name of one of the 14 built-in fonts or the location of an AFM file. The file must end in '.afm'
@param enc the encoding to be applied to this font
@param emb true if the font is to be embedded in the PDF
@throws DocumentException the AFM file is invalid
@throws IOException the AFM file could not be read
Gets the width from the font according to the name
or,
if the name
is null, meaning it is a symbolic font,
the char c
.
@param c the char if the font is symbolic
@param name the glyph name
@return the width of the char
Gets the kerning between two Unicode characters. The characters
are converted to names and this names are used to find the kerning
pairs in the Hashtable
KernPairs
.
@param char1 the first char
@param char2 the second char
@return the kerning to be applied
Reads the font metrics
@param rf the AFM file
@throws DocumentException the AFM file is invalid
@throws IOException the AFM file could not be read
If the embedded flag is false
or if the font is
one of the 14 built in types, it returns null
,
otherwise the font is read and output in a PdfStream object.
@return the PdfStream containing the font or null
@throws DocumentException if there is an error reading the font
Generates the font descriptor for this font or null
if it is
one of the 14 built in fonts.
@param fontStream the indirect reference to a PdfStream containing the font or null
@return the PdfDictionary containing the font descriptor or null
Generates the font dictionary for this font.
@return the PdfDictionary containing the font dictionary
@param firstChar the first valid character
@param lastChar the last valid character
@param shortTag a 256 bytes long byte
array where each unused byte is represented by 0
@param fontDescriptor the indirect reference to a PdfDictionary containing the font descriptor or null
Outputs to the writer the font dictionaries and streams.
@param writer the writer for this document
@param ref the font indirect reference
@param parms several parameters that depend on the font type
@throws IOException on error
@throws DocumentException error in generating the object
Gets the font parameter identified by key
. Valid values
for key
are ASCENT
, CAPHEIGHT
, DESCENT
,
ITALICANGLE
, BBOXLLX
, BBOXLLY
, BBOXURX
and BBOXURY
.
@param key the parameter to be extracted
@param fontSize the font size in points
@return the parameter in points
Sets the font parameter identified by key
. Valid values
for key
are ASCENT
, CAPHEIGHT
, DESCENT
,
ITALICANGLE
, BBOXLLX
, BBOXLLY
, BBOXURX
and BBOXURY
.
@param key the parameter to be updated
@param value the parameter value
Checks if the font has any kerning pairs.
@return true
if the font has any kerning pairs
Sets the kerning between two Unicode chars.
@param char1 the first char
@param char2 the second char
@param kern the kerning to apply in normalized 1000 units
@return true
if the kerning was applied, false
otherwise
Gets the postscript font name.
@return the postscript font name
A class to support Type3 fonts.
Creates a Type3 font.
@param writer the writer
@param chars an array of chars corresponding to the glyphs used (not used, prisent for compability only)
@param colorized if true
the font may specify color, if false
no color commands are allowed
and only images as masks can be used
Defines a glyph. If the character was already defined it will return the same content
@param c the character to match this glyph.
@param wx the advance this character will have
@param llx the X lower left corner of the glyph bounding box. If the colorize
option is
true
the value is ignored
@param lly the Y lower left corner of the glyph bounding box. If the colorize
option is
true
the value is ignored
@param urx the X upper right corner of the glyph bounding box. If the colorize
option is
true
the value is ignored
@param ury the Y upper right corner of the glyph bounding box. If the colorize
option is
true
the value is ignored
@return a content where the glyph can be defined
Always returns null, because you can't get the FontStream of a Type3 font.
@return null
@since 2.1.3
The content where Type3 glyphs are written to.
Writes text vertically. Note that the naming is done according
to horizontal text although it referrs to vertical text.
A line with the alignment Element.LEFT_ALIGN will actually
be top aligned.
Signals that there are no more text available.
Signals that there is no more column.
The chunks that form the text.
The PdfContent
where the text will be written to.
The column Element. Default is left Element.
Marks the chunks to be eliminated when the line is written.
The chunk created by the splitting.
The chunk created by the splitting.
The leading
The X coordinate.
The Y coordinate.
The maximum number of vertical lines.
The height of the text.
Creates new VerticalText
@param text the place where the text will be written to. Can
be a template.
Adds a Phrase
to the current text array.
@param phrase the text
Adds a Chunk
to the current text array.
@param chunk the text
Sets the layout.
@param startX the top right X line position
@param startY the top right Y line position
@param height the height of the lines
@param maxLines the maximum number of lines
@param leading the separation between the lines
Creates a line from the chunk array.
@param width the width of the line
@return the line or null if no more chunks
Normalizes the list of chunks when the line is accepted.
Outputs the lines to the document. It is equivalent to go(false)
.
@return returns the result of the operation. It can be NO_MORE_TEXT
and/or NO_MORE_COLUMN
@throws DocumentException on error
Outputs the lines to the document. The output can be simulated.
@param simulate true
to simulate the writting to the document
@return returns the result of the operation. It can be NO_MORE_TEXT
and/or NO_MORE_COLUMN
@throws DocumentException on error
Sets the new text origin.
@param startX the X coordinate
@param startY the Y coordinate
Gets the separation between the vertical lines.
@return the vertical line separation
Gets the X coordinate where the next line will be writen. This value will change
after each call to go()
.
@return the X coordinate
Gets the Y coordinate where the next line will be writen.
@return the Y coordinate
Gets the maximum number of available lines. This value will change
after each call to go()
.
@return Value of property maxLines.
Gets the height of the line
@return the height
Gets the Element.
@return the alignment
Processes XFA forms.
@author Paulo Soares
An empty constructor to build on.
Return the XFA Object, could be an array, could be a Stream.
Returns null f no XFA Object is present.
@param reader a PdfReader instance
@return the XFA object
@since 2.1.3
A constructor from a PdfReader
. It basically does everything
from finding the XFA stream to the XML parsing.
@param reader the reader
@throws java.io.IOException on error
@throws javax.xml.parsers.ParserConfigurationException on error
@throws org.xml.sax.SAXException on error
Extracts the nodes from the domDocument.
@since 2.1.5
Some XFA forms don't have a datasets node.
If this is the case, we have to add one.
Sets the XFA key from a byte array. The old XFA is erased.
@param form the data
@param reader the reader
@param writer the writer
@throws java.io.IOException on error
Sets the XFA key from the instance data. The old XFA is erased.
@param writer the writer
@throws java.io.IOException on error
Serializes a XML document to a byte array.
@param n the XML document
@throws java.io.IOException on error
@return the serialized XML document
Finds the complete field name contained in the "classic" forms from a partial
name.
@param name the complete or partial name
@param af the fields
@return the complete name or null
if not found
Finds the complete SOM name contained in the datasets section from a
possibly partial name.
@param name the complete or partial name
@return the complete name or null
if not found
Finds the Node
contained in the datasets section from a
possibly partial name.
@param name the complete or partial name
@return the Node
or null
if not found
Gets all the text contained in the child nodes of this node.
@param n the Node
@return the text found or "" if no text was found
Sets the text of this node. All the child's node are deleted and a new
child text node is created.
@param n the Node
to add the text to
@param text the text to add
Replaces the data under datasets/data.
@since iText 5.0.0
Returns true
if it is a XFA form.
@return true
if it is a XFA form
Gets the top level DOM document.
@return the top level DOM document
Sets the PdfReader
to be used by this instance.
@param reader the PdfReader
to be used by this instance
Checks if this XFA form was changed.
@return true
if this XFA form was changed
Gets the class that contains the template processing section of the XFA.
@return the class that contains the template processing section of the XFA
Gets the class that contains the datasets processing section of the XFA.
@return the class that contains the datasets processing section of the XFA
Gets the class that contains the "classic" fields processing.
@return the class that contains the "classic" fields processing
Gets the Node
that corresponds to the datasets part.
@return the Node
that corresponds to the datasets part
A structure to store each part of a SOM name and link it to the next part
beginning from the lower hierarchie.
Search the current node for a similar name. A similar name starts
with the same name but has a differnt index. For example, "detail[3]"
is similar to "detail[9]". The main use is to discard names that
correspond to out of bounds records.
@param name the name to search
@return true
if a similitude was found
Gets the full name by traversing the hiearchie using only the
index 0.
@return the full name
Another stack implementation. The main use is to facilitate
the porting to other languages.
Looks at the object at the top of this stack without removing it from the stack.
@return the object at the top of this stack
Removes the object at the top of this stack and returns that object as the value of this function.
@return the object at the top of this stack
Pushes an item onto the top of this stack.
@param item the item to be pushed onto this stack
@return the item
argument
Tests if this stack is empty.
@return true
if and only if this stack contains no items; false
otherwise
A class for some basic SOM processing.
The order the names appear in the XML, depth first.
The mapping of full names to nodes.
The data to do a search from the bottom hierarchie.
A stack to be used when parsing.
A temporary store for the repetition count.
Escapes a SOM string fragment replacing "." with "\.".
@param s the unescaped string
@return the escaped string
Unescapes a SOM string fragment replacing "\." with ".".
@param s the escaped string
@return the unescaped string
Outputs the stack as the sequence of elements separated
by '.'.
@return the stack as the sequence of elements separated by '.'
Gets the name with the #subform
removed.
@param s the long name
@return the short name
Adds a SOM name to the search node chain.
@param unstack the SOM name
Adds a SOM name to the search node chain.
@param inverseSearch the start point
@param stack the stack with the separeted SOM parts
@param unstack the full name
Searchs the SOM hiearchie from the bottom.
@param parts the SOM parts
@return the full name or null
if not found
Splits a SOM name in the individual parts.
@param name the full SOM name
@return the split name
Gets the order the names appear in the XML, depth first.
@return the order the names appear in the XML, depth first
Gets the mapping of full names to nodes.
@return the mapping of full names to nodes
Gets the data to do a search from the bottom hierarchie.
@return the data to do a search from the bottom hierarchie
Processes the datasets section in the XFA form.
Creates a new instance from the datasets node. This expects
not the datasets but the data node that comes below.
@param n the datasets node
Inserts a new Node
that will match the short name.
@param n the datasets top Node
@param shortName the short name
@return the new Node
of the inserted name
A class to process "classic" fields.
Creates a new instance from a Collection with the full names.
@param items the Collection
Gets the mapping from short names to long names. A long
name may contain the #subform name part.
@return the mapping from short names to long names
Processes the template section in the XFA form.
Creates a new instance from the datasets node.
@param n the template node
Gets the field type as described in the template
section of the XFA.
@param s the exact template name
@return the field type or null
if not found
true
if it's a dynamic form; false
if it's a static form.
@return true
if it's a dynamic form; false
if it's a static form
Helps to locate xml stream inside PDF document with Xfa form.
Gets Document to sign
Save document as single XML stream in AcroForm.
@param document signed document
@throws IOException
@throws DocumentException
Constructor for xpath expression for signing XfaForm
Empty constructor, no transform.
Construct for Xpath expression. Depends from selected xdp package.
@param xdpPackage
Get XPath expression
Possible xdp packages to sign
Reads a XFDF.
@author Leonard Rosenthol (leonardr@pdfsages.com)
Storage for field values if there's more than one value for a field.
@since 2.1.4
Reads an XFDF form.
@param filename the file name of the form
@throws IOException on error
Reads an XFDF form.
@param xfdfIn the byte array with the form
@throws IOException on error
Reads an XFDF form.
@param is an InputStream to read the form
@throws IOException on error
@since 5.0.1
Gets the field value.
@param name the fully qualified field name
@return the field's value
Gets the field value or null
if the field does not
exist or has no value defined.
@param name the fully qualified field name
@return the field value or null
Gets the field values for a list or null
if the field does not
exist or has no value defined.
@param name the fully qualified field name
@return the field values or null
@since 2.1.4
Called when a start tag is found.
@param tag the tag name
@param h the tag's attributes
Called when an end tag is found.
@param tag the tag name
Called when the document starts to be parsed.
Called after the document is parsed.
Called when a text element is found.
@param str the text element, probably a fragment.
Gets all the fields. The map is keyed by the fully qualified
field name and the value is a merged PdfDictionary
with the field content.
@return all the fields
Gets the PDF file specification contained in the FDF.
@return the PDF file specification contained in the FDF
Constructs XmlSignatureAppearance object.
@param writer the writer to which the signature will be written.
Holds value of property xades:SigningTime.
Holds value of property xades:Description.
Holds value of property xades:MimeType.
Sets the certificate used to provide the text in the appearance.
This certificate doesn't take part in the actual signing process.
@param signCertificate the certificate
Gets the signature date.
@return the signature date
Sets the signature date.
@param signDate the signature date
Helps to locate xml stream
@return XmlLocator, cannot be null.
Constructor for xpath expression in case signing only part of XML document.
@return XpathConstructor, can be null
Close PdfStamper
@throws IOException
@throws DocumentException
A RectangleReadOnly is the representation of a geometric figure.
It's the same as a Rectangle but immutable.
Constructs a RectangleReadOnly-object.
lower left x
lower left y
upper right x
upper right y
Constructs a RectangleReadOnly
-object.
@param llx lower left x
@param lly lower left y
@param urx upper right x
@param ury upper right y
@param rotation the rotation of the Rectangle (0, 90, 180, 270)
@since iText 5.0.6
Constructs a RectangleReadOnly-object starting from the origin (0, 0).
upper right x
upper right y
Constructs a RectangleReadOnly
-object starting from the origin
(0, 0) and with a specific rotation (valid values are 0, 90, 180, 270).
@param urx upper right x
@param ury upper right y
@since iText 5.0.6
Constructs a RectangleReadOnly-object.
another Rectangle
Copies all of the parameters from a Rectangle
object
except the position.
@param rect
Rectangle
to copy from
Copies all of the parameters from a Rectangle
object
except the position.
@param rect
Rectangle
to copy from
Switches lowerleft with upperright
Enables the border on the specified side.
@param side
the side to enable. One of LEFT, RIGHT, TOP, BOTTOM
Disables the border on the specified side.
@param side
the side to disable. One of LEFT, RIGHT, TOP, BOTTOM
Get/set the upper right y-coordinate.
a float
Get/set the border
a int
Get/set the grayscale of the rectangle.
a float
Get/set the lower left x-coordinate.
a float
Get/set the upper right x-coordinate.
a float
Get/set the lower left y-coordinate.
a float
Get/set the borderwidth.
a float
Gets the color of the border.
@return a value
Get/set the color of the border.
a BaseColor
Gets the backgroundcolor.
@return a value
Get/set the backgroundcolor.
a BaseColor
Set/gets the rotation
a int
Sets a parameter indicating if the rectangle has variable borders
@param useVariableBorders
indication if the rectangle has variable borders
A special-version of LIST
which use roman-letters.
@see com.lowagie.text.List
@version 2003-06-22
@author Michael Niedermair
Initialization
Initialization
@param symbolIndent indent
Initialization
@param romanlower roman-char in lowercase
@param symbolIndent indent
Adds an Object
to the List
.
@param o the object to add.
@return true if adding the object succeeded
Returns the first occurrence of a special symbol in a String
.
@param string a String
@return an index of -1 if no special symbol was found
Gets a chunk with a symbol character.
@param c a character that has to be changed into a symbol
@param font Font if there is no SYMBOL character corresponding with c
@return a SYMBOL version of a character
Looks for the corresponding symbol in the font Symbol.
@param c the original ASCII-char
@return the corresponding symbol in font Symbol
A collection of convenience methods that were present in many different iText
classes.
Utility method to extend an array.
@param original the original array or null
@param item the item to be added to the array
@return a new array with the item appended
Checks for a true/false value of a key in a Properties object.
@param attributes
@param key
@return
This method makes a valid URL from a given filename.
a given filename
a valid URL
Unescapes an URL. All the "%xx" are replaced by the 'xx' hex char value.
@param src the url to unescape
@return the eunescaped value
This method is an alternative for the Stream.Skip()-method
that doesn't seem to work properly for big values of size.
the stream
the number of bytes to skip
Measurement conversion from millimeters to points.
@param value a value in millimeters
@return a value in points
@since 2.1.2
Measurement conversion from millimeters to inches.
@param value a value in millimeters
@return a value in inches
@since 2.1.2
Measurement conversion from points to millimeters.
@param value a value in points
@return a value in millimeters
@since 2.1.2
Measurement conversion from points to inches.
@param value a value in points
@return a value in inches
@since 2.1.2
Measurement conversion from inches to millimeters.
@param value a value in inches
@return a value in millimeters
@since 2.1.2
Measurement conversion from inches to points.
@param value a value in inches
@return a value in points
@since 2.1.2
Reads the contents of a file to a String.
@param path the path to the file
@return a String with the contents of the file
@since iText 5.0.0
Converts an array of bytes to a String of hexadecimal values
@param bytes a byte array
@return the same bytes expressed as hexadecimal values
The ParserBase
-class provides XML document parsing.
Begins the process of processing an XML document
the XML document to parse
This method gets called when a start tag is encountered.
the name of the tag that is encountered
the list of attributes
This method gets called when an end tag is encountered.
the name of the tag that ends
This method gets called when characters are encountered.
an array of characters
the start position in the array
the number of characters to read from the array
This class contains entities that can be used in an entity tag.
This is a map that contains all possible id values of the entity tag
that can be translated to a character in font Symbol.
Gets a chunk with a symbol character.
@param e a symbol value (see Entities class: alfa is greek alfa,...)
@param font the font if the symbol isn't found (otherwise Font.SYMBOL)
@return a Chunk
Looks for the corresponding symbol in the font Symbol.
@param name the name of the entity
@return the corresponding character in font Symbol
This class contains entities that can be used in an entity tag.
This is a map that contains the names of entities and their unicode value.
Translates an entity to a unicode character.
@param name the name of the entity
@return the corresponding unicode character
Translates a IANA encoding name to a Java encoding.
The object that maps IANA to Java encodings.
The handler for the events fired by SimpleXMLParser
.
@author Paulo Soares
Called when a comment is found.
@param text the comment text
possible states
the state stack
The current character.
The previous character.
the line we are currently reading
the column where the current character occurs
was the last character equivalent to a newline?
A boolean indicating if the next character should be taken into account
if it's a space character. When nospace is false, the previous character
wasn't whitespace.
@since 2.1.5
the current state
Are we parsing HTML?
current text (whatever is encountered between tags)
current tagname
current attributes
The handler to which we are going to forward document content
The handler to which we are going to forward comments.
Keeps track of the number of tags that are open.
the quote character that was used to open the quote.
the attribute key.
the attribute value.
Creates a Simple XML parser object.
Call Go(BufferedReader) immediately after creation.
Does the actual parsing. Perform this immediately
after creating the parser object.
Gets a state from the stack
@return the previous state
Adds a state to the stack.
@param s a state to add to the stack
Flushes the text that is currently in the buffer.
The text can be ignored, added to the document
as content or as comment,... depending on the current state.
Initialized the tag name and attributes.
Sets the name of the tag.
processes the tag.
@param start if true we are dealing with a tag that has just been opened; if false we are closing a tag.
Throws an exception
Parses the XML document firing the events to the handler.
@param doc the document handler
@param r the document. The encoding is already resolved. The reader is not closed
@throws IOException on error
Parses the XML document firing the events to the handler.
@param doc the document handler
@param in the document. The encoding is deduced from the stream. The stream is not closed
@throws IOException on error
Escapes a string with the appropriated XML codes.
@param s the string to be escaped
@param onlyASCII codes above 127 will always be escaped with &#nn; if true
@return the escaped string
An implementation of an XmpSchema.
Abstract superclass of the XmpSchemas supported by iText.
Summary description for Properties.
the namesspace
Constructs an XMP schema.
@param xmlns
The String representation of the contents.
@return a String representation.
Processes a property
@param buf
@param p
@param key
@param value
@return the previous property (null if there wasn't one)
@see java.util.Properties#setProperty(java.lang.String, java.lang.String)
@param key
@param value
@return the previous property (null if there wasn't one)
@param content
@return
@return Returns the xmlns.
default namespace identifier
default namespace uri
External Contributors to the resource (other than the authors).
The extent or scope of the resource.
The authors of the resource (listed in order of precedence, if significant).
Date(s) that something interesting happened to the resource.
A textual description of the content of the resource. Multiple values may be present for different languages.
The file format used when saving the resource. Tools and applications should set this property to the save format of the data. It may include appropriate qualifiers.
Unique identifier of the resource.
An unordered array specifying the languages used in the resource.
Publishers.
Relationships to other documents.
Informal rights statement, selected by language.
Unique identifier of the work from which this resource was derived.
An unordered array of descriptive phrases or keywords that specify the topic of the content of the resource.
The title of the document, or the name given to the resource. Typically, it will be a name by which the resource is formally known.
A document type; for example, novel, poem, or working paper.
@param shorthand
@throws IOException
Adds a title.
@param title
Adds a title.
@param title
Adds a description.
@param desc
Adds a description.
@param desc
Adds a subject.
@param subject
Adds a subject.
@param subject array of subjects
Adds a single author.
@param author
Adds an array of authors.
@param author
Adds a single publisher.
@param publisher
Adds an array of publishers.
@param publisher
A wrapper for an Encoding to suppress the preamble.
Key for the default language.
Creates a Properties object that stores languages for use in an XmpSchema
Creates a Properties object that stores languages for use in an XmpSchema
Add a language.
Process a property.
Creates a String that can be used in an XmpSchema.
An implementation of an XmpSchema.
default namespace identifier
default namespace uri
Keywords.
The PDF file version (for example: 1.0, 1.3, and so on).
The Producer.
@throws IOException
Adds keywords.
@param keywords
Adds the producer.
@param producer
Adds the version.
@param version
StringBuilder to construct an XMP array.
An array that is unordered.
An array that is ordered.
An array with alternatives.
the type of array.
Creates an XmpArray.
@param type the type of array: UNORDERED, ORDERED or ALTERNATIVE.
Returns the String representation of the XmpArray.
@return a String representation
An implementation of an XmpSchema.
default namespace identifier
default namespace uri
An unordered array specifying properties that were edited outside the authoring application. Each item should contain a single namespace and XPath separated by one ASCII space (U+0020).
The base URL for relative URLs in the document content. If this document contains Internet links, and those links are relative, they are relative to this base URL. This property provides a standard way for embedded relative URLs to be interpreted by tools. Web authoring tools should set the value based on their notion of where URLs will be interpreted.
The date and time the resource was originally created.
The name of the first known tool used to create the resource. If history is present in the metadata, this value should be equivalent to that of xmpMM:History�s softwareAgent property.
An unordered array of text strings that unambiguously identify the resource within a given context.
The date and time that any metadata for this resource was last changed.
The date and time the resource was last modified.
A short informal name for the resource.
An alternative array of thumbnail images for a file, which can differ in characteristics such as size or image encoding.
@param shorthand
@throws IOException
Adds the creatortool.
@param creator
Adds the creation date.
@param date
Adds the modification date.
@param date
Adds the meta data date.
@param date
Adds the identifier.
@param id
Adds the nickname.
@param name
An implementation of an XmpSchema.
default namespace identifier
default namespace uri
A reference to the original document from which this one is derived. It is a minimal reference; missing components can be assumed to be unchanged. For example, a new version might only need to specify the instance ID and version number of the previous version, or a rendition might only need to specify the instance ID and rendition class of the original.
The common identifier for all versions and renditions of a document.
An ordered array of high-level user actions that resulted in this resource. It is intended to give human readers a general indication of the steps taken to make the changes from the previous version to this one. The list should be at an abstract level; it is not intended to be an exhaustive keystroke or other detailed history.
A reference to the document as it was prior to becoming managed. It is set when a managed document is introduced to an asset management system that does not currently own it. It may or may not include references to different management systems.
The name of the asset management system that manages this resource.
A URI identifying the managed resource to the asset management system; the presence of this property is the formal indication that this resource is managed. The form and content of this URI is private to the asset management system.
A URI that can be used to access information about the managed resource through a web browser. It might require a custom browser plugin.
Specifies a particular variant of the asset management system. The format of this property is private to the specific asset management system.
The rendition class name for this resource.
Can be used to provide additional rendition parameters that are too complex or verbose to encode in xmpMM: RenditionClass.
The document version identifier for this resource.
The version history associated with this resource.
@throws IOException
Reads an XMP stream into an org.w3c.dom.Document objects.
Allows you to replace the contents of a specific tag.
@since 2.1.3
String used to fill the extra space.
Processing Instruction required at the start of an XMP stream
@since iText 2.1.6
Processing Instruction required at the end of an XMP stream for XMP streams that can be updated
@since iText 2.1.6
Constructs an XMP reader
@param bytes the XMP content
@throws ExceptionConverter
@throws IOException
@throws SAXException
Replaces the content of a tag.
@param namespaceURI the URI of the namespace
@param localName the tag name
@param value the new content for the tag
@return true if the content was successfully replaced
@since 2.1.6 the return type has changed from void to boolean
Replaces the content of an attribute in the description tag.
@param namespaceURI the URI of the namespace
@param localName the tag name
@param value the new content for the tag
@return true if the content was successfully replaced
@since 5.0.0 the return type has changed from void to boolean
Adds a tag.
@param namespaceURI the URI of the namespace
@param parent the tag name of the parent
@param localName the name of the tag to add
@param value the new content for the tag
@return true if the content was successfully added
@since 2.1.6
Sets the text of this node. All the child's node are deleted and a new
child text node is created.
@param domDocument the Document
that contains the node
@param n the Node
to add the text to
@param value the text to add
Writes the document to a byte array.
With this class you can create an Xmp Stream that can be used for adding
Metadata to a PDF Dictionary. Remark that this class doesn't cover the
complete XMP specification.
A possible charset for the XMP.
A possible charset for the XMP.
A possible charset for the XMP.
A possible charset for the XMP.
Creates an XmpWriter.
@param os
@param utfEncoding
@param extraSpace
@throws IOException
Creates an XmpWriter.
@param os
@throws IOException
@param os
@param info
@throws IOException
@param os
@param info
@throws IOException
@since 5.0.1 (generic type in signature)
Adds an rdf:Description.
@param xmlns
@param content
@throws IOException
Adds an rdf:Description.
@param s
@throws IOException
@param schemaNS The namespace URI for the property. Has the same usage as in getProperty.
@param propName The name of the property.
Has the same usage as in getProperty()
.
@param value the value for the property (only leaf properties have a value).
Arrays and non-leaf levels of structs do not have values.
Must be null
if the value is not relevant.
The value is automatically detected: Boolean, Integer, Long, Double, XMPDateTime and
byte[] are handled, on all other toString()
is called.
@throws XMPException Wraps all errors and exceptions that may occur.
Simplifies the construction of an array by not requiring that you pre-create an empty array.
The array that is assigned is created automatically if it does not yet exist. Each call to
AppendArrayItem() appends an item to the array.
@param schemaNS The namespace URI for the array.
@param arrayName The name of the array. May be a general path expression, must not be null or
the empty string.
@param value the value of the array item.
@throws XMPException Wraps all errors and exceptions that may occur.
Simplifies the construction of an ordered array by not requiring that you pre-create an empty array.
The array that is assigned is created automatically if it does not yet exist. Each call to
AppendArrayItem() appends an item to the array.
@param schemaNS The namespace URI for the array.
@param arrayName The name of the array. May be a general path expression, must not be null or
the empty string.
@param value the value of the array item.
@throws XMPException Wraps all errors and exceptions that may occur.
Simplifies the construction of an alternate array by not requiring that you pre-create an empty array.
The array that is assigned is created automatically if it does not yet exist. Each call to
AppendArrayItem() appends an item to the array.
@param schemaNS The namespace URI for the array.
@param arrayName The name of the array. May be a general path expression, must not be null or
the empty string.
@param value the value of the array item.
@throws XMPException Wraps all errors and exceptions that may occur.
Flushes and closes the XmpWriter.
@throws IOException
Flushes and closes the XmpWriter.
@throws IOException
Sets the XMP to read-only
@param about The about to set.
External Contributors to the resource (other than the authors).
The extent or scope of the resource.
The authors of the resource (listed in order of precedence, if significant).
Date(s) that something interesting happened to the resource.
A textual description of the content of the resource. Multiple values may be present for different languages.
The file format used when saving the resource. Tools and applications should set this property to the save format of the data. It may include appropriate qualifiers.
Unique identifier of the resource.
An unordered array specifying the languages used in the resource.
Publishers.
Relationships to other documents.
Informal rights statement, selected by language.
Unique identifier of the work from which this resource was derived.
An unordered array of descriptive phrases or keywords that specify the topic of the content of the resource.
The title of the document, or the name given to the resource. Typically, it will be a name by which the resource is formally known.
A document type; for example, novel, poem, or working paper.
Adds a title.
@param xmpMeta
@param title
Sets a title.
@param xmpMeta
@param title
@param genericLang The name of the generic language
@param specificLang The name of the specific language
Adds a description.
@param xmpMeta
@param desc
Sets a description.
@param xmpMeta
@param desc
@param genericLang The name of the generic language
@param specificLang The name of the specific language
Adds a subject.
@param xmpMeta
@param subject
Sets a subject.
@param xmpMeta
@param subject array of subjects
Adds a single author.
@param xmpMeta
@param author
Sets an array of authors.
@param xmpMeta
@param author
Adds a single publisher.
@param xmpMeta
@param publisher
Sets an array of publishers.
@param xmpMeta
@param publisher
Keywords.
The PDF file version (for example: 1.0, 1.3, and so on).
The Producer.
Adds keywords.
@param xmpMeta
@param keywords
Adds the producer.
@param xmpMeta
@param producer
Adds the version.
@param xmpMeta
@param version
An unordered array specifying properties that were edited outside the authoring application. Each item should contain a single namespace and XPath separated by one ASCII space (U+0020).
The base URL for relative URLs in the document content. If this document contains Internet links, and those links are relative, they are relative to this base URL. This property provides a standard way for embedded relative URLs to be interpreted by tools. Web authoring tools should set the value based on their notion of where URLs will be interpreted.
The date and time the resource was originally created.
The name of the first known tool used to create the resource. If history is present in the metadata, this value should be equivalent to that of xmpMM:History's softwareAgent property.
An unordered array of text strings that unambiguously identify the resource within a given context.
The date and time that any metadata for this resource was last changed.
The date and time the resource was last modified.
A short informal name for the resource.
An alternative array of thumbnail images for a file, which can differ in characteristics such as size or image encoding.
Adds the creatortool.
@param xmpMeta
@param creator
Adds the creation date.
@param xmpMeta
@param date
Adds the modification date.
@param xmpMeta
@param date
Adds the meta data date.
@param xmpMeta
@param date
Sets the identifier.
@param xmpMeta
@param id
Adds the nickname.
@param xmpMeta
@param name
A reference to the original document from which this one is derived. It is a minimal reference; missing components can be assumed to be unchanged. For example, a new version might only need to specify the instance ID and version number of the previous version, or a rendition might only need to specify the instance ID and rendition class of the original.
The common identifier for all versions and renditions of a document.
An ordered array of high-level user actions that resulted in this resource. It is intended to give human readers a general indication of the steps taken to make the changes from the previous version to this one. The list should be at an abstract level; it is not intended to be an exhaustive keystroke or other detailed history.
A reference to the document as it was prior to becoming managed. It is set when a managed document is introduced to an asset management system that does not currently own it. It may or may not include references to different management systems.
The name of the asset management system that manages this resource.
A URI identifying the managed resource to the asset management system; the presence of this property is the formal indication that this resource is managed. The form and content of this URI is private to the asset management system.
A URI that can be used to access information about the managed resource through a web browser. It might require a custom browser plugin.
Specifies a particular variant of the asset management system. The format of this property is private to the specific asset management system.
The rendition class name for this resource.
Can be used to provide additional rendition parameters that are too complex or verbose to encode in xmpMM: RenditionClass.
The document version identifier for this resource.
The version history associated with this resource.
A special-version of LIST
whitch use zapfdingbats-letters.
@see com.lowagie.text.List
@author Michael Niedermair and Bruno Lowagie
char-number in zapfdingbats
Creates a ZapfDingbatsList
@param zn a char-number
Creates a ZapfDingbatsList
@param zn a char-number
@param symbolIndent indent
Sets the dingbat's color.
@param zapfDingbatColor color for the ZapfDingbat
Adds an Object
to the List
.
@param o the object to add.
@return true if adding the object succeeded
set the char-number
@param zn a char-number
A special-version of LIST
whitch use zapfdingbats-numbers (1..10).
@see com.lowagie.text.List
@version 2003-06-22
@author Michael Niedermair
which type
Creates a ZapdDingbatsNumberList
@param type the type of list
@param symbolIndent indent
Creates a ZapdDingbatsNumberList
@param type the type of list
@param symbolIndent indent
Adds an Object
to the List
.
@param o the object to add.
@return true if adding the object succeeded
get the type
@return char-number
A utility class to perform base64 encoding and decoding as specified
in RFC-1521. See also RFC 1421.
@version $Revision: 1.4 $
marker for invalid bytes
marker for accepted whitespace bytes
marker for an equal symbol
Encode the given byte[].
the source string.
the base64-encoded data.
Encode the given byte[].
the source string.
a linefeed is added after linefeed
characters;
must be dividable by four; 0 means no linefeeds
the base64-encoded data.
Encode the given string.
the source string.
the base64-encoded string.
Decode the given byte[].
the base64-encoded data.
the decoded data.
Decode the given string.
the base64-encoded string.
the decoded string.
Byte buffer container including length of valid data.
@since 11.10.2006
the initial capacity for this buffer
a byte array that will be wrapped with ByteBuffer
.
a byte array that will be wrapped with ByteBuffer
.
the length of valid bytes in the array
Loads the stream into a buffer.
an InputStream
If the stream cannot be read.
a byte array that will be wrapped with ByteBuffer
.
the offset of the provided buffer.
the length of valid bytes in the array
the index to retrieve the byte from
Returns a byte from the buffer
the index to retrieve a byte as int or char.
Returns a byte from the buffer
Appends a byte to the buffer.
a byte
Appends a byte array or part of to the buffer.
a byte array
an offset with
Append a byte array to the buffer
a byte array
Append another buffer to this buffer.
another ByteBuffer
Ensures the requested capacity by increasing the buffer size when the
current length is exceeded.
requested new buffer length
Returns a byte stream that is limited to the valid amount of bytes.
Returns the length, that means the number of valid bytes, of the buffer;
the inner byte array might be bigger than that.
Detects the encoding of the byte buffer, stores and returns it.
Only UTF-8, UTF-16LE/BE and UTF-32LE/BE are recognized.
Note: UTF-32 flavors are not supported by Java, the XML-parser will complain.
Returns the encoding string.
An OutputStream
that counts the written bytes.
@since 08.11.2006
the decorated output stream
the byte counter
Constructor with providing the output stream to decorate.
an OutputStream
the bytesWritten
Abstract class for reading filtered character streams.
The abstract class FilterReader
itself
provides default methods that pass all requests to
the contained stream. Subclasses of FilterReader
should override some of these methods and may also provide
additional methods and fields.
@author Mark Reinhold
@since JDK1.1
Reads a single character.
@exception IOException If an I/O error occurs
Reads characters into a portion of an array.
@exception IOException If an I/O error occurs
**
@since 22.08.2006
A character-stream reader that allows characters to be pushed back into the
stream.
@author Mark Reinhold
@since JDK1.1
Pushback buffer
Current position in buffer
Creates a new pushback reader with a one-character pushback buffer.
The reader from which characters will be read
Checks to make sure that the stream has not been closed.
Reads a single character.
The character read, or -1 if the end of the stream has been
reached
If an I/O error occurs
Reads characters into a portion of an array.
Destination buffer
Offset at which to start writing characters
Maximum number of characters to read
The number of characters read, or -1 if the end of the
stream has been reached
If an I/O error occurs
Pushes back a single character by copying it to the front of the
pushback buffer. After this method returns, the next character to be read
will have the value (char)c
.
The int value representing a character to be pushed back
If the pushback buffer is full,
or if some other I/O error occurs
Pushes back a portion of an array of characters by copying it to the
front of the pushback buffer. After this method returns, the next
character to be read will have the value cbuf[off]
, the
character after that will have the value cbuf[off+1]
, and
so forth.
Character array
Offset of first character to push back
Number of characters to push back
If there is insufficient room in the pushback
buffer, or if some other I/O error occurs
Pushes back an array of characters by copying it to the front of the
pushback buffer. After this method returns, the next character to be
read will have the value cbuf[0]
, the character after that
will have the value cbuf[1]
, and so forth.
Character array to push back
If there is insufficient room in the pushback
buffer, or if some other I/O error occurs
Closes the stream and releases any system resources associated with
it. Once the stream has been closed, further read(),
unread(), ready(), or skip() invocations will throw an IOException.
Closing a previously closed stream has no effect.
If an I/O error occurs
the result of the escaping sequence
count the digits of the sequence
the state of the automaton
Processes numeric escaped chars to find out if they are a control character.
a char
Returns the char directly or as replacement for the escaped sequence.
Converts between ISO 8601 Strings and Calendar
with millisecond resolution.
@since 16.02.2006
a date string that is ISO 8601 conform.
an existing XMPDateTime to set with the parsed date
Returns an XMPDateTime-object containing the ISO8601-date.
Is thrown when the string is non-conform.
@since 22.08.2006
initializes the parser container
Returns the length of the input.
Returns whether there are more chars to come.
index of char
Returns char at a certain index.
Returns the current char or 0x0000 if there are no more chars.
Skips the next char.
Returns the current position.
Parses a integer from the source and sets the pointer after it.
Error message to put in the exception if no number can be found
the max value of the number to return
Returns the parsed integer.
Thrown if no integer can be found.
@since 12.10.2006
Private constructor
Converts a Cp1252 char (contains all Latin-1 chars above 0x80) into a
UTF-8 byte sequence. The bytes 0x81, 0x8D, 0x8F, 0x90, and 0x9D are
formally undefined by Windows 1252 and therefore replaced by a space
(0x20).
an Cp1252 / Latin-1 byte
Returns a byte array containing a UTF-8 byte sequence.
@since 11.08.2006
Common constants for the XMP Toolkit.
@since 20.01.2006
The XML namespace for XML.
The XML namespace for RDF.
The XML namespace for the Dublin Core schema.
The XML namespace for the IPTC Core schema.
The XML namespace for the IPTC Extension schema.
The XML namespace for the DICOM medical schema.
The XML namespace for the PLUS (Picture Licensing Universal System, http://www.useplus.org)
The XML namespace Adobe XMP Metadata.
The XML namespace for the XMP "basic" schema.
The XML namespace for the XMP copyright schema.
The XML namespace for the XMP digital asset management schema.
The XML namespace for the job management schema.
The XML namespace for the job management schema.
The XML namespace for the PDF schema.
The XML namespace for the PDF schema.
The XML namespace for the Photoshop custom schema.
The XML namespace for the Photoshop Album schema.
The XML namespace for Adobe's EXIF schema.
NS for the CIPA XMP for Exif document v1.1
The XML namespace for Adobe's TIFF schema.
BExt Schema
RIFF Info Schema
Transform XMP
Adobe Flash SWF
legacy Dublin Core NS, will be converted to NS_DC
The XML namespace for qualifiers of the xmp:Identifier property.
The XML namespace for fields of the Dimensions type.
The XML namespace for fields of a graphical image. Used for the Thumbnail type.
The XML namespace for fields of the ResourceEvent type.
The XML namespace for fields of the ResourceRef type.
The XML namespace for fields of the Version type.
The XML namespace for fields of the JobRef type.
The canonical true string value for Booleans in serialized XMP. Code that converts from the
string to a bool should be case insensitive, and even allow "1".
The canonical false string value for Booleans in serialized XMP. Code that converts from the
string to a bool should be case insensitive, and even allow "0".
Index that has the meaning to be always the last item in an array.
Node name of an array item.
The x-default string for localized properties
xml:lang qualfifier
rdf:type qualfifier
Processing Instruction (PI) for xmp packet
XMP meta tag version new
XMP meta tag version old
private constructor
Asserts that an array name is set.
an array name
Array name is null or empty
Asserts that a property name is set.
a property name or path
Property name is null or empty
Asserts that a schema namespace is set.
a schema namespace
Schema is null or empty
Asserts that a prefix is set.
a prefix
Prefix is null or empty
Asserts that a specific language is set.
a specific lang
Specific language is null or empty
Asserts that a struct name is set.
a struct name
Struct name is null or empty
Asserts that any string parameter is set.
any string parameter
Thrown if the parameter is null or has length 0.
Asserts that the xmp object is of this implemention
().
the XMP object
A wrong implentaion is used.
Parser for "normal" XML serialisation of RDF.
@since 14.07.2006
Start of coreSyntaxTerms.
End of coreSyntaxTerms
Start of additions for syntax Terms.
End of of additions for syntaxTerms.
Start of oldTerms.
End of oldTerms.
! Yes, the syntax terms include the core terms.
this prefix is used for default namespaces
The main parsing method. The XML tree is walked through from the root node and and XMP tree
is created. This is a raw parse, the normalisation of the XMP tree happens outside.
the XML root node
Returns an XMP metadata object (not normalized)
Occurs if the parsing fails for any reason.
Each of these parsing methods is responsible for recognizing an RDF
syntax production and adding the appropriate structure to the XMP tree.
They simply return for success, failures will throw an exception.
the xmp metadata object that is generated
the top-level xml node
thown on parsing errors
7.2.5 nodeElementURIs
anyURI - ( coreSyntaxTerms | rdf:li | oldTerms )
7.2.11 nodeElement
start-element ( URI == nodeElementURIs,
attributes == set ( ( idAttr | nodeIdAttr | aboutAttr )?, propertyAttr* ) )
propertyEltList
end-element()
A node element URI is rdf:Description or anything else that is not an RDF
term.
the xmp metadata object that is generated
the parent xmp node
the currently processed XML node
Flag if the node is a top-level node
thown on parsing errors
7.2.7 propertyAttributeURIs
anyURI - ( coreSyntaxTerms | rdf:Description | rdf:li | oldTerms )
7.2.11 nodeElement
start-element ( URI == nodeElementURIs,
attributes == set ( ( idAttr | nodeIdAttr | aboutAttr )?, propertyAttr* ) )
propertyEltList
end-element()
Process the attribute list for an RDF node element. A property attribute URI is
anything other than an RDF term. The rdf:ID and rdf:nodeID attributes are simply ignored,
as are rdf:about attributes on inner nodes.
the xmp metadata object that is generated
the parent xmp node
the currently processed XML node
Flag if the node is a top-level node
thown on parsing errors
7.2.13 propertyEltList
ws* ( propertyElt ws* )*
the xmp metadata object that is generated
the parent xmp node
the currently processed XML node
Flag if the node is a top-level node
thown on parsing errors
7.2.14 propertyElt
resourcePropertyElt | literalPropertyElt | parseTypeLiteralPropertyElt |
parseTypeResourcePropertyElt | parseTypeCollectionPropertyElt |
parseTypeOtherPropertyElt | emptyPropertyElt
7.2.15 resourcePropertyElt
start-element ( URI == propertyElementURIs, attributes == set ( idAttr? ) )
ws* nodeElement ws*
end-element()
7.2.16 literalPropertyElt
start-element (
URI == propertyElementURIs, attributes == set ( idAttr?, datatypeAttr?) )
text()
end-element()
7.2.17 parseTypeLiteralPropertyElt
start-element (
URI == propertyElementURIs, attributes == set ( idAttr?, parseLiteral ) )
literal
end-element()
7.2.18 parseTypeResourcePropertyElt
start-element (
URI == propertyElementURIs, attributes == set ( idAttr?, parseResource ) )
propertyEltList
end-element()
7.2.19 parseTypeCollectionPropertyElt
start-element (
URI == propertyElementURIs, attributes == set ( idAttr?, parseCollection ) )
nodeElementList
end-element()
7.2.20 parseTypeOtherPropertyElt
start-element ( URI == propertyElementURIs, attributes == set ( idAttr?, parseOther ) )
propertyEltList
end-element()
7.2.21 emptyPropertyElt
start-element ( URI == propertyElementURIs,
attributes == set ( idAttr?, ( resourceAttr | nodeIdAttr )?, propertyAttr* ) )
end-element()
The various property element forms are not distinguished by the XML element name,
but by their attributes for the most part. The exceptions are resourcePropertyElt and
literalPropertyElt. They are distinguished by their XML element content.
NOTE: The RDF syntax does not explicitly include the xml:lang attribute although it can
appear in many of these. We have to allow for it in the attibute counts below.
the xmp metadata object that is generated
the parent xmp node
the currently processed XML node
Flag if the node is a top-level node
thown on parsing errors
7.2.15 resourcePropertyElt
start-element ( URI == propertyElementURIs, attributes == set ( idAttr? ) )
ws* nodeElement ws*
end-element()
This handles structs using an rdf:Description node,
arrays using rdf:Bag/Seq/Alt, and typedNodes. It also catches and cleans up qualified
properties written with rdf:Description and rdf:value.
the xmp metadata object that is generated
the parent xmp node
the currently processed XML node
Flag if the node is a top-level node
thown on parsing errors
7.2.16 literalPropertyElt
start-element ( URI == propertyElementURIs,
attributes == set ( idAttr?, datatypeAttr?) )
text()
end-element()
Add a leaf node with the text value and qualifiers for the attributes.
the xmp metadata object that is generated
the parent xmp node
the currently processed XML node
Flag if the node is a top-level node
thown on parsing errors
7.2.17 parseTypeLiteralPropertyElt
start-element ( URI == propertyElementURIs,
attributes == set ( idAttr?, parseLiteral ) )
literal
end-element()
thown on parsing errors
7.2.18 parseTypeResourcePropertyElt
start-element ( URI == propertyElementURIs,
attributes == set ( idAttr?, parseResource ) )
propertyEltList
end-element()
Add a new struct node with a qualifier for the possible rdf:ID attribute.
Then process the XML child nodes to get the struct fields.
the xmp metadata object that is generated
the parent xmp node
the currently processed XML node
Flag if the node is a top-level node
thown on parsing errors
7.2.19 parseTypeCollectionPropertyElt
start-element ( URI == propertyElementURIs,
attributes == set ( idAttr?, parseCollection ) )
nodeElementList
end-element()
thown on parsing errors
7.2.20 parseTypeOtherPropertyElt
start-element ( URI == propertyElementURIs, attributes == set ( idAttr?, parseOther ) )
propertyEltList
end-element()
thown on parsing errors
Adds a child node.
the xmp metadata object that is generated
the parent xmp node
the currently processed XML node
Node value
Flag if the node is a top-level node
Returns the newly created child node.
thown on parsing errors
Adds a qualifier node.
the parent xmp node
the name of the qualifier which has to be
QName including the default prefix
the value of the qualifier
Returns the newly created child node.
thown on parsing errors
The parent is an RDF pseudo-struct containing an rdf:value field. Fix the
XMP data model. The rdf:value node must be the first child, the other
children are qualifiers. The form, value, and children of the rdf:value
node are the real ones. The rdf:value node's qualifiers must be added to
the others.
the parent xmp node
thown on parsing errors
Checks if the node is a white space.
an XML-node
Returns whether the node is a whitespace node,
i.e. a text node that contains only whitespaces.
7.2.6 propertyElementURIs
anyURI - ( coreSyntaxTerms | rdf:Description | oldTerms )
the term id
Return true if the term is a property element name.
Determines the ID for a certain RDF Term.
Arranged to hopefully minimize the parse time for large XMP.
an XML node
Returns the term ID.
@since 09.11.2006
XML localname
XML namespace prefix
Splits a qname into prefix and localname.
a QName
Constructor that initializes the fields
the prefix
the name
Returns whether the QName has a prefix.
the localName
the prefix
Utility functions for the XMPToolkit implementation.
@since 06.06.2006
segments of a UUID
length of a UUID
init char tables
Private constructor
a schema namespace
an XMP Property
Returns true if the property is defined as "Internal
Property", see XMP Specification.
Check some requirements for an UUID:
- Length of the UUID is 32
- The Delimiter count is 4 and all the 4 delimiter are on their right
position (8,13,18,23)
uuid to test
true - this is a well formed UUID, false - UUID has not the expected format
Checks if the value is a legal "unqualified" XML name, as
defined in the XML Namespaces proposed recommendation.
These are XML names, except that they must not contain a colon.
the value to check
Returns true if the name is a valid "unqualified" XML name.
a char
Returns true if the char is an ASCII control char.
Replaces the ASCII control chars with a space.
a node value
Returns the cleaned up value
Simple check if a character is a valid XML start name char.
All characters according to the XML Spec 1.1 are accepted:
http://www.w3.org/TR/xml11/#NT-NameStartChar
a character
Returns true if the character is a valid first char of an XML name.
Simple check if a character is a valid XML name char
(every char except the first one), according to the XML Spec 1.1:
http://www.w3.org/TR/xml11/#NT-NameChar
a character
Returns true if the character is a valid char of an XML name.
Initializes the char tables for the chars 0x00-0xFF for later use,
according to the XML 1.1 specification
http://www.w3.org/TR/xml11
The implementation of XMPDateTime
. Internally a calendar
is used
plus an additional nano seconds field, because Calendar
supports only milli
seconds. The nanoSeconds
convers only the resolution beyond a milli second.
@since 16.02.2006
This flag is set either by parsing or by setting year, month or day.
Returns true if the XMPDateTime object has a date portion.
This flag is set either by parsing or by setting hours, minutes, seconds or milliseconds.
Returns true if the XMPDateTime object has a time portion.
This flag is set either by parsing or by setting hours, minutes, seconds or milliseconds.
Returns true if the XMPDateTime object has a defined timezone.
Returns the year, can be negative.
Returns The month in the range 1..12.
Returns the day of the month in the range 1..31.
Returns hour - The hour in the range 0..23.
Returns the minute in the range 0..59.
Returns the second in the range 0..59.
Returns milli-, micro- and nano seconds.
Nanoseconds within a second, often left as zero?
Returns the time zone.
Returns the ISO 8601 string representation of the date and time.
The nano seconds take micro and nano seconds, while the milli seconds are in the calendar.
Use NO time zone as default
Creates an XMPDateTime
-instance with the current time in the default time
zone.
Creates an XMPDateTime
-instance from a calendar.
a Calendar
Creates an XMPDateTime
-instance from
a Date
and a TimeZone
.
a date describing an absolute point in time
a TimeZone how to interpret the date
Creates an XMPDateTime
-instance from an ISO 8601 string.
an ISO 8601 string
If the string is a non-conform ISO 8601 string, an exception is thrown
Returns the ISO string representation.
The XMPIterator
implementation.
Iterates the XMP Tree according to a set of options.
During the iteration the XMPMeta-object must not be changed.
Calls to skipSubtree()
/ skipSiblings()
will affect the iteration.
@since 29.06.2006
Skip the subtree below the current node when next()
is
called.
Skip the subtree below and remaining siblings of the current node when
next()
is called.
the node iterator doing the work
stores the iterator options
the base namespace of the property path, will be changed during the iteration
flag to indicate that skipSiblings() has been called.
flag to indicate that skipSiblings() has been called.
Constructor with optionsl initial values. If propName
is provided,
schemaNs
has also be provided.
the iterated metadata object.
the iteration is reduced to this schema (optional)
the iteration is redurce to this property within the schemaNs
advanced iteration options, see
If the node defined by the paramters is not existing.
Exposes the options for inner class.
Exposes the options for inner class.
The XMPIterator
implementation.
It first returns the node itself, then recursivly the children and qualifier of the node.
@since 29.06.2006
iteration state
iteration state
iteration state
the recursively accumulated path
the currently visited node
the iterator that goes through the children and qualifier list
index of node with parent, only interesting for arrays
the cached PropertyInfo
to return
the state of the iteration
the iterator for each child
Constructor for the node iterator.
the currently visited node
the accumulated path of the node
the index within the parent node (only for arrays)
Sets the returnProperty as next item or recurses into hasNext()
.
Returns if there is a next item to return.
Handles the iteration of the children or qualfier
an iterator
Returns if there are more elements available.
the node that will be added to the path.
the path up to this node.
the current array index if an arrey is traversed
Returns the updated path.
Creates a property info object from an XMPNode
.
an XMPNode
the base namespace to report
the full property path
Returns a XMPProperty
-object that serves representation of the node.
the childrenIterator
Returns the returnProperty.
This interface is used to return a property together with its path and namespace.
It is returned when properties are iterated with the XMPIterator
.
@since 06.07.2006
This interface is used to return a text property together with its and options.
@since 23.01.2006
Returns the value of the property.
Returns the options of the property.
Only set by .
Returns the language of the alt-text item.
Returns the namespace of the property
Returns the path of the property, but only if returned by the iterator.
This iterator is derived from the default NodeIterator
,
and is only used for the option .
@since 02.10.2006
Constructor
the node which children shall be iterated.
the full path of the former node without the leaf node.
Implementation for .
@since 17.02.2006
This class represents the set of XMP metadata as a DOM representation. It has methods to read and
modify all kinds of properties, create an iterator over all properties and Serialize the metadata
to a String, byte-array or OutputStream
.
@since 20.01.2006
Provides access to items within an array. The index is passed as an integer, you need not
worry about the path string syntax for array items, convert a loop index to a string, etc.
The namespace URI for the array. Has the same usage as in GetProperty.
The name of the array. May be a general path expression, must not be
null
or the empty string. Has the same namespace prefix usage as
propName in GetProperty()
.
The index of the desired item. Arrays in XMP are indexed from 1. The
constant always refers to the last existing array
item.
Returns a XMPProperty
containing the value and the options or
null
if the property does not exist.
Wraps all errors and exceptions that may occur.
Returns the number of items in the array.
The namespace URI for the array. Has the same usage as in GetProperty.
The name of the array. May be a general path expression, must not be
null
or the empty string. Has the same namespace prefix usage as
propName in GetProperty()
.
Returns the number of items in the array.
Wraps all errors and exceptions that may occur.
Replaces an item within an array. The index is passed as an integer, you need not worry about
the path string syntax for array items, convert a loop index to a string, etc. The array
passed must already exist. In normal usage the selected array item is modified. A new item is
automatically appended if the index is the array size plus 1.
The namespace URI for the array. Has the same usage as in GetProperty.
The name of the array. May be a general path expression, must not be
null
or the empty string. Has the same namespace prefix usage as
propName in GetProperty.
The index of the desired item. Arrays in XMP are indexed from 1. To address
the last existing item, use to find
out the length of the array.
the new value of the array item. Has the same usage as propValue in
SetProperty()
.
the set options for the item.
Wraps all errors and exceptions that may occur.
Inserts an item into an array previous to the given index. The index is passed as an integer,
you need not worry about the path string syntax for array items, convert a loop index to a
string, etc. The array passed must already exist. In normal usage the selected array item is
modified. A new item is automatically appended if the index is the array size plus 1.
The namespace URI for the array. Has the same usage as in GetProperty.
The name of the array. May be a general path expression, must not be
null
or the empty string. Has the same namespace prefix usage as
propName in GetProperty.
The index to insert the new item. Arrays in XMP are indexed from 1. Use
XmpConst.ARRAY_LAST_ITEM
to append items.
the new value of the array item. Has the same usage as
propValue in SetProperty()
.
the set options that decide about the kind of the node.
Wraps all errors and exceptions that may occur.
Provides access to fields within a nested structure. The namespace for the field is passed as
a URI, you need not worry about the path string syntax. The names of fields should be XML
qualified names, that is within an XML namespace. The path syntax for a qualified name uses
the namespace prefix, which is unreliable because the prefix is never guaranteed. The URI is
the formal name, the prefix is just a local shorthand in a given sequence of XML text.
The namespace URI for the struct. Has the same usage as in GetProperty.
The name of the struct. May be a general path expression, must not be null
or the empty string. Has the same namespace prefix usage as propName in GetProperty.
The namespace URI for the field. Has the same URI and prefix usage as the
schemaNs parameter.
The name of the field. Must be a single XML name, must not be null or the
empty string. Has the same namespace prefix usage as the structName parameter.
the value of thefield, if the field has a value.
Has the same usage as propValue in GetProperty.
Option flags describing the field. See the earlier description.
Wraps all errors and exceptions that may occur.
Provides access to a qualifier attached to a property. The namespace for the qualifier is
passed as a URI, you need not worry about the path string syntax. In many regards qualifiers
are like struct fields. See the introductory discussion of qualified properties for more
information. The names of qualifiers should be XML qualified names, that is within an XML
namespace. The path syntax for a qualified name uses the namespace prefix, which is
unreliable because the prefix is never guaranteed. The URI is the formal name, the prefix is
just a local shorthand in a given sequence of XML text. The property the qualifier
will be attached has to exist.
The namespace URI for the struct. Has the same usage as in GetProperty.
The name of the property to which the qualifier is attached. Has the same
usage as in GetProperty.
The namespace URI for the qualifier. Has the same URI and prefix usage as the
schemaNs parameter.
The name of the qualifier. Must be a single XML name, must not be
null
or the empty string. Has the same namespace prefix usage as the
propName parameter.
A pointer to the null
terminated UTF-8 string that is the
value of the qualifier, if the qualifier has a value. Has the same usage as propValue
in GetProperty.
Option flags describing the qualifier. See the earlier description.
Wraps all errors and exceptions that may occur.
Deletes the given XMP subtree rooted at the given property. It is not an error if the
property does not exist.
The namespace URI for the property. Has the same usage as in
GetProperty()
.
The name of the property. Has the same usage as in GetProperty.
Deletes the given XMP subtree rooted at the given array item. It is not an error if the array
item does not exist.
The namespace URI for the array. Has the same usage as in GetProperty.
The name of the array. May be a general path expression, must not be
null
or the empty string. Has the same namespace prefix usage as
propName in GetProperty()
.
The index of the desired item. Arrays in XMP are indexed from 1. The
constant XmpConst.ARRAY_LAST_ITEM
always refers to the last
existing array item.
Deletes the given XMP subtree rooted at the given struct field. It is not an error if the
field does not exist.
The namespace URI for the struct. Has the same usage as in
GetProperty()
.
The name of the struct. May be a general path expression, must not be
null
or the empty string. Has the same namespace prefix usage as
propName in GetProperty.
The namespace URI for the field. Has the same URI and prefix usage as the
schemaNs parameter.
The name of the field. Must be a single XML name, must not be
null
or the empty string. Has the same namespace prefix usage as the
structName parameter.
Deletes the given XMP subtree rooted at the given qualifier. It is not an error if the
qualifier does not exist.
The namespace URI for the struct. Has the same usage as in
GetProperty()
.
The name of the property to which the qualifier is attached. Has the same
usage as in GetProperty.
The namespace URI for the qualifier. Has the same URI and prefix usage as the
schemaNs parameter.
The name of the qualifier. Must be a single XML name, must not be
null
or the empty string. Has the same namespace prefix usage as the
propName parameter.
Returns whether the property exists.
The namespace URI for the property. Has the same usage as in
GetProperty()
.
The name of the property.
Has the same usage as in GetProperty()
.
Returns true if the property exists.
Tells if the array item exists.
The namespace URI for the array. Has the same usage as in
GetProperty()
.
The name of the array. May be a general path expression, must not be
null
or the empty string. Has the same namespace prefix usage as
propName in GetProperty()
.
The index of the desired item. Arrays in XMP are indexed from 1. The
constant XmpConst.ARRAY_LAST_ITEM
always refers to the last
existing array item.
Returns true
if the array exists, false
otherwise.
DoesStructFieldExist tells if the struct field exists.
The namespace URI for the struct. Has the same usage as in
GetProperty()
.
The name of the struct. May be a general path expression, must not be
null
or the empty string. Has the same namespace prefix usage as
propName in GetProperty()
.
The namespace URI for the field. Has the same URI and prefix usage as the
schemaNs parameter.
The name of the field. Must be a single XML name, must not be
null
or the empty string. Has the same namespace prefix usage as the
structName parameter.
Returns true if the field exists.
DoesQualifierExist tells if the qualifier exists.
The namespace URI for the struct. Has the same usage as in
GetProperty()
.
The name of the property to which the qualifier is attached. Has the same
usage as in GetProperty()
.
The namespace URI for the qualifier. Has the same URI and prefix usage as the
schemaNs parameter.
The name of the qualifier. Must be a single XML name, must not be
null
or the empty string. Has the same namespace prefix usage as the
propName parameter.
Returns true if the qualifier exists.
Modifies the value of a selected item in an alt-text array. Creates an appropriate array item
if necessary, and handles special cases for the x-default item. If the selected item is from
a match with the specific language, the value of that item is modified. If the existing value
of that item matches the existing value of the x-default item, the x-default item is also
modified. If the array only has 1 existing item (which is not x-default), an x-default item
is added with the given value. If the selected item is from a match with the generic language
and there are no other generic matches, the value of that item is modified. If the existing
value of that item matches the existing value of the x-default item, the x-default item is
also modified. If the array only has 1 existing item (which is not x-default), an x-default
item is added with the given value. If the selected item is from a partial match with the
generic language and there are other partial matches, a new item is created for the specific
language. The x-default item is not modified. If the selected item is from the last 2 rules
then a new item is created for the specific language. If the array only had an x-default
item, the x-default item is also modified. If the array was empty, items are created for the
specific language and x-default.
Note: In a future version of this API a method
using Java java.lang.Locale
will be added.
The namespace URI for the alt-text array. Has the same usage as in
GetProperty()
.
The name of the alt-text array. May be a general path expression, must not
be null
or the empty string. Has the same namespace prefix usage as
propName in GetProperty()
.
The name of the generic language as an RFC 3066 primary subtag. May be
null
or the empty string if no generic language is wanted.
The name of the specific language as an RFC 3066 tag. Must not be
null
or the empty string.
A pointer to the null
terminated UTF-8 string that is the new
value for the appropriate array item.
Option flags, none are defined at present.
Wraps all errors and exceptions that may occur.
These are very similar to GetProperty()
and SetProperty()
above,
but the value is returned or provided in a literal form instead of as a UTF-8 string.
The path composition functions in XMPPathFactory
may be used to compose an path
expression for fields in nested structures, items in arrays, or qualifiers.
The namespace URI for the property. Has the same usage as in
GetProperty()
.
The name of the property.
Has the same usage as in GetProperty()
.
Returns a Boolean
value or null
if the property does not exist.
Wraps all exceptions that may occur,
especially conversion errors.
Convenience method to retrieve the literal value of a property.
The namespace URI for the property. Has the same usage as in
GetProperty()
.
The name of the property.
Has the same usage as in GetProperty()
.
Returns an Integer
value or null
if the property does not exist.
Wraps all exceptions that may occur,
especially conversion errors.
Convenience method to retrieve the literal value of a property.
The namespace URI for the property. Has the same usage as in
GetProperty()
.
The name of the property.
Has the same usage as in GetProperty()
.
Returns a Long
value or null
if the property does not exist.
Wraps all exceptions that may occur,
especially conversion errors.
Convenience method to retrieve the literal value of a property.
The namespace URI for the property. Has the same usage as in
GetProperty()
.
The name of the property.
Has the same usage as in GetProperty()
.
Returns a Double
value or null
if the property does not exist.
Wraps all exceptions that may occur,
especially conversion errors.
Convenience method to retrieve the literal value of a property.
The namespace URI for the property. Has the same usage as in
GetProperty()
.
The name of the property.
Has the same usage as in GetProperty()
.
Returns a XMPDateTime
-object or null
if the property does not exist.
Wraps all exceptions that may occur,
especially conversion errors.
Convenience method to retrieve the literal value of a property.
The namespace URI for the property. Has the same usage as in
GetProperty()
.
The name of the property.
Has the same usage as in GetProperty()
.
Returns a Java Calendar
-object or null
if the property does not exist.
Wraps all exceptions that may occur,
especially conversion errors.
Convenience method to retrieve the literal value of a property.
The namespace URI for the property. Has the same usage as in
GetProperty()
.
The name of the property.
Has the same usage as in GetProperty()
.
Returns a byte[]
-array contained the decoded base64 value
or null
if the property does not exist.
Wraps all exceptions that may occur,
especially conversion errors.
Convenience method to retrieve the literal value of a property.
Note: There is no SetPropertyString()
,
because SetProperty()
sets a string value.
The namespace URI for the property. Has the same usage as in
GetProperty()
.
The name of the property.
Has the same usage as in GetProperty()
.
Returns a String
value or null
if the property does not exist.
Wraps all exceptions that may occur,
especially conversion errors.
Convenience method to set a property to a literal boolean
value.
The namespace URI for the property. Has the same usage as in
SetProperty()
.
The name of the property.
Has the same usage as in GetProperty()
.
the literal property value as boolean
.
options of the property to set (optional).
Wraps all exceptions that may occur.
Convenience method to set a property to a literal int
value.
The namespace URI for the property. Has the same usage as in
SetProperty()
.
The name of the property.
Has the same usage as in GetProperty()
.
the literal property value as int
.
options of the property to set (optional).
Wraps all exceptions that may occur.
Convenience method to set a property to a literal long
value.
The namespace URI for the property. Has the same usage as in
SetProperty()
.
The name of the property.
Has the same usage as in GetProperty()
.
the literal property value as long
.
options of the property to set (optional).
Wraps all exceptions that may occur.
Convenience method to set a property to a literal double
value.
The namespace URI for the property. Has the same usage as in
SetProperty()
.
The name of the property.
Has the same usage as in GetProperty()
.
the literal property value as double
.
options of the property to set (optional).
Wraps all exceptions that may occur.
Convenience method to set a property with an XMPDateTime-object,
which is serialized to an ISO8601 date.
The namespace URI for the property. Has the same usage as in
SetProperty()
.
The name of the property.
Has the same usage as in GetProperty()
.
the property value as XMPDateTime
.
options of the property to set (optional).
Wraps all exceptions that may occur.
Convenience method to set a property with a Java Calendar-object,
which is serialized to an ISO8601 date.
The namespace URI for the property. Has the same usage as in
SetProperty()
.
The name of the property.
Has the same usage as in GetProperty()
.
the property value as Java Calendar
.
options of the property to set (optional).
Wraps all exceptions that may occur.
Convenience method to set a property from a binary byte[]
-array,
which is serialized as base64-string.
The namespace URI for the property. Has the same usage as in
SetProperty()
.
The name of the property.
Has the same usage as in GetProperty()
.
the literal property value as byte array.
options of the property to set (optional).
Wraps all exceptions that may occur.
Construct an iterator for the properties within an XMP object. According to the parameters it iterates the entire data tree,
properties within a specific schema, or a subtree rooted at a specific node.
Optional schema namespace URI to restrict the iteration. Omitted (visit all
schema) by passing null
or empty String.
Optional property name to restrict the iteration. May be an arbitrary path
expression. Omitted (visit all properties) by passing null
or empty
String. If no schema URI is given, it is ignored.
Option flags to control the iteration. See for
details.
Returns an XMPIterator
for this XMPMeta
-object
considering the given options.
Wraps all errors and exceptions that may occur.
Perform the normalization as a separate parsing step.
Normally it is done during parsing, unless the parsing option
is set to true
.
Note: It does no harm to call this method to an already normalized xmp object.
It was a PDF/A requirement to get hand on the unnormalized XMPMeta
object.
optional parsing options.
Wraps all errors and exceptions that may occur.
Renders this node and the tree unter this node in a human readable form.
Returns a multiline string containing the dump.
This correlates to the about-attribute,
returns the empty String if no name is set.
Returns the name of the XMP object.
Returns the unparsed content of the <?xpacket> processing instruction.
This contains normally the attribute-like elements 'begin="<BOM>"
id="W5M0MpCehiHzreSzNTczkc9d"' and possibly the deprecated elements 'bytes="1234"' or
'encoding="XXX"'. If the parsed packet has not been wrapped into an xpacket,
null
is returned.
Property values are Strings by default
root of the metadata tree
the xpacket processing instructions content
Constructor for an empty metadata object.
Constructor for a cloned metadata tree.
an prefilled metadata tree which fulfills all
XMPNode
contracts.
Locate or create the item node and set the value. Note the index
parameter is one-based! The index can be in the range [1..size + 1] or
"last()", normalize it and check the insert flags. The order of the
normalization checks is important. If the array is empty we end up with
an index and location to set item size + 1.
an array node
the index where to insert the item
the item value
the options for the new item
insert oder overwrite at index position?
The internals for SetProperty() and related calls, used after the node is
found or created.
the newly created node
the node value, can be null
options for the new node, must not be null
.
flag if the existing value is to be overwritten
thrown if options and value do not correspond
Evaluates a raw node value to the given value type, apply special
conversions for defined types in XMP.
an int indicating the value type
the node containing the value
Returns a literal value for the node.
Returns the root node of the XMP tree.
This class replaces the ExpatAdapter.cpp
and does the
XML-parsing and fixes the prefix. After the parsing several normalisations
are applied to the XMPTree.
@since 01.02.2006
Hidden constructor, initialises the SAX parser handler.
Parses the input source into an XMP metadata object, including
de-aliasing and normalisation.
the input can be an InputStream
, a String
or
a byte buffer containing the XMP packet.
the parse options
Returns the resulting XMP metadata object
Thrown if parsing or normalisation fails.
Parses XML from an ,
fixing the encoding (Latin-1 to UTF-8) and illegal control character optionally.
an InputStream
the parsing options
Returns an XML DOM-Document.
Thrown when the parsing fails.
Parses XML from a byte buffer,
fixing the encoding (Latin-1 to UTF-8) and illegal control character optionally.
a byte buffer containing the XMP packet
the parsing options
Returns an XML DOM-Document.
Thrown when the parsing fails.
Parses XML from a ,
fixing the illegal control character optionally.
a String
containing the XMP packet
the parsing options
Returns an XML DOM-Document.
Thrown when the parsing fails.
A node in the internally XMP tree, which can be a schema node, a property node, an array node,
an array item, a struct node or a qualifier node (without '?').
Possible improvements:
1. The kind Node of node might be better represented by a class-hierarchy of different nodes.
2. The array type should be an enum
3. isImplicitNode should be removed completely and replaced by return values of fi.
4. hasLanguage, hasType should be automatically maintained by XMPNode
@since 21.02.2006
flag if the node is an alias
list of child nodes, lazy initialized
flag if the node has aliases
flag if the node has an "rdf:value" child node.
flag if the node is implicitly created
name of the node, contains different information depending of the node kind
options describing the kind of the node
link to the parent node
list of qualifier of the node, lazy initialized
value of the node, contains different information depending of the node kind
Creates an XMPNode
with initial values.
the name of the node
the value of the node
the options of the node
Constructor for the node without value.
the name of the node
the options of the node
Resets the node.
an index [1..size]
Returns the child with the requested index.
Adds a node as child to this node.
an XMPNode
Adds a node as child to this node.
the index of the node before which the new one is inserted.
Note: The node children are indexed from [1..size]!
An index of size + 1 appends a node.
an XMPNode
Replaces a node with another one.
the index of the node that will be replaced.
Note: The node children are indexed from [1..size]!
the replacement XMPNode
Removes a child at the requested index.
the index to remove [1..size]
Removes a child node.
If its a schema node and doesn't have any children anymore, its deleted.
the child node to delete.
Removes the children list if this node has no children anymore;
checks if the provided node is a schema node and doesn't have any children anymore,
its deleted.
Removes all children from the node.
child node name to look for
Returns an XMPNode
if node has been found, null
otherwise.
an index [1..size]
Returns the qualifier with the requested index.
Appends a qualifier to the qualifier list and sets respective options.
a qualifier node.
Removes one qualifier node and fixes the options.
qualifier to remove
Removes all qualifiers from the node and sets the options appropriate.
qualifier node name to look for
Returns a qualifier XMPNode
if node has been found,
null
otherwise.
Returns whether the node has children.
Returns an iterator for the children.
Note: take care to use it.remove(), as the flag are not adjusted in that case.
Returns whether the node has qualifier attached.
Returns an iterator for the qualifier.
Note: take care to use it.remove(), as the flag are not adjusted in that case.
Performs a deep clone of the complete subtree (children and
qualifier )into and add it to the destination node.
the node to add the cloned subtree
Renders this node and the tree unter this node in a human readable form.
Flag is qualifier and child nodes shall be rendered too
Returns a multiline string containing the dump.
Dumps this node and its qualifier and children recursively.
Note: It creats empty options on every node.
the buffer to append the dump.
Flag is qualifier and child nodes shall be rendered too
the current indent level.
the index within the parent node (important for arrays)
Internal find.
the list to search in
the search expression
Returns the found node or nulls
.
Checks that a node name is not existing on the same level, except for array items.
the node name to check
Thrown if a node with the same name is existing.
Checks that a qualifier name is not existing on the same level.
the new qualifier name
Thrown if a node with the same name is existing.
Returns the parent node.
Returns the number of children without neccessarily creating a list.
Returns the number of qualifier without neccessarily creating a list.
Returns the name.
Returns the value.
Returns the options.
Returns the implicit flag
Returns if the node contains aliases (applies only to schema nodes)
Returns if the node contains aliases (applies only to schema nodes)
the hasValueChild
Returns whether this node is a language qualifier.
Returns whether this node is a type qualifier.
Note: This method should always be called when accessing 'children' to be sure
that its initialized.
Returns list of children that is lazy initialized.
Returns a read-only copy of child nodes list.
Returns list of qualifier that is lazy initialized.
Utilities for XMPNode
.
@since Aug 28, 2006
Private Constructor
Find or create a schema node if createNodes
is false and
the root of the xmp tree.
a namespace
a flag indicating if the node shall be created if not found.
Note: The namespace must be registered prior to this call.
Returns the schema node if found, null
otherwise.
Note: If createNodes
is true
, it is always
returned a valid node.
An exception is only thrown if an error occurred, not if a
node was not found.
Find or create a schema node if createNodes
is true.
the root of the xmp tree.
a namespace
If a prefix is suggested, the namespace is allowed to be registered.
a flag indicating if the node shall be created if not found.
Note: The namespace must be registered prior to this call.
Returns the schema node if found, null
otherwise.
Note: If createNodes
is true
, it is always
returned a valid node.
An exception is only thrown if an error occurred, not if a
node was not found.
Find or create a child node under a given parent node. If the parent node is no
Returns the found or created child node.
the parent node
the node name to find
flag, if new nodes shall be created.
Returns the found or created node or null
.
Thrown if
Follow an expanded path expression to find or create a node.
the node to begin the search.
the complete xpath
flag if nodes shall be created
(when called by setProperty()
)
the options for the created leaf nodes (only when
createNodes == true
).
Returns the node if found or created or null
.
An exception is only thrown if an error occurred,
not if a node was not found.
Deletes the the given node and its children from its parent.
Takes care about adjusting the flags.
the top-most node to delete.
This is setting the value of a leaf node.
an XMPNode
a value
Verifies the PropertyOptions for consistancy and updates them as needed.
If options are null
they are created with default values.
the PropertyOptions
the node value to set
Returns the updated options.
If the options are not consistant.
Converts the node value to String, apply special conversions for defined
types in XMP.
the node value to set
Returns the String representation of the node value.
Find or create a qualifier node under a given parent node. Returns a pointer to the
qualifier node, and optionally an iterator for the node's position in
the parent's vector of qualifiers. The iterator is unchanged if no qualifier node (null)
is returned.
Note: On entry, the qualName parameter must not have the leading '?' from the
XmpPath step.
the parent XMPNode
the qualifier name
flag if nodes shall be created
Returns the qualifier node if found or created, null
otherwise.
an array node
the segment containing the array index
flag if new nodes are allowed to be created.
Returns the index or index = -1 if not found
Throws Exceptions
Searches for a field selector in a node:
[fieldName="value] - an element in an array of structs, chosen by a field value.
No implicit nodes are created by field selectors.
Returns the index of the field if found, otherwise -1.
Searches for a qualifier selector in a node:
[?qualName="value"] - an element in an array, chosen by a qualifier value.
No implicit nodes are created for qualifier selectors,
except for an alias to an x-default item.
an array node
the qualifier name
the qualifier value
in case the qual selector results from an alias,
an x-default node is created if there has not been one.
Returns the index of th
Make sure the x-default item is first. Touch up "single value"
arrays that have a default plus one real language. This case should have
the same value for both items. Older Adobe apps were hardwired to only
use the "x-default" item, so we copy that value to the other
item.
an alt text array node
See if an array is an alt-text array. If so, make sure the x-default item
is first.
the array node to check if its an alt-text array
Appends a language item to an alt text array.
the language array
the language of the item
the content of the item
Thrown if a duplicate property is added
Looks for the appropriate language item in a text alternative array.item
an array node
the requested language
Returns the index if the language has been found, -1 otherwise.
@since Aug 18, 2006
caches the correct dc-property array forms
init char tables
Hidden constructor
Normalizes a raw parsed XMPMeta-Object
the raw metadata object
the parsing options
Returns the normalized metadata object
Collects all severe processing errors.
Tweak old XMP: Move an instance ID from rdf:about to the
xmpMM:InstanceID property. An old instance ID usually looks
like "uuid:bac965c4-9d87-11d9-9a30-000d936b79c4", plus InDesign
3.0 wrote them like "bac965c4-9d87-11d9-9a30-000d936b79c4". If
the name looks like a UUID simply move it to xmpMM:InstanceID,
don't worry about any existing xmpMM:InstanceID. Both will
only be present when a newer file with the xmpMM:InstanceID
property is updated by an old app that uses rdf:about.
the root of the metadata tree
Thrown if tweaking fails.
Visit all schemas to do general fixes and handle special cases.
the metadata object implementation
Thrown if the normalisation fails.
Make sure that the array is well-formed AltText. Each item must be simple
and have an "xml:lang" qualifier. If repairs are needed, keep simple
non-empty items by adding the "xml:lang" with value "x-repair".
the property node of the array to repair.
Forwards unexpected exceptions.
Visit all of the top level nodes looking for aliases. If there is
no base, transplant the alias subtree. If there is a base and strict
aliasing is on, make sure the alias and base subtrees match.
the root of the metadata tree
th parsing options
Forwards XMP errors
Moves an alias node of array form to another schema into an array
the node to be moved
the base array for the array item
Forwards XMP errors
Fixes the GPS Timestamp in EXIF.
the EXIF schema node
Thrown if the date conversion fails.
Remove all empty schemas from the metadata tree that were generated during the rdf parsing.
the root of the metadata tree
The outermost call is special. The names almost certainly differ. The
qualifiers (and hence options) will differ for an alias to the x-default
item of a langAlt array.
the alias node
the base node of the alias
marks the outer call of the recursion
Forwards XMP errors
The initial support for WAV files mapped a legacy ID3 audio copyright
into a new xmpDM:copyright property. This is special case code to migrate
that into dc:rights['x-default']. The rules:
1. If there is no dc:rights array, or an empty array -
Create one with dc:rights['x-default'] set from double linefeed and xmpDM:copyright.
2. If there is a dc:rights array but it has no x-default item -
Create an x-default item as a copy of the first item then apply rule #3.
3. If there is a dc:rights array with an x-default item,
Look for a double linefeed in the value.
A. If no double linefeed, compare the x-default value to the xmpDM:copyright value.
A1. If they match then leave the x-default value alone.
A2. Otherwise, append a double linefeed and
the xmpDM:copyright value to the x-default value.
B. If there is a double linefeed, compare the trailing text to the xmpDM:copyright value.
B1. If they match then leave the x-default value alone.
B2. Otherwise, replace the trailing x-default text with the xmpDM:copyright value.
4. In all cases, delete the xmpDM:copyright property.
the metadata object
the "dm:copyright"-property
Initializes the map that contains the known arrays, that are fixed by
.
The schema registry handles the namespaces, aliases and global options for the XMP Toolkit. There
is only one single instance used by the toolkit.
@since 27.01.2006
Returns the registered prefix/namespace-pairs as map, where the keys are the
namespaces and the values are the prefixes.
Returns the registered namespace/prefix-pairs as map, where the keys are the
prefixes and the values are the namespaces.
Determines if a name is an alias, and what it is aliased to.
The namespace URI of the alias. Must not be null
or the empty
string.
The name of the alias. May be an arbitrary path expression
path, must not be null
or the empty string.
Returns the XMPAliasInfo
for the given alias namespace and property or
null
if there is no such alias.
Collects all aliases that are contained in the provided namespace.
If nothing is found, an empty array is returned.
a schema namespace URI
Returns all alias infos from aliases that are contained in the provided namespace.
Searches for registered aliases.
an XML conform qname
Returns if an alias definition for the given qname to another
schema and property is registered.
Returns the registered aliases as map, where the key is the "qname" (prefix and name)
and the value an XMPAliasInfo
-object.
a map of all registered aliases.
The map is a relationship from a qname to an XMPAliasInfo
-object.
a map from a namespace URI to its registered prefix
a map from a prefix to the associated namespace URI
The pattern that must not be contained in simple properties
Performs the initialisation of the registry with the default namespaces, aliases and global
options.
Register the standard namespaces of schemas and types that are included in the XMP
Specification and some other Adobe private namespaces.
Note: This method is not lock because only called by the constructor.
Forwards processing exceptions
Register the standard aliases.
Note: This method is not lock because only called by the constructor.
If the registrations of at least one alias fails.
This interface is used to return info about an alias.
@since 27.01.2006
Returns Returns the namespace URI for the base property.
Returns the default prefix for the given base property.
Returns the path of the base property.
Returns the kind of the alias. This can be a direct alias
(ARRAY), a simple property to an ordered array
(ARRAY_ORDERED), to an alternate array
(ARRAY_ALTERNATE) or to an alternate text array
(ARRAY_ALT_TEXT).
Serializes the XMPMeta
-object to an OutputStream
according to the
SerializeOptions
.
@since 11.07.2006
Static method to Serialize the metadata object. For each serialisation, a new XMPSerializer
instance is created, either XMPSerializerRDF or XMPSerializerPlain so thats its possible to
serialialize the same XMPMeta objects in two threads.
a metadata implementation object
the output stream to Serialize to
serialization options, can be null
for default.
Serializes an XMPMeta
-object as RDF into a string.
Note: Encoding is forced to UTF-16 when serializing to a
string to ensure the correctness of "exact packet size".
a metadata implementation object
Options to control the serialization (see
).
Returns a string containing the serialized RDF.
on serializsation errors.
Serializes an XMPMeta
-object as RDF into a byte buffer.
a metadata implementation object
Options to control the serialization (see ).
Returns a byte buffer containing the serialized RDF.
on serializsation errors.
Serializes the XMPMeta
-object using the standard RDF serialization format.
The output is written to an OutputStream
according to the SerializeOptions
.
@since 11.07.2006
default padding
The w/r is missing inbetween
a set of all rdf attribute qualifier
the stored serialization options
the output stream to Serialize to
the padding in the XMP Packet, or the length of the complete packet in
case of option exactPacketLength.
the size of one unicode char, for UTF-8 set to 1
(Note: only valid for ASCII chars lower than 0x80),
set to 2 in case of UTF-16
this writer is used to do the actual serialization
the metadata object to be serialized.
The actual serialization.
the metadata object to be serialized
outputStream the output stream to Serialize to
the serialization options
If case of wrong options or any other serialization error.
Calculates the padding according to the options and write it to the stream.
the length of the tail string
thrown if packet size is to small to fit the padding
forwards writer errors
Checks if the supplied options are consistent.
Thrown if options are conflicting
Writes the (optional) packet header and the outer rdf-tags.
Returns the packet end processing instraction to be written after the padding.
Forwarded writer exceptions.
Serializes the metadata in pretty-printed manner.
indent level
Forwarded writer exceptions
Serializes the metadata in compact manner.
indent level to start with
Forwarded writer exceptions
Write each of the parent's simple unqualified properties as an attribute. Returns true if all
of the properties are written as attributes.
the parent property node
the current indent level
Returns true if all properties can be rendered as RDF attribute.
Recursively handles the "value" for a node that must be written as an RDF
property element. It does not matter if it is a top level property, a
field of a struct, or an item of an array. The indent is that for the
property element. The patterns bwlow ignore attribute qualifiers such as
xml:lang, they don't affect the output form.
<ns:UnqualifiedStructProperty-1
... The fields as attributes, if all are simple and unqualified
/>
<ns:UnqualifiedStructProperty-2 rdf:parseType="Resource">
... The fields as elements, if none are simple and unqualified
</ns:UnqualifiedStructProperty-2>
<ns:UnqualifiedStructProperty-3>
<rdf:Description
... The simple and unqualified fields as attributes
>
... The compound or qualified fields as elements
</rdf:Description>
</ns:UnqualifiedStructProperty-3>
<ns:UnqualifiedArrayProperty>
<rdf:Bag> or Seq or Alt
... Array items as rdf:li elements, same forms as top level properties
</rdf:Bag>
</ns:UnqualifiedArrayProperty>
<ns:QualifiedProperty rdf:parseType="Resource">
<rdf:value> ... Property "value"
following the unqualified forms ... </rdf:value>
... Qualifiers looking like named struct fields
</ns:QualifiedProperty>
*** Consider numbered array items, but has compatibility problems. ***
Consider qualified form with rdf:Description and attributes.
the parent node
the current indent level
Forwards writer exceptions
If qualifier and element fields are mixed.
Serializes a simple property.
an XMPNode
Returns an array containing the flags emitEndTag and indentEndTag.
Forwards the writer exceptions.
Serializes an array property.
an XMPNode
the current indent level
Forwards the writer exceptions.
If qualifier and element fields are mixed.
Serializes a struct property.
an XMPNode
the current indent level
Flag if the element has resource qualifier
Returns true if an end flag shall be emitted.
Forwards the writer exceptions.
If qualifier and element fields are mixed.
Serializes the general qualifier.
the root node of the subtree
the current indent level
Forwards all writer exceptions.
If qualifier and element fields are mixed.
Writes all used namespaces of the subtree in node to the output.
The subtree is recursivly traversed.
the root node of the subtree
a set containing currently used prefixes
the current indent level
Forwards all writer exceptions.
Writes one namespace declaration to the output.
a namespace prefix (without colon) or a complete qname (when namespace == null)
the a namespace
a set containing currently used prefixes
the current indent level
Forwards all writer exceptions.
Start the outer rdf:Description element, including all needed xmlns attributes.
Leave the element open so that the compact form can add property attributes.
If the writing to
Recursively handles the "value" for a node. It does not matter if it is a
top level property, a field of a struct, or an item of an array. The
indent is that for the property element. An xml:lang qualifier is written
as an attribute of the property start tag, not by itself forcing the
qualified property form. The patterns below mostly ignore attribute
qualifiers like xml:lang. Except for the one struct case, attribute
qualifiers don't affect the output form.
<ns:UnqualifiedSimpleProperty>value</ns:UnqualifiedSimpleProperty>
<ns:UnqualifiedStructProperty> (If no rdf:resource qualifier)
<rdf:Description>
... Fields, same forms as top level properties
</rdf:Description>
</ns:UnqualifiedStructProperty>
<ns:ResourceStructProperty rdf:resource="URI"
... Fields as attributes
>
<ns:UnqualifiedArrayProperty>
<rdf:Bag> or Seq or Alt
... Array items as rdf:li elements, same forms as top level properties
</rdf:Bag>
</ns:UnqualifiedArrayProperty>
<ns:QualifiedProperty>
<rdf:Description>
<rdf:value> ... Property "value" following the unqualified
forms ... </rdf:value>
... Qualifiers looking like named struct fields
</rdf:Description>
</ns:QualifiedProperty>
the property node
property shall be rendered as attribute rather than tag
use canonical form with inner description tag or
the compact form with rdf:ParseType="resource" attribute.
the current indent level
Forwards all writer exceptions.
If "rdf:resource" and general qualifiers are mixed.
Writes the array start and end tags.
an array node
flag if its the start or end tag
the current indent level
forwards writer exceptions
Serializes the node value in XML encoding. Its used for tag bodies and
attributes. Note: The attribute is always limited by quotes,
thats why '
is never serialized. Note:
Control chars are written unescaped, but if the user uses others than tab, LF
and CR the resulting XML will become invalid.
the value of the node
flag if value is an attribute value
Writes indents and automatically includes the baseindend from the options.
number of indents to write
forwards exception
Writes a char to the output.
a char
forwards writer exceptions
Writes a String to the output.
a String
forwards writer exceptions
Writes an amount of chars, mostly spaces
number of chars
a char
Writes a newline according to the options.
Forwards exception
@since 11.08.2006
Private constructor, as
see {@link XMPUtils#separateArrayItems(XMPMeta, String, String, String,
PropertyOptions, boolean)}
The XMP object containing the array to be updated.
The schema namespace URI for the array. Must not be null or
the empty string.
The name of the array. May be a general path expression, must
not be null or the empty string. Each item in the array must
be a simple string value.
The string to be separated into the array items.
Option flags to control the separation.
Flag if commas shall be preserved
Forwards the Exceptions from the metadata processing
Utility to find or create the array used by separateArrayItems()
.
a the namespace fo the array
the name of the array
the options for the array if newly created
the xmp object
Returns the array node.
Forwards exceptions
Remove all schema children according to the flag
doAllProperties
. Empty schemas are automatically remove
by XMPNode
a schema node
flag if all properties or only externals shall be removed.
Returns true if the schema is empty after the operation.
Compares two nodes including its children and qualifier.
an XMPNode
an XMPNode
Returns true if the nodes are equal, false otherwise.
Forwards exceptions to the calling method.
Make sure the separator is OK. It must be one semicolon surrounded by
zero or more spaces. Any of the recognized semicolons or spaces are
allowed.
Make sure the open and close quotes are a legitimate pair and return the
correct closing quote or an exception.
opened and closing quote in a string
the open quote
Returns a corresponding closing quote.
Classifies the character into normal chars, spaces, semicola, quotes,
control chars.
a char
Return the character kind.
the open quote char
Returns the matching closing quote for an open quote.
Add quotes to the item.
the array item
the open quote character
the closing quote character
flag if commas are allowed
Returns the value in quotes.
a character
the opening quote char
the closing quote char
Return it the character is a surrounding quote.
a character
the opening quote char
the closing quote char
Returns true if the character is a closing quote.
Representates an XMP XmpPath with segment accessor methods.
@since 28.02.2006
Marks a struct field step , also for top level nodes (schema "fields").
Marks a qualifier step.
Note: Order is significant to separate struct/qual from array kinds!
Marks an array index step
stores the segments of an XmpPath
Append a path segment
the segment to add
the index of the segment to return
Returns a path segment.
Returns the size of the xmp path.
Parser for XMP XPaths.
@since 01.03.2006
Private constructor
@param path
@param pos
@throws XmpException
Parses a struct segment
@param pos the current position in the path
@return Retusn the segment or an errror
@throws XmpException If the sement is empty
Parses an array index segment.
@param pos the xmp path
@return Returns the segment or an error
@throws XmpException thrown on xmp path errors
Parses the root node of an XMP Path, checks if namespace and prefix fit together
and resolve the property to the base property if it is an alias.
@param schemaNs the root namespace
@param pos the parsing position helper
@param expandedXPath the path to contribute to
@throws XmpException If the path is not valid.
Verifies whether the qualifier name is not XML conformant or the
namespace prefix has not been registered.
@param qualName
a qualifier name
@throws XmpException
If the name is not conformant
Verify if an XML name is conformant.
@param name
an XML name
@throws XmpException
When the name is not XML conformant
This objects contains all needed char positions to parse.
the complete path
the end of a segment name
the begin of a step
the end of a step
A segment of a parsed XmpPath
.
@since 23.06.2006
flag if segment is an alias
alias form if applicable
kind of the path segment
name of the path segment
Constructor with initial values.
the name of the segment
Constructor with initial values.
the name of the segment
the kind of the segment
Returns the kind.
Returns the name.
the flag to set
Returns the aliasForm if this segment has been created by an alias.
Returns the primary release number, the "1" in version "1.2.3".
Returns the secondary release number, the "2" in version "1.2.3".
Returns the tertiary release number, the "3" in version "1.2.3".
Returns a rolling build number, monotonically increasing in a release.
Returns true if this is a debug build.
Returns a comprehensive version information string.
Options for XMPSchemaRegistryImpl#registerAlias.
@since 20.02.2006
The base class for a collection of 32 flag bits. Individual flags are defined as enum value bit
masks. Inheriting classes add convenience accessor methods.
@since 24.01.2006
a map containing the bit names
the internal int containing all options
The default constructor.
Constructor with the options bit mask.
the options bit mask
If the options are not correct
Resets the options.
an option bitmask
Returns true, if this object is equal to the given options.
an option bitmask
Returns true, if this object contains all given options.
an option bitmask
Returns true, if this object contain at least one of the given options.
the binary bit or bits that are requested
Returns if all of the requested bits are set or not.
the binary bit or bits that shall be set to the given value
the boolean value to set
Returns the options as hex bitmask.
To be implemeted by inheritants.
a single, valid option bit.
Returns a human readable name for an option bit.
The inheriting option class can do additional checks on the options.
Note: For performance reasons this method is only called
when setting bitmasks directly.
When get- and set-methods are used, this method must be called manually,
normally only when the Options-object has been created from a client
(it has to be made public therefore).
the bitmask to check.
Thrown if the options are not consistent.
Checks options before they are set.
First it is checked if only defined options are used,
second the additional -method is called.
the options to check
Thrown if the options are invalid.
Looks up or asks the inherited class for the name of an option bit.
Its save that there is only one valid option handed into the method.
a single option bit
Returns the option name or undefined.
Returns the optionNames map and creates it if required.
Is friendly to access it during the tests.
Returns the options.
Creates a human readable string from the set options. Note: This method is quite
expensive and should only be used within tests or as
Returns a String listing all options that are set to true
by their name,
like "option1 | option4".
To be implemeted by inheritants.
Returns a bit mask where all valid option bits are set.
This is a direct mapping. The actual data type does not matter.
The actual is an unordered array, the alias is to the first element of the array.
The actual is an ordered array, the alias is to the first element of the array.
The actual is an alternate array, the alias is to the first element of the array.
The actual is an alternate text array, the alias is to the 'x-default' element of the array.
the options to init with
If options are not consistant
returns a s object
If the options are not consistant.
Returns if the alias is of the simple form.
Returns the option.
Returns the option.
Returns the option.
Returns the option.
Options for XMPIterator
construction.
@since 24.01.2006
Just do the immediate children of the root, default is subtree.
Just do the leaf nodes, default is all nodes in the subtree.
Bugfix #2658965: If this option is set the Iterator returns the namespace
of the leaf instead of the namespace of the base property.
Return just the leaf part of the path, default is the full path.
Omit all qualifiers.
Returns whether the option is set.
Returns whether the option is set.
Returns whether the option is set.
Returns whether the option is set.
Options for .
@since 24.01.2006
Require a surrounding "x:xmpmeta" element in the xml-document.
Do not reconcile alias differences, throw an exception instead.
Convert ASCII control characters 0x01 - 0x1F (except tab, cr, and lf) to spaces.
If the input is not unicode, try to parse it as ISO-8859-1.
Do not carry run the XMPNormalizer on a packet, leave it as it is.
Sets the options to the default values.
Returns the requireXMPMeta.
Returns the strictAliasing.
Returns the strictAliasing.
Returns the strictAliasing.
Returns the option "omit normalization".
The property flags are used when properties are fetched from the XMPMeta
-object
and provide more detailed information about the property.
@since 03.07.2006
may be used in the future
Updated by iText. Indicates if the property should be writted as a separate node
Default constructor
Intialization constructor
the initialization options
If the options are not valid
Compares two options set for array compatibility.
other options
Returns true if the array options of the sets are equal.
Merges the set options of a another options object with this.
If the other options set is null, this objects stays the same.
other options
If illegal options are provided
Checks that a node not a struct and array at the same time;
and URI cannot be a struct.
the bitmask to check.
Thrown if the options are not consistent.
Return whether the property value is a URI. It is serialized to RDF using the
rdf:resource attribute. Not mandatory for URIs, but considered RDF-savvy.
Return whether the property has qualifiers. These could be an xml:lang
attribute, an rdf:type property, or a general qualifier. See the
introductory discussion of qualified properties for more information.
Return whether this property is a qualifier for some other property. Note that if the
qualifier itself has a structured value, this flag is only set for the top node of
the qualifier's subtree. Qualifiers may have arbitrary structure, and may even have
qualifiers.
Return whether this property has an xml:lang qualifier.
Return whether this property has an rdf:type qualifier.
Return whether this property contains nested fields.
Return whether this property is an array. By itself this indicates a general
unordered array. It is serialized using an rdf:Bag container.
Return whether this property is an ordered array. Appears in conjunction with
getPropValueIsArray(). It is serialized using an rdf:Seq container.
Return whether this property is an alternative array. Appears in conjunction with
getPropValueIsArray(). It is serialized using an rdf:Alt container.
Return whether this property is an alt-text array. Appears in conjunction with
getPropArrayIsAlternate(). It is serialized using an rdf:Alt container.
Each array element is a simple property with an xml:lang attribute.
the value to set
Returns this to enable cascaded options.
Returns whether the SCHEMA_NODE option is set.
Returns whether the property is of composite type - an array or a struct.
Returns whether the property is of composite type - an array or a struct.
Returns true if only array options are set.
Options for .
@since 24.01.2006
Omit the XML packet wrapper.
Mark packet as read-only. Default is a writeable packet.
Use a compact form of RDF.
The compact form is the default serialization format (this flag is technically ignored).
To Serialize to the canonical form, set the flag USE_CANONICAL_FORMAT.
If both flags "compact" and "canonical" are set, canonical is used.
Use the canonical form of RDF if set. By default the compact form is used
Include a padding allowance for a thumbnail image. If no xmp:Thumbnails property
is present, the typical space for a JPEG thumbnail is used.
The padding parameter provides the overall packet length. The actual amount of padding is
computed. An exception is thrown if the packet exceeds this length with no padding.
Sort the struct properties and qualifier before serializing
Bit indicating little endian encoding, unset is big endian
Bit indication UTF16 encoding.
UTF8 encoding; this is the default
UTF16BE encoding
UTF16LE encoding
The number of levels of indentation to be used for the outermost XML element in the
serialized RDF. This is convenient when embedding the RDF in other text, defaults to 0.
The string to be used for each level of indentation in the serialized
RDF. If empty it defaults to two ASCII spaces, U+0020.
The string to be used as a line terminator. If empty it defaults to; linefeed, U+000A, the
standard XML newline.
Omits the Toolkit version attribute, not published, only used for Unit tests.
The amount of padding to be added if a writeable XML packet is created. If zero is passed
(the default) an appropriate amount of padding is computed.
Default constructor.
Constructor using inital options
the inital options
Thrown if options are not consistant.
Returns clone of this SerializeOptions-object with the same options set.
Returns the option.
Returns the option.
Returns the option.
Returns the option.
Returns the option.
Returns the option.
Returns the option.
Returns the option.
Returns the option.
Returns the option.
Returns the baseIndent.
Returns the indent.
Returns the newline.
Returns the padding.
Returns whether the Toolkit version attribute shall be omitted.
Note: This options can only be set by unit tests.
Returns the encoding as Java encoding String.
A factory to create XMPDateTime
-instances from a Calendar
or an
ISO 8601 string or for the current time.
@since 16.02.2006
Creates an XMPDateTime
from a Calendar
-object.
a Calendar
-object.
An XMPDateTime
-object.
Creates an empty XMPDateTime
-object.
Returns an XMPDateTime
-object.
Creates an XMPDateTime
from an ISO 8601 string.
The ISO 8601 string representation of the date/time.
An XMPDateTime
-object.
When the ISO 8601 string is non-conform
Sets the local time zone without touching any other Any existing time zone value is replaced,
the other date/time fields are not adjusted in any way.
the XMPDateTime
variable containing the value to be modified.
Returns an updated XMPDateTime
-object.
Make sure a time is UTC. If the time zone is not UTC, the time is
adjusted and the time zone set to be UTC.
the XMPDateTime
variable containing the time to
be modified.
Returns an updated XMPDateTime
-object.
Make sure a time is local. If the time zone is not the local zone, the time is adjusted and
the time zone set to be local.
the XMPDateTime
variable containing the time to be modified.
Returns an updated XMPDateTime
-object.
Obtain the current date and time.
Returns The returned time is UTC, properly adjusted for the local time zone. The
resolution of the time is not guaranteed to be finer than seconds.
@since 21.09.2006
Note: This is an error code introduced by Java.
This exception wraps all errors that occur in the XMP Toolkit.
@since 16.02.2006
the errorCode of the XMP toolkit
Constructs an exception with a message and an error code.
the message
the error code
Constructs an exception with a message, an error code and a Throwable
the error message.
the error code
the exception source
Returns the errorCode.
Creates XMPMeta
-instances from an InputStream
@since 30.01.2006
The singleton instance of the XMPSchemaRegistry
.
cache for version info
Returns an empty XMPMeta
-object.
Serializes an XMPMeta
-object as RDF into an OutputStream
with default options.
a metadata object
an OutputStream
to write the serialized RDF to.
on serializsation errors.
Serializes an XMPMeta
-object as RDF into an OutputStream
.
a metadata object
Options to control the serialization (see ).
an OutputStream
to write the serialized RDF to.
on serializsation errors.
Serializes an XMPMeta
-object as RDF into a byte buffer.
a metadata object
Options to control the serialization (see ).
Returns a byte buffer containing the serialized RDF.
on serializsation errors.
Serializes an XMPMeta
-object as RDF into a string. Note: Encoding
is ignored when serializing to a string.
a metadata object
Options to control the serialization (see ).
Returns a string containing the serialized RDF.
on serializsation errors.
Asserts that xmp is compatible to XMPMetaImpl
.s
Resets the _schema registry to its original state (creates a new one).
Be careful this might break all existing XMPMeta-objects and should be used
only for testing purpurses.
Obtain version information. The XMPVersionInfo singleton is created the first time
its requested.
Returns the version information.
Returns the singleton instance of the XMPSchemaRegistry
.
Compose the path expression for an item in an array.
The name of the array. May be a general path expression, must not be
null
or the empty string.
The index of the desired item. Arrays in XMP are indexed from 1.
0 and below means last array item and renders as [last()]
.
Returns the composed path basing on fullPath. This will be of the form
ns:arrayName[i], where "ns" is the prefix for schemaNs and
"i" is the decimal representation of itemIndex.
Throws exeption if index zero is used.
Compose the path expression for a field in a struct. The result can be added to the
path of
The namespace URI for the field. Must not be null
or the empty
string.
The name of the field. Must be a simple XML name, must not be
null
or the empty string.
Returns the composed path. This will be of the form
ns:structName/fNS:fieldName, where "ns" is the prefix for
schemaNs and "fNS" is the prefix for fieldNs.
Thrown if the path to create is not valid.
Compose the path expression for a qualifier.
The namespace URI for the qualifier. May be null
or the empty
string if the qualifier is in the XML empty namespace.
The name of the qualifier. Must be a simple XML name, must not be
null
or the empty string.
Returns the composed path. This will be of the form
ns:propName/?qNS:qualName, where "ns" is the prefix for
schemaNs and "qNS" is the prefix for qualNs.
Thrown if the path to create is not valid.
Compose the path expression to select an alternate item by language. The
path syntax allows two forms of "content addressing" that may
be used to select an item in an array of alternatives. The form used in
ComposeLangSelector lets you select an item in an alt-text array based on
the value of its xml:lang qualifier. The other form of content
addressing is shown in ComposeFieldSelector. \note ComposeLangSelector
does not supplant SetLocalizedText or GetLocalizedText. They should
generally be used, as they provide extra logic to choose the appropriate
language and maintain consistency with the 'x-default' value.
ComposeLangSelector gives you an path expression that is explicitly and
only for the language given in the langName parameter.
The name of the array. May be a general path expression, must
not be null
or the empty string.
The RFC 3066 code for the desired language.
Returns the composed path. This will be of the form
ns:arrayName[@xml:lang='langName'], where
"ns" is the prefix for schemaNs.
ParameterAsserts that a qualifier namespace is set.
a qualifier namespace
Qualifier schema is null or empty
ParameterAsserts that a qualifier name is set.
a qualifier name or path
Qualifier name is null or empty
ParameterAsserts that a struct field namespace is set.
a struct field namespace
Struct field schema is null or empty
ParameterAsserts that a struct field name is set.
a struct field name or path
Struct field name is null or empty
Utility methods for XMP. I included only those that are different from the
Java default conversion utilities.
@since 21.02.2006
Private constructor
Create a single edit string from an array of strings.
The XMP object containing the array to be catenated.
The schema namespace URI for the array. Must not be null or
the empty string.
The name of the array. May be a general path expression, must
not be null or the empty string. Each item in the array must
be a simple string value.
The string to be used to separate the items in the catenated
string. Defaults to "; ", ASCII semicolon and space
(U+003B, U+0020).
The characters to be used as quotes around array items that
contain a separator. Defaults to '"'
Option flag to control the catenation.
Returns the string containing the catenated array items.
Forwards the Exceptions from the metadata processing
Separate a single edit string into an array of strings.
The XMP object containing the array to be updated.
The schema namespace URI for the array. Must not be null or
the empty string.
The name of the array. May be a general path expression, must
not be null or the empty string. Each item in the array must
be a simple string value.
The string to be separated into the array items.
Option flags to control the separation.
Flag if commas shall be preserved
Forwards the Exceptions from the metadata processing
Alias without the new option deleteEmptyValues
.
The source XMP object.
The destination XMP object.
Do internal properties in addition to external properties.
Replace the values of existing properties.
Forwards the Exceptions from the metadata processing
Convert from boolean to string.
a boolean value
The XMP string representation of the boolean. The values used are
given by the constnts and
.
Converts a string value to an int
.
the string value
Returns an int.
If the rawValue
is null
or empty or the
conversion fails.
Convert from int to string.
an int value
The string representation of the int.
Converts a string value to a long
.
the string value
Returns a long.
If the rawValue
is null
or empty or the
conversion fails.
Convert from long to string.
a long value
The string representation of the long.
Converts a string value to a double
.
the string value
Returns a double.
If the rawValue
is null
or empty or the
conversion fails.
Convert from long to string.
a long value
The string representation of the long.
Converts a string value to an XMPDateTime
.
the string value
Returns an XMPDateTime
-object.
If the rawValue
is null
or empty or the
conversion fails.
Convert from XMPDateTime
to string.
an XMPDateTime
The string representation of the long.
Convert from a byte array to a base64 encoded string.
the byte array to be converted
Returns the base64 string.
Decode from Base64 encoded string to raw data.
a base64 encoded string
Returns a byte array containg the decoded string.
Thrown if the given string is not property base64 encoded
Return the DER encoding of the object, null if the DER encoding can not be made.
@return a DER byte array, null otherwise.
a general purpose ASN.1 decoder - note: this class differs from the
others in that it returns null after it has read the last object in
the stream. If an ASN.1 Null is encountered a Der/BER Null object is
returned.
Create an ASN1InputStream where no DER object will be longer than limit.
@param input stream containing ASN.1 encoded data.
@param limit maximum size of a DER encoded object.
Create an ASN1InputStream based on the input byte array. The length of DER objects in
the stream is automatically limited to the length of the input array.
@param input array containing ASN.1 encoded data.
build an object given its tag and the number of bytes to construct it from.
A Null object.
Create a base ASN.1 object from a byte array.
The byte array to parse.
The base ASN.1 object represented by the byte array.
If there is a problem parsing the data.
Read a base ASN.1 object from a stream.
The stream to parse.
The base ASN.1 object represented by the byte array.
If there is a problem parsing the data.
return an Octet string from a tagged object.
@param obj the tagged object holding the object we want.
@param explicitly true if the object is meant to be explicitly
tagged false otherwise.
@exception ArgumentException if the tagged object cannot
be converted.
return an Octet string from the given object.
@param obj the object we want converted.
@exception ArgumentException if the object cannot be converted.
@param string the octets making up the octet string.
return an Asn1Sequence from the given object.
@param obj the object we want converted.
@exception ArgumentException if the object cannot be converted.
Return an ASN1 sequence from a tagged object. There is a special
case here, if an object appears to have been explicitly tagged on
reading but we were expecting it to be implicitly tagged in the
normal course of events it indicates that we lost the surrounding
sequence - so we need to add it back (this will happen if the tagged
object is a sequence that contains other sequences). If you are
dealing with implicitly tagged sequences you really should
be using this method.
@param obj the tagged object.
@param explicitly true if the object is meant to be explicitly tagged,
false otherwise.
@exception ArgumentException if the tagged object cannot
be converted.
return the object at the sequence position indicated by index.
@param index the sequence number (starting at zero) of the object
@return the object at the sequence position indicated by index.
return an ASN1Set from the given object.
@param obj the object we want converted.
@exception ArgumentException if the object cannot be converted.
Return an ASN1 set from a tagged object. There is a special
case here, if an object appears to have been explicitly tagged on
reading but we were expecting it to be implicitly tagged in the
normal course of events it indicates that we lost the surrounding
set - so we need to add it back (this will happen if the tagged
object is a sequence that contains other sequences). If you are
dealing with implicitly tagged sets you really should
be using this method.
@param obj the tagged object.
@param explicitly true if the object is meant to be explicitly tagged
false otherwise.
@exception ArgumentException if the tagged object cannot
be converted.
return true if a <= b (arrays are assumed padded with zeros).
return the object at the set position indicated by index.
@param index the set number (starting at zero) of the object
@return the object at the set position indicated by index.
ASN.1 TaggedObject - in ASN.1 notation this is any object preceded by
a [n] where n is some number - these are assumed to follow the construction
rules (as with sequences).
@param tagNo the tag number for this object.
@param obj the tagged object.
@param explicitly true if the object is explicitly tagged.
@param tagNo the tag number for this object.
@param obj the tagged object.
return whether or not the object may be explicitly tagged.
Note: if the object has been read from an input stream, the only
time you can be sure if isExplicit is returning the true state of
affairs is if it returns false. An implicitly tagged object may appear
to be explicitly tagged, so you need to understand the context under
which the reading was done as well, see GetObject below.
return whatever was following the tag.
Note: tagged objects are generally context dependent if you're
trying to extract a tagged object you should be going via the
appropriate GetInstance method.
Return the object held in this tagged object as a parser assuming it has
the type of the passed in tag. If the object doesn't have a parser
associated with it, the base object is returned.
Base class for an application specific object
Return the enclosed object assuming explicit tagging.
@return the resulting object
@throws IOException if reconstruction fails.
Return the enclosed object assuming implicit tagging.
@param derTagNo the type tag that should be applied to the object's contents.
@return the resulting object
@throws IOException if reconstruction fails.
A BER Null object.
A Null object.
The octets making up the octet string.
convert a vector of octet strings into a single byte string
The octets making up the octet string.
return the DER octets that make up this string.
create an empty sequence
create a sequence containing one object
create a sequence containing a vector of objects.
create an empty sequence
create a sequence containing one object
create a sequence containing a vector of objects.
A Der encoded set object
create an empty set
@param obj - a single object that makes up the set.
@param v - a vector of objects making up the set.
create an empty sequence
create a set containing one object
create a set containing a vector of objects.
BER TaggedObject - in ASN.1 notation this is any object preceded by
a [n] where n is some number - these are assumed to follow the construction
rules (as with sequences).
DER TaggedObject - in ASN.1 notation this is any object preceded by
a [n] where n is some number - these are assumed to follow the construction
rules (as with sequences).
@param tagNo the tag number for this object.
@param obj the tagged object.
@param explicitly true if an explicitly tagged object.
@param tagNo the tag number for this object.
@param obj the tagged object.
create an implicitly tagged object that contains a zero
length sequence.
@param tagNo the tag number for this object.
@param obj the tagged object.
@param explicitly true if an explicitly tagged object.
@param tagNo the tag number for this object.
@param obj the tagged object.
create an implicitly tagged object that contains a zero
length sequence.
PKIFailureInfo ::= BIT STRING {
badAlg (0),
-- unrecognized or unsupported Algorithm Identifier
badMessageCheck (1), -- integrity check failed (e.g., signature did not verify)
badRequest (2),
-- transaction not permitted or supported
badTime (3), -- messageTime was not sufficiently close to the system time, as defined by local policy
badCertId (4), -- no certificate could be found matching the provided criteria
badDataFormat (5),
-- the data submitted has the wrong format
wrongAuthority (6), -- the authority indicated in the request is different from the one creating the response token
incorrectData (7), -- the requester's data is incorrect (for notary services)
missingTimeStamp (8), -- when the timestamp is missing but should be there (by policy)
badPOP (9) -- the proof-of-possession failed
timeNotAvailable (14),
-- the TSA's time source is not available
unacceptedPolicy (15),
-- the requested TSA policy is not supported by the TSA
unacceptedExtension (16),
-- the requested extension is not supported by the TSA
addInfoNotAvailable (17)
-- the additional information requested could not be understood
-- or is not available
systemFailure (25)
-- the request cannot be handled due to system failure
basic interface for Der string objects.
return the correct number of pad bits for a bit string defined in
a 32 bit constant
return the correct number of bytes for a bit string defined in
a 32 bit constant
return a Bit string from the passed in object
@exception ArgumentException if the object cannot be converted.
return a Bit string from a tagged object.
@param obj the tagged object holding the object we want
@param explicitly true if the object is meant to be explicitly
tagged false otherwise.
@exception ArgumentException if the tagged object cannot
be converted.
@param data the octets making up the bit string.
@param padBits the number of extra bits at the end of the string.
@return the value of the bit string as an int (truncating if necessary)
Basic constructor.
PkiFreeText ::= SEQUENCE SIZE (1..MAX) OF UTF8String
Return the number of string elements present.
@return number of elements present.
Return the UTF8STRING at index.
@param index index of the string of interest
@return the string at index.
@param status
@param status
@param statusString
PkiStatusInfo ::= SEQUENCE {
status PKIStatus, (INTEGER)
statusString PkiFreeText OPTIONAL,
failInfo PkiFailureInfo OPTIONAL (BIT STRING)
}
PKIStatus:
granted (0), -- you got exactly what you asked for
grantedWithMods (1), -- you got something like what you asked for
rejection (2), -- you don't get it, more information elsewhere in the message
waiting (3), -- the request body part has not yet been processed, expect to hear more later
revocationWarning (4), -- this message contains a warning that a revocation is imminent
revocationNotification (5), -- notification that a revocation has occurred
keyUpdateWarning (6) -- update already done for the oldCertId specified in CertReqMsg
PkiFailureInfo:
badAlg (0), -- unrecognized or unsupported Algorithm Identifier
badMessageCheck (1), -- integrity check failed (e.g., signature did not verify)
badRequest (2), -- transaction not permitted or supported
badTime (3), -- messageTime was not sufficiently close to the system time, as defined by local policy
badCertId (4), -- no certificate could be found matching the provided criteria
badDataFormat (5), -- the data submitted has the wrong format
wrongAuthority (6), -- the authority indicated in the request is different from the one creating the response token
incorrectData (7), -- the requester's data is incorrect (for notary services)
missingTimeStamp (8), -- when the timestamp is missing but should be there (by policy)
badPOP (9) -- the proof-of-possession failed
return an Attribute object from the given object.
@param o the object we want converted.
@exception ArgumentException if the object cannot be converted.
Produce an object suitable for an Asn1OutputStream.
Attribute ::= SEQUENCE {
attrType OBJECT IDENTIFIER,
attrValues SET OF AttributeValue
}
Return all the attributes matching the OBJECT IDENTIFIER oid. The vector will be
empty if there are no attributes of the required type present.
@param oid type of attribute required.
@return a vector of all the attributes found of type oid.
Return a new table with the passed in attribute added.
@param attrType
@param attrValue
@return
Return the first attribute matching the given OBJECT IDENTIFIER
return an AuthenticatedData object from a tagged object.
@param obj the tagged object holding the object we want.
@param isExplicit true if the object is meant to be explicitly
tagged false otherwise.
@throws ArgumentException if the object held by the
tagged object cannot be converted.
return an AuthenticatedData object from the given object.
@param obj the object we want converted.
@throws ArgumentException if the object cannot be converted.
Produce an object suitable for an Asn1OutputStream.
AuthenticatedData ::= SEQUENCE {
version CMSVersion,
originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL,
recipientInfos RecipientInfos,
macAlgorithm MessageAuthenticationCodeAlgorithm,
digestAlgorithm [1] DigestAlgorithmIdentifier OPTIONAL,
encapContentInfo EncapsulatedContentInfo,
authAttrs [2] IMPLICIT AuthAttributes OPTIONAL,
mac MessageAuthenticationCode,
unauthAttrs [3] IMPLICIT UnauthAttributes OPTIONAL }
AuthAttributes ::= SET SIZE (1..MAX) OF Attribute
UnauthAttributes ::= SET SIZE (1..MAX) OF Attribute
MessageAuthenticationCode ::= OCTET STRING
Produce an object suitable for an Asn1OutputStream.
AuthenticatedData ::= SEQUENCE {
version CMSVersion,
originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL,
recipientInfos RecipientInfos,
macAlgorithm MessageAuthenticationCodeAlgorithm,
digestAlgorithm [1] DigestAlgorithmIdentifier OPTIONAL,
encapContentInfo EncapsulatedContentInfo,
authAttrs [2] IMPLICIT AuthAttributes OPTIONAL,
mac MessageAuthenticationCode,
unauthAttrs [3] IMPLICIT UnauthAttributes OPTIONAL }
AuthAttributes ::= SET SIZE (1..MAX) OF Attribute
UnauthAttributes ::= SET SIZE (1..MAX) OF Attribute
MessageAuthenticationCode ::= OCTET STRING
return an AuthEnvelopedData object from a tagged object.
@param obj the tagged object holding the object we want.
@param isExplicit true if the object is meant to be explicitly
tagged false otherwise.
@throws ArgumentException if the object held by the
tagged object cannot be converted.
return an AuthEnvelopedData object from the given object.
@param obj the object we want converted.
@throws ArgumentException if the object cannot be converted.
Produce an object suitable for an Asn1OutputStream.
AuthEnvelopedData ::= SEQUENCE {
version CMSVersion,
originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL,
recipientInfos RecipientInfos,
authEncryptedContentInfo EncryptedContentInfo,
authAttrs [1] IMPLICIT AuthAttributes OPTIONAL,
mac MessageAuthenticationCode,
unauthAttrs [2] IMPLICIT UnauthAttributes OPTIONAL }
Produce an object suitable for an Asn1OutputStream.
AuthEnvelopedData ::= SEQUENCE {
version CMSVersion,
originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL,
recipientInfos RecipientInfos,
authEncryptedContentInfo EncryptedContentInfo,
authAttrs [1] IMPLICIT AuthAttributes OPTIONAL,
mac MessageAuthenticationCode,
unauthAttrs [2] IMPLICIT UnauthAttributes OPTIONAL }
The other Revocation Info arc
id-ri OBJECT IDENTIFIER ::= { iso(1) identified-organization(3)
dod(6) internet(1) security(5) mechanisms(5) pkix(7) ri(16) }
RFC 3274 - CMS Compressed Data.
CompressedData ::= Sequence {
version CMSVersion,
compressionAlgorithm CompressionAlgorithmIdentifier,
encapContentInfo EncapsulatedContentInfo
}
return a CompressedData object from a tagged object.
@param ato the tagged object holding the object we want.
@param explicitly true if the object is meant to be explicitly
tagged false otherwise.
@exception ArgumentException if the object held by the
tagged object cannot be converted.
return a CompressedData object from the given object.
@param _obj the object we want converted.
@exception ArgumentException if the object cannot be converted.
RFC 3274 - CMS Compressed Data.
CompressedData ::= SEQUENCE {
version CMSVersion,
compressionAlgorithm CompressionAlgorithmIdentifier,
encapContentInfo EncapsulatedContentInfo
}
Produce an object suitable for an Asn1OutputStream.
ContentInfo ::= Sequence {
contentType ContentType,
content
[0] EXPLICIT ANY DEFINED BY contentType OPTIONAL }
Produce an object suitable for an Asn1OutputStream.
ContentInfo ::= SEQUENCE {
contentType ContentType,
content
[0] EXPLICIT ANY DEFINED BY contentType OPTIONAL }
return an AuthEnvelopedData object from a tagged object.
@param obj the tagged object holding the object we want.
@param isExplicit true if the object is meant to be explicitly
tagged false otherwise.
@throws ArgumentException if the object held by the
tagged object cannot be converted.
return an AuthEnvelopedData object from the given object.
@param obj the object we want converted.
@throws ArgumentException if the object cannot be converted.
Produce an object suitable for an Asn1OutputStream.
MQVuserKeyingMaterial ::= SEQUENCE {
ephemeralPublicKey OriginatorPublicKey,
addedukm [0] EXPLICIT UserKeyingMaterial OPTIONAL }
return an EncryptedContentInfo object from the given object.
@param obj the object we want converted.
@exception ArgumentException if the object cannot be converted.
Produce an object suitable for an Asn1OutputStream.
EncryptedContentInfo ::= Sequence {
contentType ContentType,
contentEncryptionAlgorithm ContentEncryptionAlgorithmIdentifier,
encryptedContent [0] IMPLICIT EncryptedContent OPTIONAL
}
EncryptedContentInfo ::= SEQUENCE {
contentType ContentType,
contentEncryptionAlgorithm ContentEncryptionAlgorithmIdentifier,
encryptedContent [0] IMPLICIT EncryptedContent OPTIONAL
}
EncryptedData ::= SEQUENCE {
version CMSVersion,
encryptedContentInfo EncryptedContentInfo,
unprotectedAttrs [1] IMPLICIT UnprotectedAttributes OPTIONAL }
@return a basic ASN.1 object representation.
return an EnvelopedData object from a tagged object.
@param obj the tagged object holding the object we want.
@param explicitly true if the object is meant to be explicitly
tagged false otherwise.
@exception ArgumentException if the object held by the
tagged object cannot be converted.
return an EnvelopedData object from the given object.
@param obj the object we want converted.
@exception ArgumentException if the object cannot be converted.
Produce an object suitable for an Asn1OutputStream.
EnvelopedData ::= Sequence {
version CMSVersion,
originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL,
recipientInfos RecipientInfos,
encryptedContentInfo EncryptedContentInfo,
unprotectedAttrs [1] IMPLICIT UnprotectedAttributes OPTIONAL
}
Produce an object suitable for an Asn1OutputStream.
EnvelopedData ::= SEQUENCE {
version CMSVersion,
originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL,
recipientInfos RecipientInfos,
encryptedContentInfo EncryptedContentInfo,
unprotectedAttrs [1] IMPLICIT UnprotectedAttributes OPTIONAL
}
return a KekIdentifier object from a tagged object.
@param obj the tagged object holding the object we want.
@param explicitly true if the object is meant to be explicitly
tagged false otherwise.
@exception ArgumentException if the object held by the
tagged object cannot be converted.
return a KekIdentifier object from the given object.
@param obj the object we want converted.
@exception ArgumentException if the object cannot be converted.
Produce an object suitable for an Asn1OutputStream.
KekIdentifier ::= Sequence {
keyIdentifier OCTET STRING,
date GeneralizedTime OPTIONAL,
other OtherKeyAttribute OPTIONAL
}
return a KekRecipientInfo object from a tagged object.
@param obj the tagged object holding the object we want.
@param explicitly true if the object is meant to be explicitly
tagged false otherwise.
@exception ArgumentException if the object held by the
tagged object cannot be converted.
return a KekRecipientInfo object from the given object.
@param obj the object we want converted.
@exception ArgumentException if the object cannot be converted.
Produce an object suitable for an Asn1OutputStream.
KekRecipientInfo ::= Sequence {
version CMSVersion, -- always set to 4
kekID KekIdentifier,
keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
encryptedKey EncryptedKey
}
Marker interface for CHOICE objects - if you implement this in a roll-your-own
object, any attempt to tag the object implicitly will convert the tag to an
explicit one as the encoding rules require.
If you use this interface your class should also implement the getInstance
pattern which takes a tag object and the tagging mode used.
return an KeyAgreeRecipientIdentifier object from a tagged object.
@param obj the tagged object holding the object we want.
@param isExplicit true if the object is meant to be explicitly
tagged false otherwise.
@exception ArgumentException if the object held by the
tagged object cannot be converted.
return an KeyAgreeRecipientIdentifier object from the given object.
@param obj the object we want converted.
@exception ArgumentException if the object cannot be converted.
Produce an object suitable for an Asn1OutputStream.
KeyAgreeRecipientIdentifier ::= CHOICE {
issuerAndSerialNumber IssuerAndSerialNumber,
rKeyId [0] IMPLICIT RecipientKeyIdentifier
}
return a KeyAgreeRecipientInfo object from a tagged object.
@param obj the tagged object holding the object we want.
@param explicitly true if the object is meant to be explicitly
tagged false otherwise.
@exception ArgumentException if the object held by the
tagged object cannot be converted.
return a KeyAgreeRecipientInfo object from the given object.
@param obj the object we want converted.
@exception ArgumentException if the object cannot be converted.
* Produce an object suitable for an Asn1OutputStream.
*
* KeyAgreeRecipientInfo ::= Sequence {
* version CMSVersion, -- always set to 3
* originator [0] EXPLICIT OriginatorIdentifierOrKey,
* ukm [1] EXPLICIT UserKeyingMaterial OPTIONAL,
* keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
* recipientEncryptedKeys RecipientEncryptedKeys
* }
*
* UserKeyingMaterial ::= OCTET STRING
*
return a KeyTransRecipientInfo object from the given object.
@param obj the object we want converted.
@exception ArgumentException if the object cannot be converted.
Produce an object suitable for an Asn1OutputStream.
KeyTransRecipientInfo ::= Sequence {
version CMSVersion, -- always set to 0 or 2
rid RecipientIdentifier,
keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
encryptedKey EncryptedKey
}
return an OriginatorIdentifierOrKey object from a tagged object.
@param o the tagged object holding the object we want.
@param explicitly true if the object is meant to be explicitly
tagged false otherwise.
@exception ArgumentException if the object held by the
tagged object cannot be converted.
return an OriginatorIdentifierOrKey object from the given object.
@param o the object we want converted.
@exception ArgumentException if the object cannot be converted.
Produce an object suitable for an Asn1OutputStream.
OriginatorIdentifierOrKey ::= CHOICE {
issuerAndSerialNumber IssuerAndSerialNumber,
subjectKeyIdentifier [0] SubjectKeyIdentifier,
originatorKey [1] OriginatorPublicKey
}
SubjectKeyIdentifier ::= OCTET STRING
return an OriginatorInfo object from a tagged object.
@param obj the tagged object holding the object we want.
@param explicitly true if the object is meant to be explicitly
tagged false otherwise.
@exception ArgumentException if the object held by the
tagged object cannot be converted.
return an OriginatorInfo object from the given object.
@param obj the object we want converted.
@exception ArgumentException if the object cannot be converted.
Produce an object suitable for an Asn1OutputStream.
OriginatorInfo ::= Sequence {
certs [0] IMPLICIT CertificateSet OPTIONAL,
crls [1] IMPLICIT CertificateRevocationLists OPTIONAL
}
return an OriginatorPublicKey object from a tagged object.
@param obj the tagged object holding the object we want.
@param explicitly true if the object is meant to be explicitly
tagged false otherwise.
@exception ArgumentException if the object held by the
tagged object cannot be converted.
return an OriginatorPublicKey object from the given object.
@param obj the object we want converted.
@exception ArgumentException if the object cannot be converted.
Produce an object suitable for an Asn1OutputStream.
OriginatorPublicKey ::= Sequence {
algorithm AlgorithmIdentifier,
publicKey BIT STRING
}
return an OtherKeyAttribute object from the given object.
@param o the object we want converted.
@exception ArgumentException if the object cannot be converted.
Produce an object suitable for an Asn1OutputStream.
OtherKeyAttribute ::= Sequence {
keyAttrId OBJECT IDENTIFIER,
keyAttr ANY DEFINED BY keyAttrId OPTIONAL
}
return a OtherRecipientInfo object from a tagged object.
@param obj the tagged object holding the object we want.
@param explicitly true if the object is meant to be explicitly
tagged false otherwise.
@exception ArgumentException if the object held by the
tagged object cannot be converted.
return a OtherRecipientInfo object from the given object.
@param obj the object we want converted.
@exception ArgumentException if the object cannot be converted.
Produce an object suitable for an Asn1OutputStream.
OtherRecipientInfo ::= Sequence {
oriType OBJECT IDENTIFIER,
oriValue ANY DEFINED BY oriType }
return a OtherRevocationInfoFormat object from a tagged object.
@param obj the tagged object holding the object we want.
@param explicit true if the object is meant to be explicitly
tagged false otherwise.
@exception IllegalArgumentException if the object held by the
tagged object cannot be converted.
return a OtherRevocationInfoFormat object from the given object.
@param obj the object we want converted.
@exception IllegalArgumentException if the object cannot be converted.
Produce an object suitable for an ASN1OutputStream.
OtherRevocationInfoFormat ::= SEQUENCE {
otherRevInfoFormat OBJECT IDENTIFIER,
otherRevInfo ANY DEFINED BY otherRevInfoFormat }
return a PasswordRecipientInfo object from a tagged object.
@param obj the tagged object holding the object we want.
@param explicitly true if the object is meant to be explicitly
tagged false otherwise.
@exception ArgumentException if the object held by the
tagged object cannot be converted.
return a PasswordRecipientInfo object from the given object.
@param obj the object we want converted.
@exception ArgumentException if the object cannot be converted.
Produce an object suitable for an Asn1OutputStream.
PasswordRecipientInfo ::= Sequence {
version CMSVersion, -- Always set to 0
keyDerivationAlgorithm [0] KeyDerivationAlgorithmIdentifier
OPTIONAL,
keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
encryptedKey EncryptedKey }
return an RecipientEncryptedKey object from a tagged object.
@param obj the tagged object holding the object we want.
@param isExplicit true if the object is meant to be explicitly
tagged false otherwise.
@exception ArgumentException if the object held by the
tagged object cannot be converted.
return a RecipientEncryptedKey object from the given object.
@param obj the object we want converted.
@exception ArgumentException if the object cannot be converted.
Produce an object suitable for an Asn1OutputStream.
RecipientEncryptedKey ::= SEQUENCE {
rid KeyAgreeRecipientIdentifier,
encryptedKey EncryptedKey
}
return a RecipientIdentifier object from the given object.
@param o the object we want converted.
@exception ArgumentException if the object cannot be converted.
Produce an object suitable for an Asn1OutputStream.
RecipientIdentifier ::= CHOICE {
issuerAndSerialNumber IssuerAndSerialNumber,
subjectKeyIdentifier [0] SubjectKeyIdentifier
}
SubjectKeyIdentifier ::= OCTET STRING
Produce an object suitable for an Asn1OutputStream.
RecipientInfo ::= CHOICE {
ktri KeyTransRecipientInfo,
kari [1] KeyAgreeRecipientInfo,
kekri [2] KekRecipientInfo,
pwri [3] PasswordRecipientInfo,
ori [4] OtherRecipientInfo }
return a RecipientKeyIdentifier object from a tagged object.
@param _ato the tagged object holding the object we want.
@param _explicit true if the object is meant to be explicitly
tagged false otherwise.
@exception ArgumentException if the object held by the
tagged object cannot be converted.
return a RecipientKeyIdentifier object from the given object.
@param _obj the object we want converted.
@exception ArgumentException if the object cannot be converted.
Produce an object suitable for an Asn1OutputStream.
RecipientKeyIdentifier ::= Sequence {
subjectKeyIdentifier SubjectKeyIdentifier,
date GeneralizedTime OPTIONAL,
other OtherKeyAttribute OPTIONAL
}
SubjectKeyIdentifier ::= OCTET STRING
ScvpReqRes ::= SEQUENCE {
request [0] EXPLICIT ContentInfo OPTIONAL,
response ContentInfo }
@return the ASN.1 primitive representation.
a signed data object.
Produce an object suitable for an Asn1OutputStream.
SignedData ::= Sequence {
version CMSVersion,
digestAlgorithms DigestAlgorithmIdentifiers,
encapContentInfo EncapsulatedContentInfo,
certificates [0] IMPLICIT CertificateSet OPTIONAL,
crls [1] IMPLICIT CertificateRevocationLists OPTIONAL,
signerInfos SignerInfos
}
SignedData ::= SEQUENCE {
version CMSVersion,
digestAlgorithms DigestAlgorithmIdentifiers,
encapContentInfo EncapsulatedContentInfo,
certificates [0] IMPLICIT CertificateSet OPTIONAL,
crls [1] IMPLICIT CertificateRevocationLists OPTIONAL,
signerInfos SignerInfos
}
return a SignerIdentifier object from the given object.
@param o the object we want converted.
@exception ArgumentException if the object cannot be converted.
Produce an object suitable for an Asn1OutputStream.
SignerIdentifier ::= CHOICE {
issuerAndSerialNumber IssuerAndSerialNumber,
subjectKeyIdentifier [0] SubjectKeyIdentifier
}
SubjectKeyIdentifier ::= OCTET STRING
Produce an object suitable for an Asn1OutputStream.
SignerInfo ::= Sequence {
version Version,
SignerIdentifier sid,
digestAlgorithm DigestAlgorithmIdentifier,
authenticatedAttributes [0] IMPLICIT Attributes OPTIONAL,
digestEncryptionAlgorithm DigestEncryptionAlgorithmIdentifier,
encryptedDigest EncryptedDigest,
unauthenticatedAttributes [1] IMPLICIT Attributes OPTIONAL
}
EncryptedDigest ::= OCTET STRING
DigestAlgorithmIdentifier ::= AlgorithmIdentifier
DigestEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier
creates a time object from a given date - if the date is between 1950
and 2049 a UTCTime object is Generated, otherwise a GeneralizedTime
is used.
Produce an object suitable for an Asn1OutputStream.
Time ::= CHOICE {
utcTime UTCTime,
generalTime GeneralizedTime }
table of the available named parameters for GOST 3410-2001.
return the ECDomainParameters object for the given OID, null if it
isn't present.
@param oid an object identifier representing a named parameters, if present.
return the named curve name represented by the given object identifier.
returns an enumeration containing the name strings for curves
contained in this structure.
Gost28147-89-Parameters ::=
SEQUENCE {
iv Gost28147-89-IV,
encryptionParamSet OBJECT IDENTIFIER
}
Gost28147-89-IV ::= OCTET STRING (SIZE (8))
table of the available named parameters for GOST 3410-94.
return the GOST3410ParamSetParameters object for the given OID, null if it
isn't present.
@param oid an object identifier representing a named parameters, if present.
returns an enumeration containing the name strings for parameters
contained in this structure.
Der BMPString object.
return a BMP string from the given object.
@param obj the object we want converted.
@exception ArgumentException if the object cannot be converted.
return a BMP string from a tagged object.
@param obj the tagged object holding the object we want
@param explicitly true if the object is meant to be explicitly
tagged false otherwise.
@exception ArgumentException if the tagged object cannot
be converted.
basic constructor - byte encoded string.
basic constructor
return a bool from the passed in object.
@exception ArgumentException if the object cannot be converted.
return a DerBoolean from the passed in bool.
return a Boolean from a tagged object.
@param obj the tagged object holding the object we want
@param explicitly true if the object is meant to be explicitly
tagged false otherwise.
@exception ArgumentException if the tagged object cannot
be converted.
return an integer from the passed in object
@exception ArgumentException if the object cannot be converted.
return an Enumerated from a tagged object.
@param obj the tagged object holding the object we want
@param explicitly true if the object is meant to be explicitly
tagged false otherwise.
@exception ArgumentException if the tagged object cannot
be converted.
Class representing the DER-type External
Creates a new instance of DerExternal
See X.690 for more informations about the meaning of these parameters
@param directReference The direct reference or null
if not set.
@param indirectReference The indirect reference or null
if not set.
@param dataValueDescriptor The data value descriptor or null
if not set.
@param externalData The external data in its encoded form.
Creates a new instance of DerExternal.
See X.690 for more informations about the meaning of these parameters
@param directReference The direct reference or null
if not set.
@param indirectReference The indirect reference or null
if not set.
@param dataValueDescriptor The data value descriptor or null
if not set.
@param encoding The encoding to be used for the external data
@param externalData The external data
The encoding of the content. Valid values are
0
single-ASN1-type
1
OCTET STRING
2
BIT STRING
Generalized time object.
return a generalized time from the passed in object
@exception ArgumentException if the object cannot be converted.
return a Generalized Time object from a tagged object.
@param obj the tagged object holding the object we want
@param explicitly true if the object is meant to be explicitly
tagged false otherwise.
@exception ArgumentException if the tagged object cannot
be converted.
The correct format for this is YYYYMMDDHHMMSS[.f]Z, or without the Z
for local time, or Z+-HHMM on the end, for difference between local
time and UTC time. The fractional second amount f must consist of at
least one number with trailing zeroes removed.
@param time the time string.
@exception ArgumentException if string is an illegal format.
base constructor from a local time object
return the time - always in the form of
YYYYMMDDhhmmssGMT(+hh:mm|-hh:mm).
Normally in a certificate we would expect "Z" rather than "GMT",
however adding the "GMT" means we can just use:
dateF = new SimpleDateFormat("yyyyMMddHHmmssz");
To read in the time and Get a date which is compatible with our local
time zone.
Return the time.
@return The time string as it appeared in the encoded object.
Der IA5String object - this is an ascii string.
return a IA5 string from the passed in object
@exception ArgumentException if the object cannot be converted.
return an IA5 string from a tagged object.
@param obj the tagged object holding the object we want
@param explicitly true if the object is meant to be explicitly
tagged false otherwise.
@exception ArgumentException if the tagged object cannot
be converted.
basic constructor - with bytes.
basic constructor - without validation.
Constructor with optional validation.
@param string the base string to wrap.
@param validate whether or not to check the string.
@throws ArgumentException if validate is true and the string
contains characters that should not be in an IA5String.
return true if the passed in String can be represented without
loss as an IA5String, false otherwise.
@return true if in printable set, false otherwise.
return an integer from the passed in object
@exception ArgumentException if the object cannot be converted.
return an Integer from a tagged object.
@param obj the tagged object holding the object we want
@param isExplicit true if the object is meant to be explicitly
tagged false otherwise.
@exception ArgumentException if the tagged object cannot
be converted.
in some cases positive values Get crammed into a space,
that's not quite big enough...
Der NumericString object - this is an ascii string of characters {0,1,2,3,4,5,6,7,8,9, }.
return a Numeric string from the passed in object
@exception ArgumentException if the object cannot be converted.
return an Numeric string from a tagged object.
@param obj the tagged object holding the object we want
@param explicitly true if the object is meant to be explicitly
tagged false otherwise.
@exception ArgumentException if the tagged object cannot
be converted.
basic constructor - with bytes.
basic constructor - without validation..
Constructor with optional validation.
@param string the base string to wrap.
@param validate whether or not to check the string.
@throws ArgumentException if validate is true and the string
contains characters that should not be in a NumericString.
Return true if the string can be represented as a NumericString ('0'..'9', ' ')
@param str string to validate.
@return true if numeric, fale otherwise.
return an Oid from the passed in object
@exception ArgumentException if the object cannot be converted.
return an object Identifier from a tagged object.
@param obj the tagged object holding the object we want
@param explicitly true if the object is meant to be explicitly
tagged false otherwise.
@exception ArgumentException if the tagged object cannot
be converted.
Return true if this oid is an extension of the passed in branch, stem.
@param stem the arc or branch that is a possible parent.
@return true if the branch is on the passed in stem, false otherwise.
Der PrintableString object.
return a printable string from the passed in object.
@exception ArgumentException if the object cannot be converted.
return a Printable string from a tagged object.
@param obj the tagged object holding the object we want
@param explicitly true if the object is meant to be explicitly
tagged false otherwise.
@exception ArgumentException if the tagged object cannot
be converted.
basic constructor - byte encoded string.
basic constructor - this does not validate the string
Constructor with optional validation.
@param string the base string to wrap.
@param validate whether or not to check the string.
@throws ArgumentException if validate is true and the string
contains characters that should not be in a PrintableString.
return true if the passed in String can be represented without
loss as a PrintableString, false otherwise.
@return true if in printable set, false otherwise.
Der T61String (also the teletex string) - 8-bit characters
return a T61 string from the passed in object.
@exception ArgumentException if the object cannot be converted.
return an T61 string from a tagged object.
@param obj the tagged object holding the object we want
@param explicitly true if the object is meant to be explicitly
tagged false otherwise.
@exception ArgumentException if the tagged object cannot
be converted.
basic constructor - with bytes.
basic constructor - with string.
Der UniversalString object.
return a Universal string from the passed in object.
@exception ArgumentException if the object cannot be converted.
return a Universal string from a tagged object.
@param obj the tagged object holding the object we want
@param explicitly true if the object is meant to be explicitly
tagged false otherwise.
@exception ArgumentException if the tagged object cannot
be converted.
basic constructor - byte encoded string.
We insert one of these when we find a tag we don't recognise.
@param tag the tag value.
@param data the contents octets.
UTC time object.
return an UTC Time from the passed in object.
@exception ArgumentException if the object cannot be converted.
return an UTC Time from a tagged object.
@param obj the tagged object holding the object we want
@param explicitly true if the object is meant to be explicitly
tagged false otherwise.
@exception ArgumentException if the tagged object cannot
be converted.
The correct format for this is YYMMDDHHMMSSZ (it used to be that seconds were
never encoded. When you're creating one of these objects from scratch, that's
what you want to use, otherwise we'll try to deal with whatever Gets read from
the input stream... (this is why the input format is different from the GetTime()
method output).
@param time the time string.
base constructor from a DateTime object
return the time as a date based on whatever a 2 digit year will return. For
standardised processing use ToAdjustedDateTime().
@return the resulting date
@exception ParseException if the date string cannot be parsed.
return the time as an adjusted date
in the range of 1950 - 2049.
@return a date in the range of 1950 to 2049.
@exception ParseException if the date string cannot be parsed.
return the time - always in the form of
YYMMDDhhmmssGMT(+hh:mm|-hh:mm).
Normally in a certificate we would expect "Z" rather than "GMT",
however adding the "GMT" means we can just use:
dateF = new SimpleDateFormat("yyMMddHHmmssz");
To read in the time and Get a date which is compatible with our local
time zone.
Note: In some cases, due to the local date processing, this
may lead to unexpected results. If you want to stick the normal
convention of 1950 to 2049 use the GetAdjustedTime() method.
Return a time string as an adjusted date with a 4 digit year.
This goes in the range of 1950 - 2049.
Der UTF8String object.
return an UTF8 string from the passed in object.
@exception ArgumentException if the object cannot be converted.
return an UTF8 string from a tagged object.
@param obj the tagged object holding the object we want
@param explicitly true if the object is meant to be explicitly
tagged false otherwise.
@exception ArgumentException if the tagged object cannot
be converted.
basic constructor - byte encoded string.
basic constructor
Der VisibleString object.
return a Visible string from the passed in object.
@exception ArgumentException if the object cannot be converted.
return a Visible string from a tagged object.
@param obj the tagged object holding the object we want
@param explicitly true if the object is meant to be explicitly
tagged false otherwise.
@exception ArgumentException if the tagged object cannot
be converted.
basic constructor - byte encoded string.
basic constructor
RFC 3126: 4.3.1 Certificate Values Attribute Definition
CertificateValues ::= SEQUENCE OF Certificate
CommitmentTypeIndication ::= SEQUENCE {
commitmentTypeId CommitmentTypeIdentifier,
commitmentTypeQualifier SEQUENCE SIZE (1..MAX) OF
CommitmentTypeQualifier OPTIONAL }
Commitment type qualifiers, used in the Commitment-Type-Indication attribute (RFC3126).
CommitmentTypeQualifier ::= SEQUENCE {
commitmentTypeIdentifier CommitmentTypeIdentifier,
qualifier ANY DEFINED BY commitmentTypeIdentifier OPTIONAL }
Creates a new CommitmentTypeQualifier
instance.
@param commitmentTypeIdentifier a CommitmentTypeIdentifier
value
Creates a new CommitmentTypeQualifier
instance.
@param commitmentTypeIdentifier a CommitmentTypeIdentifier
value
@param qualifier the qualifier, defined by the above field.
Creates a new CommitmentTypeQualifier
instance.
@param as CommitmentTypeQualifier
structure
encoded as an Asn1Sequence.
Returns a DER-encodable representation of this instance.
@return a Asn1Object
value
RFC 3126: 4.2.1 Complete Certificate Refs Attribute Definition
CompleteCertificateRefs ::= SEQUENCE OF OtherCertID
RFC 3126: 4.2.2 Complete Revocation Refs Attribute Definition
CompleteRevocationRefs ::= SEQUENCE OF CrlOcspRef
RFC 3126: 4.2.2 Complete Revocation Refs Attribute Definition
CrlIdentifier ::= SEQUENCE
{
crlissuer Name,
crlIssuedTime UTCTime,
crlNumber INTEGER OPTIONAL
}
RFC 3126: 4.2.2 Complete Revocation Refs Attribute Definition
CRLListID ::= SEQUENCE
{
crls SEQUENCE OF CrlValidatedID
}
RFC 3126: 4.2.2 Complete Revocation Refs Attribute Definition
CrlOcspRef ::= SEQUENCE {
crlids [0] CRLListID OPTIONAL,
ocspids [1] OcspListID OPTIONAL,
otherRev [2] OtherRevRefs OPTIONAL
}
RFC 3126: 4.2.2 Complete Revocation Refs Attribute Definition
CrlValidatedID ::= SEQUENCE {
crlHash OtherHash,
crlIdentifier CrlIdentifier OPTIONAL}
RFC 3126: 4.2.2 Complete Revocation Refs Attribute Definition
OcspIdentifier ::= SEQUENCE {
ocspResponderID ResponderID,
-- As in OCSP response data
producedAt GeneralizedTime
-- As in OCSP response data
}
RFC 3126: 4.2.2 Complete Revocation Refs Attribute Definition
OcspListID ::= SEQUENCE {
ocspResponses SEQUENCE OF OcspResponsesID
}
RFC 3126: 4.2.2 Complete Revocation Refs Attribute Definition
OcspResponsesID ::= SEQUENCE {
ocspIdentifier OcspIdentifier,
ocspRepHash OtherHash OPTIONAL
}
OtherCertID ::= SEQUENCE {
otherCertHash OtherHash,
issuerSerial IssuerSerial OPTIONAL
}
OtherHash ::= CHOICE {
sha1Hash OtherHashValue, -- This contains a SHA-1 hash
otherHash OtherHashAlgAndValue
}
OtherHashValue ::= OCTET STRING
Summary description for OtherHashAlgAndValue.
OtherHashAlgAndValue ::= SEQUENCE {
hashAlgorithm AlgorithmIdentifier,
hashValue OtherHashValue
}
OtherHashValue ::= OCTET STRING
RFC 3126: 4.2.2 Complete Revocation Refs Attribute Definition
OtherRevRefs ::= SEQUENCE
{
otherRevRefType OtherRevRefType,
otherRevRefs ANY DEFINED BY otherRevRefType
}
OtherRevRefType ::= OBJECT IDENTIFIER
RFC 3126: 4.3.2 Revocation Values Attribute Definition
OtherRevVals ::= SEQUENCE
{
otherRevValType OtherRevValType,
otherRevVals ANY DEFINED BY otherRevValType
}
OtherRevValType ::= OBJECT IDENTIFIER
OtherSigningCertificate ::= SEQUENCE {
certs SEQUENCE OF OtherCertID,
policies SEQUENCE OF PolicyInformation OPTIONAL
}
RFC 5126: 6.3.4. revocation-values Attribute Definition
RevocationValues ::= SEQUENCE {
crlVals [0] SEQUENCE OF CertificateList OPTIONAL,
ocspVals [1] SEQUENCE OF BasicOCSPResponse OPTIONAL,
otherRevVals [2] OtherRevVals OPTIONAL
}
SignaturePolicyId ::= SEQUENCE {
sigPolicyIdentifier SigPolicyId,
sigPolicyHash SigPolicyHash,
sigPolicyQualifiers SEQUENCE SIZE (1..MAX) OF SigPolicyQualifierInfo OPTIONAL
}
SigPolicyId ::= OBJECT IDENTIFIER
SigPolicyHash ::= OtherHashAlgAndValue
SignaturePolicyIdentifier ::= CHOICE {
SignaturePolicyId SignaturePolicyId,
SignaturePolicyImplied SignaturePolicyImplied
}
SignaturePolicyImplied ::= NULL
SignerAttribute ::= SEQUENCE OF CHOICE {
claimedAttributes [0] ClaimedAttributes,
certifiedAttributes [1] CertifiedAttributes }
ClaimedAttributes ::= SEQUENCE OF Attribute
CertifiedAttributes ::= AttributeCertificate -- as defined in RFC 3281: see clause 4.1.
Signer-Location attribute (RFC3126).
SignerLocation ::= SEQUENCE {
countryName [0] DirectoryString OPTIONAL,
localityName [1] DirectoryString OPTIONAL,
postalAddress [2] PostalAddress OPTIONAL }
PostalAddress ::= SEQUENCE SIZE(1..6) OF DirectoryString
SignerLocation ::= SEQUENCE {
countryName [0] DirectoryString OPTIONAL,
localityName [1] DirectoryString OPTIONAL,
postalAddress [2] PostalAddress OPTIONAL }
PostalAddress ::= SEQUENCE SIZE(1..6) OF DirectoryString
DirectoryString ::= CHOICE {
teletexString TeletexString (SIZE (1..MAX)),
printableString PrintableString (SIZE (1..MAX)),
universalString UniversalString (SIZE (1..MAX)),
utf8String UTF8String (SIZE (1.. MAX)),
bmpString BMPString (SIZE (1..MAX)) }
SigPolicyQualifierInfo ::= SEQUENCE {
sigPolicyQualifierId SigPolicyQualifierId,
sigQualifier ANY DEFINED BY sigPolicyQualifierId
}
SigPolicyQualifierId ::= OBJECT IDENTIFIER
constructor
ContentHints ::= SEQUENCE {
contentDescription UTF8String (SIZE (1..MAX)) OPTIONAL,
contentType ContentType }
Create from OCTET STRING whose octets represent the identifier.
Create from byte array representing the identifier.
The definition of ContentIdentifier is
ContentIdentifier ::= OCTET STRING
id-aa-contentIdentifier OBJECT IDENTIFIER ::= { iso(1)
member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs9(9)
smime(16) id-aa(2) 7 }
constructor
EssCertID ::= SEQUENCE {
certHash Hash,
issuerSerial IssuerSerial OPTIONAL }
EssCertIDv2 ::= SEQUENCE {
hashAlgorithm AlgorithmIdentifier
DEFAULT {algorithm id-sha256},
certHash Hash,
issuerSerial IssuerSerial OPTIONAL
}
Hash ::= OCTET STRING
IssuerSerial ::= SEQUENCE {
issuer GeneralNames,
serialNumber CertificateSerialNumber
}
constructor
OtherCertID ::= SEQUENCE {
otherCertHash OtherHash,
issuerSerial IssuerSerial OPTIONAL }
OtherHash ::= CHOICE {
sha1Hash OCTET STRING,
otherHash OtherHashAlgAndValue }
OtherHashAlgAndValue ::= SEQUENCE {
hashAlgorithm AlgorithmIdentifier,
hashValue OCTET STRING }
constructors
The definition of OtherSigningCertificate is
OtherSigningCertificate ::= SEQUENCE {
certs SEQUENCE OF OtherCertID,
policies SEQUENCE OF PolicyInformation OPTIONAL
}
id-aa-ets-otherSigCert OBJECT IDENTIFIER ::= { iso(1)
member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs9(9)
smime(16) id-aa(2) 19 }
constructors
The definition of SigningCertificate is
SigningCertificate ::= SEQUENCE {
certs SEQUENCE OF EssCertID,
policies SEQUENCE OF PolicyInformation OPTIONAL
}
id-aa-signingCertificate OBJECT IDENTIFIER ::= { iso(1)
member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs9(9)
smime(16) id-aa(2) 12 }
The definition of SigningCertificateV2 is
SigningCertificateV2 ::= SEQUENCE {
certs SEQUENCE OF EssCertIDv2,
policies SEQUENCE OF PolicyInformation OPTIONAL
}
id-aa-signingCertificateV2 OBJECT IDENTIFIER ::= { iso(1)
member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs9(9)
smime(16) id-aa(2) 47 }
The DataGroupHash object.
DataGroupHash ::= SEQUENCE {
dataGroupNumber DataGroupNumber,
dataGroupHashValue OCTET STRING }
DataGroupNumber ::= INTEGER {
dataGroup1 (1),
dataGroup1 (2),
dataGroup1 (3),
dataGroup1 (4),
dataGroup1 (5),
dataGroup1 (6),
dataGroup1 (7),
dataGroup1 (8),
dataGroup1 (9),
dataGroup1 (10),
dataGroup1 (11),
dataGroup1 (12),
dataGroup1 (13),
dataGroup1 (14),
dataGroup1 (15),
dataGroup1 (16) }
The LDSSecurityObject object (V1.8).
LDSSecurityObject ::= SEQUENCE {
version LDSSecurityObjectVersion,
hashAlgorithm DigestAlgorithmIdentifier,
dataGroupHashValues SEQUENCE SIZE (2..ub-DataGroups) OF DataHashGroup,
ldsVersionInfo LDSVersionInfo OPTIONAL
-- if present, version MUST be v1 }
DigestAlgorithmIdentifier ::= AlgorithmIdentifier,
LDSSecurityObjectVersion :: INTEGER {V0(0)}
The id-isismtt-cp-accredited OID indicates that the certificate is a
qualified certificate according to Directive 1999/93/EC of the European
Parliament and of the Council of 13 December 1999 on a Community
Framework for Electronic Signatures, which additionally conforms the
special requirements of the SigG and has been issued by an accredited CA.
Certificate extensionDate of certificate generation
DateOfCertGenSyntax ::= GeneralizedTime
Attribute to indicate that the certificate holder may sign in the name of
a third person. May also be used as extension in a certificate.
Attribute to indicate admissions to certain professions. May be used as
attribute in attribute certificate or as extension in a certificate
Monetary limit for transactions. The QcEuMonetaryLimit QC statement MUST
be used in new certificates in place of the extension/attribute
MonetaryLimit since January 1, 2004. For the sake of backward
compatibility with certificates already in use, SigG conforming
components MUST support MonetaryLimit (as well as QcEuLimitValue).
A declaration of majority. May be used as attribute in attribute
certificate or as extension in a certificate
Serial number of the smart card containing the corresponding private key
ICCSNSyntax ::= OCTET STRING (SIZE(8..20))
Reference for a file of a smartcard that stores the public key of this
certificate and that is used as �security anchor�.
PKReferenceSyntax ::= OCTET STRING (SIZE(20))
Some other restriction regarding the usage of this certificate. May be
used as attribute in attribute certificate or as extension in a
certificate.
RestrictionSyntax ::= DirectoryString (SIZE(1..1024))
@see Org.BouncyCastle.Asn1.IsisMtt.X509.Restriction
(Single)Request extension: Clients may include this extension in a
(single) Request to request the responder to send the certificate in the
response message along with the status information. Besides the LDAP
service, this extension provides another mechanism for the distribution
of certificates, which MAY optionally be provided by certificate
repositories.
RetrieveIfAllowed ::= BOOLEAN
SingleOCSPResponse extension: The certificate requested by the client by
inserting the RetrieveIfAllowed extension in the request, will be
returned in this extension.
@see Org.BouncyCastle.Asn1.IsisMtt.Ocsp.RequestedCertificate
Base ObjectIdentifier for naming authorities
SingleOCSPResponse extension: Date, when certificate has been published
in the directory and status information has become available. Currently,
accrediting authorities enforce that SigG-conforming OCSP servers include
this extension in the responses.
CertInDirSince ::= GeneralizedTime
Hash of a certificate in OCSP.
@see Org.BouncyCastle.Asn1.IsisMtt.Ocsp.CertHash
NameAtBirth ::= DirectoryString(SIZE(1..64)
Used in
{@link Org.BouncyCastle.Asn1.X509.SubjectDirectoryAttributes SubjectDirectoryAttributes}
Some other information of non-restrictive nature regarding the usage of
this certificate. May be used as attribute in atribute certificate or as
extension in a certificate.
AdditionalInformationSyntax ::= DirectoryString (SIZE(1..2048))
@see Org.BouncyCastle.Asn1.IsisMtt.X509.AdditionalInformationSyntax
Indicates that an attribute certificate exists, which limits the
usability of this public key certificate. Whenever verifying a signature
with the help of this certificate, the content of the corresponding
attribute certificate should be concerned. This extension MUST be
included in a PKC, if a corresponding attribute certificate (having the
PKC as base certificate) contains some attribute that restricts the
usability of the PKC too. Attribute certificates with restricting content
MUST always be included in the signed document.
LiabilityLimitationFlagSyntax ::= BOOLEAN
ISIS-MTT PROFILE: The responder may include this extension in a response to
send the hash of the requested certificate to the responder. This hash is
cryptographically bound to the certificate and serves as evidence that the
certificate is known to the responder (i.e. it has been issued and is present
in the directory). Hence, this extension is a means to provide a positive
statement of availability as described in T8.[8]. As explained in T13.[1],
clients may rely on this information to be able to validate signatures after
the expiry of the corresponding certificate. Hence, clients MUST support this
extension. If a positive statement of availability is to be delivered, this
extension syntax and OID MUST be used.
CertHash ::= SEQUENCE {
hashAlgorithm AlgorithmIdentifier,
certificateHash OCTET STRING
}
Constructor from Asn1Sequence.
The sequence is of type CertHash:
CertHash ::= SEQUENCE {
hashAlgorithm AlgorithmIdentifier,
certificateHash OCTET STRING
}
@param seq The ASN.1 sequence.
Constructor from a given details.
@param hashAlgorithm The hash algorithm identifier.
@param certificateHash The hash of the whole DER encoding of the certificate.
Produce an object suitable for an Asn1OutputStream.
Returns:
CertHash ::= SEQUENCE {
hashAlgorithm AlgorithmIdentifier,
certificateHash OCTET STRING
}
@return an Asn1Object
ISIS-MTT-Optional: The certificate requested by the client by inserting the
RetrieveIfAllowed extension in the request, will be returned in this
extension.
ISIS-MTT-SigG: The signature act allows publishing certificates only then,
when the certificate owner gives his isExplicit permission. Accordingly, there
may be �nondownloadable� certificates, about which the responder must provide
status information, but MUST NOT include them in the response. Clients may
get therefore the following three kind of answers on a single request
including the RetrieveIfAllowed extension:
- a) the responder supports the extension and is allowed to publish the
certificate: RequestedCertificate returned including the requested
certificate
- b) the responder supports the extension but is NOT allowed to publish
the certificate: RequestedCertificate returned including an empty OCTET
STRING
- c) the responder does not support the extension: RequestedCertificate is
not included in the response
Clients requesting RetrieveIfAllowed MUST be able to handle these cases. If
any of the OCTET STRING options is used, it MUST contain the DER encoding of
the requested certificate.
RequestedCertificate ::= CHOICE {
Certificate Certificate,
publicKeyCertificate [0] EXPLICIT OCTET STRING,
attributeCertificate [1] EXPLICIT OCTET STRING
}
Constructor from a given details.
Only one parameter can be given. All other must be null
.
@param certificate Given as Certificate
Produce an object suitable for an Asn1OutputStream.
Returns:
RequestedCertificate ::= CHOICE {
Certificate Certificate,
publicKeyCertificate [0] EXPLICIT OCTET STRING,
attributeCertificate [1] EXPLICIT OCTET STRING
}
@return an Asn1Object
Some other information of non-restrictive nature regarding the usage of this
certificate.
AdditionalInformationSyntax ::= DirectoryString (SIZE(1..2048))
Constructor from a given details.
@param information The describtion of the information.
Produce an object suitable for an Asn1OutputStream.
Returns:
AdditionalInformationSyntax ::= DirectoryString (SIZE(1..2048))
@return an Asn1Object
An Admissions structure.
Admissions ::= SEQUENCE
{
admissionAuthority [0] EXPLICIT GeneralName OPTIONAL
namingAuthority [1] EXPLICIT NamingAuthority OPTIONAL
professionInfos SEQUENCE OF ProfessionInfo
}
@see Org.BouncyCastle.Asn1.IsisMtt.X509.AdmissionSyntax
@see Org.BouncyCastle.Asn1.IsisMtt.X509.ProfessionInfo
@see Org.BouncyCastle.Asn1.IsisMtt.X509.NamingAuthority
Constructor from Asn1Sequence.
The sequence is of type ProcurationSyntax:
Admissions ::= SEQUENCE
{
admissionAuthority [0] EXPLICIT GeneralName OPTIONAL
namingAuthority [1] EXPLICIT NamingAuthority OPTIONAL
professionInfos SEQUENCE OF ProfessionInfo
}
@param seq The ASN.1 sequence.
Constructor from a given details.
Parameter professionInfos
is mandatory.
@param admissionAuthority The admission authority.
@param namingAuthority The naming authority.
@param professionInfos The profession infos.
Produce an object suitable for an Asn1OutputStream.
Returns:
Admissions ::= SEQUENCE
{
admissionAuthority [0] EXPLICIT GeneralName OPTIONAL
namingAuthority [1] EXPLICIT NamingAuthority OPTIONAL
professionInfos SEQUENCE OF ProfessionInfo
}
@return an Asn1Object
Attribute to indicate admissions to certain professions.
AdmissionSyntax ::= SEQUENCE
{
admissionAuthority GeneralName OPTIONAL,
contentsOfAdmissions SEQUENCE OF Admissions
}
Admissions ::= SEQUENCE
{
admissionAuthority [0] EXPLICIT GeneralName OPTIONAL
namingAuthority [1] EXPLICIT NamingAuthority OPTIONAL
professionInfos SEQUENCE OF ProfessionInfo
}
NamingAuthority ::= SEQUENCE
{
namingAuthorityId OBJECT IDENTIFIER OPTIONAL,
namingAuthorityUrl IA5String OPTIONAL,
namingAuthorityText DirectoryString(SIZE(1..128)) OPTIONAL
}
ProfessionInfo ::= SEQUENCE
{
namingAuthority [0] EXPLICIT NamingAuthority OPTIONAL,
professionItems SEQUENCE OF DirectoryString (SIZE(1..128)),
professionOIDs SEQUENCE OF OBJECT IDENTIFIER OPTIONAL,
registrationNumber PrintableString(SIZE(1..128)) OPTIONAL,
addProfessionInfo OCTET STRING OPTIONAL
}
ISIS-MTT PROFILE: The relatively complex structure of AdmissionSyntax
supports the following concepts and requirements:
- External institutions (e.g. professional associations, chambers, unions,
administrative bodies, companies, etc.), which are responsible for granting
and verifying professional admissions, are indicated by means of the data
field admissionAuthority. An admission authority is indicated by a
GeneralName object. Here an X.501 directory name (distinguished name) can be
indicated in the field directoryName, a URL address can be indicated in the
field uniformResourceIdentifier, and an object identifier can be indicated in
the field registeredId.
- The names of authorities which are responsible for the administration of
title registers are indicated in the data field namingAuthority. The name of
the authority can be identified by an object identifier in the field
namingAuthorityId, by means of a text string in the field
namingAuthorityText, by means of a URL address in the field
namingAuthorityUrl, or by a combination of them. For example, the text string
can contain the name of the authority, the country and the name of the title
register. The URL-option refers to a web page which contains lists with
�officially� registered professions (text and possibly OID) as well as
further information on these professions. Object identifiers for the
component namingAuthorityId are grouped under the OID-branch
id-isis-at-namingAuthorities and must be applied for.
- See http://www.teletrust.de/anwend.asp?Id=30200&Sprache=E_&HomePG=0
for an application form and http://www.teletrust.de/links.asp?id=30220,11
for an overview of registered naming authorities.
- By means of the data type ProfessionInfo certain professions,
specializations, disciplines, fields of activity, etc. are identified. A
profession is represented by one or more text strings, resp. profession OIDs
in the fields professionItems and professionOIDs and by a registration number
in the field registrationNumber. An indication in text form must always be
present, whereas the other indications are optional. The component
addProfessionInfo may contain additional applicationspecific information in
DER-encoded form.
By means of different namingAuthority-OIDs or profession OIDs hierarchies of
professions, specializations, disciplines, fields of activity, etc. can be
expressed. The issuing admission authority should always be indicated (field
admissionAuthority), whenever a registration number is presented. Still,
information on admissions can be given without indicating an admission or a
naming authority by the exclusive use of the component professionItems. In
this case the certification authority is responsible for the verification of
the admission information.
This attribute is single-valued. Still, several admissions can be captured in
the sequence structure of the component contentsOfAdmissions of
AdmissionSyntax or in the component professionInfos of Admissions. The
component admissionAuthority of AdmissionSyntax serves as default value for
the component admissionAuthority of Admissions. Within the latter component
the default value can be overwritten, in case that another authority is
responsible. The component namingAuthority of Admissions serves as a default
value for the component namingAuthority of ProfessionInfo. Within the latter
component the default value can be overwritten, in case that another naming
authority needs to be recorded.
The length of the string objects is limited to 128 characters. It is
recommended to indicate a namingAuthorityURL in all issued attribute
certificates. If a namingAuthorityURL is indicated, the field professionItems
of ProfessionInfo should contain only registered titles. If the field
professionOIDs exists, it has to contain the OIDs of the professions listed
in professionItems in the same order. In general, the field professionInfos
should contain only one entry, unless the admissions that are to be listed
are logically connected (e.g. they have been issued under the same admission
number).
@see Org.BouncyCastle.Asn1.IsisMtt.X509.Admissions
@see Org.BouncyCastle.Asn1.IsisMtt.X509.ProfessionInfo
@see Org.BouncyCastle.Asn1.IsisMtt.X509.NamingAuthority
Constructor from Asn1Sequence.
The sequence is of type ProcurationSyntax:
AdmissionSyntax ::= SEQUENCE
{
admissionAuthority GeneralName OPTIONAL,
contentsOfAdmissions SEQUENCE OF Admissions
}
Admissions ::= SEQUENCE
{
admissionAuthority [0] EXPLICIT GeneralName OPTIONAL
namingAuthority [1] EXPLICIT NamingAuthority OPTIONAL
professionInfos SEQUENCE OF ProfessionInfo
}
NamingAuthority ::= SEQUENCE
{
namingAuthorityId OBJECT IDENTIFIER OPTIONAL,
namingAuthorityUrl IA5String OPTIONAL,
namingAuthorityText DirectoryString(SIZE(1..128)) OPTIONAL
}
ProfessionInfo ::= SEQUENCE
{
namingAuthority [0] EXPLICIT NamingAuthority OPTIONAL,
professionItems SEQUENCE OF DirectoryString (SIZE(1..128)),
professionOIDs SEQUENCE OF OBJECT IDENTIFIER OPTIONAL,
registrationNumber PrintableString(SIZE(1..128)) OPTIONAL,
addProfessionInfo OCTET STRING OPTIONAL
}
@param seq The ASN.1 sequence.
Constructor from given details.
@param admissionAuthority The admission authority.
@param contentsOfAdmissions The admissions.
Produce an object suitable for an Asn1OutputStream.
Returns:
AdmissionSyntax ::= SEQUENCE
{
admissionAuthority GeneralName OPTIONAL,
contentsOfAdmissions SEQUENCE OF Admissions
}
Admissions ::= SEQUENCE
{
admissionAuthority [0] EXPLICIT GeneralName OPTIONAL
namingAuthority [1] EXPLICIT NamingAuthority OPTIONAL
professionInfos SEQUENCE OF ProfessionInfo
}
NamingAuthority ::= SEQUENCE
{
namingAuthorityId OBJECT IDENTIFIER OPTIONAL,
namingAuthorityUrl IA5String OPTIONAL,
namingAuthorityText DirectoryString(SIZE(1..128)) OPTIONAL
}
ProfessionInfo ::= SEQUENCE
{
namingAuthority [0] EXPLICIT NamingAuthority OPTIONAL,
professionItems SEQUENCE OF DirectoryString (SIZE(1..128)),
professionOIDs SEQUENCE OF OBJECT IDENTIFIER OPTIONAL,
registrationNumber PrintableString(SIZE(1..128)) OPTIONAL,
addProfessionInfo OCTET STRING OPTIONAL
}
@return an Asn1Object
@return Returns the contentsOfAdmissions.
@return Returns the admissionAuthority if present, null otherwise.
A declaration of majority.
DeclarationOfMajoritySyntax ::= CHOICE
{
notYoungerThan [0] IMPLICIT INTEGER,
fullAgeAtCountry [1] IMPLICIT SEQUENCE
{
fullAge BOOLEAN DEFAULT TRUE,
country PrintableString (SIZE(2))
}
dateOfBirth [2] IMPLICIT GeneralizedTime
}
fullAgeAtCountry indicates the majority of the owner with respect to the laws
of a specific country.
Produce an object suitable for an Asn1OutputStream.
Returns:
DeclarationOfMajoritySyntax ::= CHOICE
{
notYoungerThan [0] IMPLICIT INTEGER,
fullAgeAtCountry [1] IMPLICIT SEQUENCE
{
fullAge BOOLEAN DEFAULT TRUE,
country PrintableString (SIZE(2))
}
dateOfBirth [2] IMPLICIT GeneralizedTime
}
@return an Asn1Object
@return notYoungerThan if that's what we are, -1 otherwise
Monetary limit for transactions. The QcEuMonetaryLimit QC statement MUST be
used in new certificates in place of the extension/attribute MonetaryLimit
since January 1, 2004. For the sake of backward compatibility with
certificates already in use, components SHOULD support MonetaryLimit (as well
as QcEuLimitValue).
Indicates a monetary limit within which the certificate holder is authorized
to act. (This value DOES NOT express a limit on the liability of the
certification authority).
MonetaryLimitSyntax ::= SEQUENCE
{
currency PrintableString (SIZE(3)),
amount INTEGER,
exponent INTEGER
}
currency must be the ISO code.
value = amount�10*exponent
Constructor from a given details.
value = amount�10^exponent
@param currency The currency. Must be the ISO code.
@param amount The amount
@param exponent The exponent
Produce an object suitable for an Asn1OutputStream.
Returns:
MonetaryLimitSyntax ::= SEQUENCE
{
currency PrintableString (SIZE(3)),
amount INTEGER,
exponent INTEGER
}
@return an Asn1Object
Names of authorities which are responsible for the administration of title
registers.
NamingAuthority ::= SEQUENCE
{
namingAuthorityID OBJECT IDENTIFIER OPTIONAL,
namingAuthorityUrl IA5String OPTIONAL,
namingAuthorityText DirectoryString(SIZE(1..128)) OPTIONAL
}
@see Org.BouncyCastle.Asn1.IsisMtt.X509.AdmissionSyntax
Profession OIDs should always be defined under the OID branch of the
responsible naming authority. At the time of this writing, the work group
�Recht, Wirtschaft, Steuern� (�Law, Economy, Taxes�) is registered as the
first naming authority under the OID id-isismtt-at-namingAuthorities.
Constructor from Asn1Sequence.
NamingAuthority ::= SEQUENCE
{
namingAuthorityID OBJECT IDENTIFIER OPTIONAL,
namingAuthorityUrl IA5String OPTIONAL,
namingAuthorityText DirectoryString(SIZE(1..128)) OPTIONAL
}
@param seq The ASN.1 sequence.
Constructor from given details.
All parameters can be combined.
@param namingAuthorityID ObjectIdentifier for naming authority.
@param namingAuthorityUrl URL for naming authority.
@param namingAuthorityText Textual representation of naming authority.
Produce an object suitable for an Asn1OutputStream.
Returns:
NamingAuthority ::= SEQUENCE
{
namingAuthorityID OBJECT IDENTIFIER OPTIONAL,
namingAuthorityUrl IA5String OPTIONAL,
namingAuthorityText DirectoryString(SIZE(1..128)) OPTIONAL
}
@return an Asn1Object
@return Returns the namingAuthorityID.
@return Returns the namingAuthorityText.
@return Returns the namingAuthorityUrl.
Attribute to indicate that the certificate holder may sign in the name of a
third person.
ISIS-MTT PROFILE: The corresponding ProcurationSyntax contains either the
name of the person who is represented (subcomponent thirdPerson) or a
reference to his/her base certificate (in the component signingFor,
subcomponent certRef), furthermore the optional components country and
typeSubstitution to indicate the country whose laws apply, and respectively
the type of procuration (e.g. manager, procuration, custody).
ISIS-MTT PROFILE: The GeneralName MUST be of type directoryName and MAY only
contain: - RFC3039 attributes, except pseudonym (countryName, commonName,
surname, givenName, serialNumber, organizationName, organizationalUnitName,
stateOrProvincename, localityName, postalAddress) and - SubjectDirectoryName
attributes (title, dateOfBirth, placeOfBirth, gender, countryOfCitizenship,
countryOfResidence and NameAtBirth).
ProcurationSyntax ::= SEQUENCE {
country [1] EXPLICIT PrintableString(SIZE(2)) OPTIONAL,
typeOfSubstitution [2] EXPLICIT DirectoryString (SIZE(1..128)) OPTIONAL,
signingFor [3] EXPLICIT SigningFor
}
SigningFor ::= CHOICE
{
thirdPerson GeneralName,
certRef IssuerSerial
}
Constructor from Asn1Sequence.
The sequence is of type ProcurationSyntax:
ProcurationSyntax ::= SEQUENCE {
country [1] EXPLICIT PrintableString(SIZE(2)) OPTIONAL,
typeOfSubstitution [2] EXPLICIT DirectoryString (SIZE(1..128)) OPTIONAL,
signingFor [3] EXPLICIT SigningFor
}
SigningFor ::= CHOICE
{
thirdPerson GeneralName,
certRef IssuerSerial
}
@param seq The ASN.1 sequence.
Constructor from a given details.
Either generalName
or certRef
MUST be
null
.
@param country The country code whose laws apply.
@param typeOfSubstitution The type of procuration.
@param certRef Reference to certificate of the person who is represented.
Constructor from a given details.
Either generalName
or certRef
MUST be
null
.
@param country The country code whose laws apply.
@param typeOfSubstitution The type of procuration.
@param thirdPerson The GeneralName of the person who is represented.
Produce an object suitable for an Asn1OutputStream.
Returns:
ProcurationSyntax ::= SEQUENCE {
country [1] EXPLICIT PrintableString(SIZE(2)) OPTIONAL,
typeOfSubstitution [2] EXPLICIT DirectoryString (SIZE(1..128)) OPTIONAL,
signingFor [3] EXPLICIT SigningFor
}
SigningFor ::= CHOICE
{
thirdPerson GeneralName,
certRef IssuerSerial
}
@return an Asn1Object
Professions, specializations, disciplines, fields of activity, etc.
ProfessionInfo ::= SEQUENCE
{
namingAuthority [0] EXPLICIT NamingAuthority OPTIONAL,
professionItems SEQUENCE OF DirectoryString (SIZE(1..128)),
professionOids SEQUENCE OF OBJECT IDENTIFIER OPTIONAL,
registrationNumber PrintableString(SIZE(1..128)) OPTIONAL,
addProfessionInfo OCTET STRING OPTIONAL
}
@see Org.BouncyCastle.Asn1.IsisMtt.X509.AdmissionSyntax
Rechtsanw�ltin
Rechtsanwalt
Rechtsbeistand
Steuerberaterin
Steuerberater
Steuerbevollm�chtigte
Steuerbevollm�chtigter
Notarin
Notar
Notarvertreterin
Notarvertreter
Notariatsverwalterin
Notariatsverwalter
Wirtschaftspr�ferin
Wirtschaftspr�fer
Vereidigte Buchpr�ferin
Vereidigter Buchpr�fer
Patentanw�ltin
Patentanwalt
Constructor from Asn1Sequence.
ProfessionInfo ::= SEQUENCE
{
namingAuthority [0] EXPLICIT NamingAuthority OPTIONAL,
professionItems SEQUENCE OF DirectoryString (SIZE(1..128)),
professionOids SEQUENCE OF OBJECT IDENTIFIER OPTIONAL,
registrationNumber PrintableString(SIZE(1..128)) OPTIONAL,
addProfessionInfo OCTET STRING OPTIONAL
}
@param seq The ASN.1 sequence.
Constructor from given details.
professionItems
is mandatory, all other parameters are
optional.
@param namingAuthority The naming authority.
@param professionItems Directory strings of the profession.
@param professionOids DERObjectIdentfier objects for the
profession.
@param registrationNumber Registration number.
@param addProfessionInfo Additional infos in encoded form.
Produce an object suitable for an Asn1OutputStream.
Returns:
ProfessionInfo ::= SEQUENCE
{
namingAuthority [0] EXPLICIT NamingAuthority OPTIONAL,
professionItems SEQUENCE OF DirectoryString (SIZE(1..128)),
professionOids SEQUENCE OF OBJECT IDENTIFIER OPTIONAL,
registrationNumber PrintableString(SIZE(1..128)) OPTIONAL,
addProfessionInfo OCTET STRING OPTIONAL
}
@return an Asn1Object
@return Returns the professionItems.
@return Returns the professionOids.
@return Returns the addProfessionInfo.
@return Returns the namingAuthority.
@return Returns the registrationNumber.
Some other restriction regarding the usage of this certificate.
RestrictionSyntax ::= DirectoryString (SIZE(1..1024))
Constructor from DirectoryString.
The DirectoryString is of type RestrictionSyntax:
RestrictionSyntax ::= DirectoryString (SIZE(1..1024))
@param restriction A IAsn1String.
Constructor from a given details.
@param restriction The description of the restriction.
Produce an object suitable for an Asn1OutputStream.
Returns:
RestrictionSyntax ::= DirectoryString (SIZE(1..1024))
@return an Asn1Object
Produce an object suitable for an Asn1OutputStream.
cast5CBCParameters ::= Sequence {
iv OCTET STRING DEFAULT 0,
-- Initialization vector
keyLength Integer
-- Key length, in bits
}
Produce an object suitable for an Asn1OutputStream.
IDEA-CBCPar ::= Sequence {
iv OCTET STRING OPTIONAL -- exactly 8 octets
}
The NetscapeCertType object.
NetscapeCertType ::= BIT STRING {
SSLClient (0),
SSLServer (1),
S/MIME (2),
Object Signing (3),
Reserved (4),
SSL CA (5),
S/MIME CA (6),
Object Signing CA (7) }
Basic constructor.
@param usage - the bitwise OR of the Key Usage flags giving the
allowed uses for the key.
e.g. (X509NetscapeCertType.sslCA | X509NetscapeCertType.smimeCA)
This is designed to parse
the PublicKeyAndChallenge created by the KEYGEN tag included by
Mozilla based browsers.
PublicKeyAndChallenge ::= SEQUENCE {
spki SubjectPublicKeyInfo,
challenge IA5STRING
}
Utility class for fetching curves using their NIST names as published in FIPS-PUB 186-3
return the X9ECParameters object for the named curve represented by
the passed in object identifier. Null if the curve isn't present.
@param oid an object identifier representing a named curve, if present.
return the object identifier signified by the passed in name. Null
if there is no object identifier associated with name.
@return the object identifier associated with name, if present.
return the named curve name represented by the given object identifier.
returns an enumeration containing the name strings for curves
contained in this structure.
From RFC 3657
Produce an object suitable for an Asn1OutputStream.
BasicOcspResponse ::= Sequence {
tbsResponseData ResponseData,
signatureAlgorithm AlgorithmIdentifier,
signature BIT STRING,
certs [0] EXPLICIT Sequence OF Certificate OPTIONAL }
Produce an object suitable for an Asn1OutputStream.
CertID ::= Sequence {
hashAlgorithm AlgorithmIdentifier,
issuerNameHash OCTET STRING, -- Hash of Issuer's DN
issuerKeyHash OCTET STRING, -- Hash of Issuers public key
serialNumber CertificateSerialNumber }
create a CertStatus object with a tag of zero.
Produce an object suitable for an Asn1OutputStream.
CertStatus ::= CHOICE {
good [0] IMPLICIT Null,
revoked [1] IMPLICIT RevokedInfo,
unknown [2] IMPLICIT UnknownInfo }
Produce an object suitable for an Asn1OutputStream.
CrlID ::= Sequence {
crlUrl [0] EXPLICIT IA5String OPTIONAL,
crlNum [1] EXPLICIT Integer OPTIONAL,
crlTime [2] EXPLICIT GeneralizedTime OPTIONAL }
Produce an object suitable for an Asn1OutputStream.
OcspRequest ::= Sequence {
tbsRequest TBSRequest,
optionalSignature [0] EXPLICIT Signature OPTIONAL }
Produce an object suitable for an Asn1OutputStream.
OcspResponse ::= Sequence {
responseStatus OcspResponseStatus,
responseBytes [0] EXPLICIT ResponseBytes OPTIONAL }
The OcspResponseStatus enumeration.
OcspResponseStatus ::= Enumerated {
successful (0), --Response has valid confirmations
malformedRequest (1), --Illegal confirmation request
internalError (2), --Internal error in issuer
tryLater (3), --Try again later
--(4) is not used
sigRequired (5), --Must sign the request
unauthorized (6) --Request unauthorized
}
Produce an object suitable for an Asn1OutputStream.
Request ::= Sequence {
reqCert CertID,
singleRequestExtensions [0] EXPLICIT Extensions OPTIONAL }
Produce an object suitable for an Asn1OutputStream.
ResponderID ::= CHOICE {
byName [1] Name,
byKey [2] KeyHash }
Produce an object suitable for an Asn1OutputStream.
ResponseBytes ::= Sequence {
responseType OBJECT IDENTIFIER,
response OCTET STRING }
Produce an object suitable for an Asn1OutputStream.
ResponseData ::= Sequence {
version [0] EXPLICIT Version DEFAULT v1,
responderID ResponderID,
producedAt GeneralizedTime,
responses Sequence OF SingleResponse,
responseExtensions [1] EXPLICIT Extensions OPTIONAL }
Produce an object suitable for an Asn1OutputStream.
RevokedInfo ::= Sequence {
revocationTime GeneralizedTime,
revocationReason [0] EXPLICIT CRLReason OPTIONAL }
Produce an object suitable for an Asn1OutputStream.
ServiceLocator ::= Sequence {
issuer Name,
locator AuthorityInfoAccessSyntax OPTIONAL }
Produce an object suitable for an Asn1OutputStream.
Signature ::= Sequence {
signatureAlgorithm AlgorithmIdentifier,
signature BIT STRING,
certs [0] EXPLICIT Sequence OF Certificate OPTIONAL}
Produce an object suitable for an Asn1OutputStream.
SingleResponse ::= Sequence {
certID CertID,
certStatus CertStatus,
thisUpdate GeneralizedTime,
nextUpdate [0] EXPLICIT GeneralizedTime OPTIONAL,
singleExtensions [1] EXPLICIT Extensions OPTIONAL }
Produce an object suitable for an Asn1OutputStream.
TBSRequest ::= Sequence {
version [0] EXPLICIT Version DEFAULT v1,
requestorName [1] EXPLICIT GeneralName OPTIONAL,
requestList Sequence OF Request,
requestExtensions [2] EXPLICIT Extensions OPTIONAL }
class for breaking up an Oid into it's component tokens, ala
java.util.StringTokenizer. We need this class as some of the
lightweight Java environment don't support classes like
StringTokenizer.
return an Attribute object from the given object.
@param o the object we want converted.
@exception ArgumentException if the object cannot be converted.
Produce an object suitable for an Asn1OutputStream.
Attr ::= Sequence {
attrType OBJECT IDENTIFIER,
attrValues Set OF AttributeValue
}
Pkcs10 Certfication request object.
CertificationRequest ::= Sequence {
certificationRequestInfo CertificationRequestInfo,
signatureAlgorithm AlgorithmIdentifier{{ SignatureAlgorithms }},
signature BIT STRING
}
Pkcs10 CertificationRequestInfo object.
CertificationRequestInfo ::= Sequence {
version Integer { v1(0) } (v1,...),
subject Name,
subjectPKInfo SubjectPublicKeyInfo{{ PKInfoAlgorithms }},
attributes [0] Attributes{{ CRIAttributes }}
}
Attributes { ATTRIBUTE:IOSet } ::= Set OF Attr{{ IOSet }}
Attr { ATTRIBUTE:IOSet } ::= Sequence {
type ATTRIBUTE.&id({IOSet}),
values Set SIZE(1..MAX) OF ATTRIBUTE.&Type({IOSet}{\@type})
}
Produce an object suitable for an Asn1OutputStream.
ContentInfo ::= Sequence {
contentType ContentType,
content
[0] EXPLICIT ANY DEFINED BY contentType OPTIONAL }
The EncryptedData object.
EncryptedData ::= Sequence {
version Version,
encryptedContentInfo EncryptedContentInfo
}
EncryptedContentInfo ::= Sequence {
contentType ContentType,
contentEncryptionAlgorithm ContentEncryptionAlgorithmIdentifier,
encryptedContent [0] IMPLICIT EncryptedContent OPTIONAL
}
EncryptedContent ::= OCTET STRING
Produce an object suitable for an Asn1OutputStream.
EncryptedPrivateKeyInfo ::= Sequence {
encryptionAlgorithm AlgorithmIdentifier {{KeyEncryptionAlgorithms}},
encryptedData EncryptedData
}
EncryptedData ::= OCTET STRING
KeyEncryptionAlgorithms ALGORITHM-IDENTIFIER ::= {
... -- For local profiles
}
Produce an object suitable for an Asn1OutputStream.
AlgorithmIdentifier ::= Sequence {
algorithm OBJECT IDENTIFIER,
parameters ANY DEFINED BY algorithm OPTIONAL }
MacData ::= SEQUENCE {
mac DigestInfo,
macSalt OCTET STRING,
iterations INTEGER DEFAULT 1
-- Note: The default is for historic reasons and its use is deprecated. A
-- higher value, like 1024 is recommended.
@return the basic DERObject construction.
the infamous Pfx from Pkcs12
write out an RSA private key with its associated information
as described in Pkcs8.
PrivateKeyInfo ::= Sequence {
version Version,
privateKeyAlgorithm AlgorithmIdentifier {{PrivateKeyAlgorithms}},
privateKey PrivateKey,
attributes [0] IMPLICIT Attributes OPTIONAL
}
Version ::= Integer {v1(0)} (v1,...)
PrivateKey ::= OCTET STRING
Attributes ::= Set OF Attr
The default version
RSAES-OAEP-params ::= SEQUENCE {
hashAlgorithm [0] OAEP-PSSDigestAlgorithms DEFAULT sha1,
maskGenAlgorithm [1] PKCS1MGFAlgorithms DEFAULT mgf1SHA1,
pSourceAlgorithm [2] PKCS1PSourceAlgorithms DEFAULT pSpecifiedEmpty
}
OAEP-PSSDigestAlgorithms ALGORITHM-IDENTIFIER ::= {
{ OID id-sha1 PARAMETERS NULL }|
{ OID id-sha256 PARAMETERS NULL }|
{ OID id-sha384 PARAMETERS NULL }|
{ OID id-sha512 PARAMETERS NULL },
... -- Allows for future expansion --
}
PKCS1MGFAlgorithms ALGORITHM-IDENTIFIER ::= {
{ OID id-mgf1 PARAMETERS OAEP-PSSDigestAlgorithms },
... -- Allows for future expansion --
}
PKCS1PSourceAlgorithms ALGORITHM-IDENTIFIER ::= {
{ OID id-pSpecified PARAMETERS OCTET STRING },
... -- Allows for future expansion --
}
@return the asn1 primitive representing the parameters.
This outputs the key in Pkcs1v2 format.
RsaPrivateKey ::= Sequence {
version Version,
modulus Integer, -- n
publicExponent Integer, -- e
privateExponent Integer, -- d
prime1 Integer, -- p
prime2 Integer, -- q
exponent1 Integer, -- d mod (p-1)
exponent2 Integer, -- d mod (q-1)
coefficient Integer -- (inverse of q) mod p
}
Version ::= Integer
This routine is written to output Pkcs1 version 0, private keys.
The default version
RSASSA-PSS-params ::= SEQUENCE {
hashAlgorithm [0] OAEP-PSSDigestAlgorithms DEFAULT sha1,
maskGenAlgorithm [1] PKCS1MGFAlgorithms DEFAULT mgf1SHA1,
saltLength [2] INTEGER DEFAULT 20,
trailerField [3] TrailerField DEFAULT trailerFieldBC
}
OAEP-PSSDigestAlgorithms ALGORITHM-IDENTIFIER ::= {
{ OID id-sha1 PARAMETERS NULL }|
{ OID id-sha256 PARAMETERS NULL }|
{ OID id-sha384 PARAMETERS NULL }|
{ OID id-sha512 PARAMETERS NULL },
... -- Allows for future expansion --
}
PKCS1MGFAlgorithms ALGORITHM-IDENTIFIER ::= {
{ OID id-mgf1 PARAMETERS OAEP-PSSDigestAlgorithms },
... -- Allows for future expansion --
}
TrailerField ::= INTEGER { trailerFieldBC(1) }
@return the asn1 primitive representing the parameters.
a Pkcs#7 signed data object.
Produce an object suitable for an Asn1OutputStream.
SignedData ::= Sequence {
version Version,
digestAlgorithms DigestAlgorithmIdentifiers,
contentInfo ContentInfo,
certificates
[0] IMPLICIT ExtendedCertificatesAndCertificates
OPTIONAL,
crls
[1] IMPLICIT CertificateRevocationLists OPTIONAL,
signerInfos SignerInfos }
a Pkcs#7 signer info object.
Produce an object suitable for an Asn1OutputStream.
SignerInfo ::= Sequence {
version Version,
issuerAndSerialNumber IssuerAndSerialNumber,
digestAlgorithm DigestAlgorithmIdentifier,
authenticatedAttributes [0] IMPLICIT Attributes OPTIONAL,
digestEncryptionAlgorithm DigestEncryptionAlgorithmIdentifier,
encryptedDigest EncryptedDigest,
unauthenticatedAttributes [1] IMPLICIT Attributes OPTIONAL
}
EncryptedDigest ::= OCTET STRING
DigestAlgorithmIdentifier ::= AlgorithmIdentifier
DigestEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier
the elliptic curve private key object from SEC 1
ECPrivateKey ::= SEQUENCE {
version INTEGER { ecPrivkeyVer1(1) } (ecPrivkeyVer1),
privateKey OCTET STRING,
parameters [0] Parameters OPTIONAL,
publicKey [1] BIT STRING OPTIONAL }
return the X9ECParameters object for the named curve represented by
the passed in object identifier. Null if the curve isn't present.
@param oid an object identifier representing a named curve, if present.
return the object identifier signified by the passed in name. Null
if there is no object identifier associated with name.
@return the object identifier associated with name, if present.
return the named curve name represented by the given object identifier.
returns an enumeration containing the name strings for curves
contained in this structure.
EllipticCurve OBJECT IDENTIFIER ::= {
iso(1) identified-organization(3) certicom(132) curve(0)
}
Handler class for dealing with S/MIME Capabilities
general preferences
encryption algorithms preferences
return an Attr object from the given object.
@param o the object we want converted.
@exception ArgumentException if the object cannot be converted.
returns an ArrayList with 0 or more objects of all the capabilities
matching the passed in capability Oid. If the Oid passed is null the
entire set is returned.
Produce an object suitable for an Asn1OutputStream.
SMIMECapabilities ::= Sequence OF SMIMECapability
return an Attr object from the given object.
@param o the object we want converted.
@exception ArgumentException if the object cannot be converted.
Produce an object suitable for an Asn1OutputStream.
Attr ::= Sequence {
attrType OBJECT IDENTIFIER,
attrValues Set OF AttributeValue
}
general preferences
encryption algorithms preferences
Produce an object suitable for an Asn1OutputStream.
SMIMECapability ::= Sequence {
capabilityID OBJECT IDENTIFIER,
parameters ANY DEFINED BY capabilityID OPTIONAL
}
Handler for creating a vector S/MIME Capabilities
The SmimeEncryptionKeyPreference object.
SmimeEncryptionKeyPreference ::= CHOICE {
issuerAndSerialNumber [0] IssuerAndSerialNumber,
receipentKeyId [1] RecipientKeyIdentifier,
subjectAltKeyIdentifier [2] SubjectKeyIdentifier
}
@param sKeyId the subjectKeyIdentifier value (normally the X.509 one)
elliptic curves defined in "ECC Brainpool Standard Curves and Curve Generation"
http://www.ecc-brainpool.org/download/draft_pkix_additional_ecc_dp.txt
return the X9ECParameters object for the named curve represented by
the passed in object identifier. Null if the curve isn't present.
@param oid an object identifier representing a named curve, if present.
return the object identifier signified by the passed in name. Null
if there is no object identifier associated with name.
@return the object identifier associated with name, if present.
return the named curve name represented by the given object identifier.
returns an enumeration containing the name strings for curves
contained in this structure.
Accuracy ::= SEQUENCE {
seconds INTEGER OPTIONAL,
millis [0] INTEGER (1..999) OPTIONAL,
micros [1] INTEGER (1..999) OPTIONAL
}
@param o
@return a MessageImprint object.
MessageImprint ::= SEQUENCE {
hashAlgorithm AlgorithmIdentifier,
hashedMessage OCTET STRING }
TimeStampReq ::= SEQUENCE {
version INTEGER { v1(1) },
messageImprint MessageImprint,
--a hash algorithm OID and the hash value of the data to be
--time-stamped
reqPolicy TSAPolicyId OPTIONAL,
nonce INTEGER OPTIONAL,
certReq BOOLEAN DEFAULT FALSE,
extensions [0] IMPLICIT Extensions OPTIONAL
}
TimeStampResp ::= SEQUENCE {
status PkiStatusInfo,
timeStampToken TimeStampToken OPTIONAL }
TstInfo ::= SEQUENCE {
version INTEGER { v1(1) },
policy TSAPolicyId,
messageImprint MessageImprint,
-- MUST have the same value as the similar field in
-- TimeStampReq
serialNumber INTEGER,
-- Time-Stamping users MUST be ready to accommodate integers
-- up to 160 bits.
genTime GeneralizedTime,
accuracy Accuracy OPTIONAL,
ordering BOOLEAN DEFAULT FALSE,
nonce INTEGER OPTIONAL,
-- MUST be present if the similar field was present
-- in TimeStampReq. In that case it MUST have the same value.
tsa [0] GeneralName OPTIONAL,
extensions [1] IMPLICIT Extensions OPTIONAL }
dump a Der object as a formatted string with indentation
@param obj the Asn1Object to be dumped out.
dump out a DER object as a formatted string, in non-verbose mode
@param obj the Asn1Encodable to be dumped out.
@return the resulting string.
Dump out the object as a string
@param obj the Asn1Encodable to be dumped out.
@param verbose if true, dump out the contents of octet and bit strings.
@return the resulting string.
DirectoryString ::= CHOICE {
teletexString TeletexString (SIZE (1..MAX)),
printableString PrintableString (SIZE (1..MAX)),
universalString UniversalString (SIZE (1..MAX)),
utf8String UTF8String (SIZE (1..MAX)),
bmpString BMPString (SIZE (1..MAX)) }
The AccessDescription object.
AccessDescription ::= SEQUENCE {
accessMethod OBJECT IDENTIFIER,
accessLocation GeneralName }
create an AccessDescription with the oid and location provided.
@return the access method.
@return the access location
Don't use this one if you are trying to be RFC 3281 compliant.
Use it for v1 attribute certificates only.
Our GeneralNames structure
Produce an object suitable for an Asn1OutputStream.
AttCertIssuer ::= CHOICE {
v1Form GeneralNames, -- MUST NOT be used in this
-- profile
v2Form [0] V2Form -- v2 only
}
Produce an object suitable for an Asn1OutputStream.
AttCertValidityPeriod ::= Sequence {
notBeforeTime GeneralizedTime,
notAfterTime GeneralizedTime
}
@param obj
@return
Produce an object suitable for an Asn1OutputStream.
AttributeCertificate ::= Sequence {
acinfo AttributeCertificateInfo,
signatureAlgorithm AlgorithmIdentifier,
signatureValue BIT STRING
}
Produce an object suitable for an Asn1OutputStream.
AttributeCertificateInfo ::= Sequence {
version AttCertVersion -- version is v2,
holder Holder,
issuer AttCertIssuer,
signature AlgorithmIdentifier,
serialNumber CertificateSerialNumber,
attrCertValidityPeriod AttCertValidityPeriod,
attributes Sequence OF Attr,
issuerUniqueID UniqueIdentifier OPTIONAL,
extensions Extensions OPTIONAL
}
AttCertVersion ::= Integer { v2(1) }
The AuthorityInformationAccess object.
id-pe-authorityInfoAccess OBJECT IDENTIFIER ::= { id-pe 1 }
AuthorityInfoAccessSyntax ::=
Sequence SIZE (1..MAX) OF AccessDescription
AccessDescription ::= Sequence {
accessMethod OBJECT IDENTIFIER,
accessLocation GeneralName }
id-ad OBJECT IDENTIFIER ::= { id-pkix 48 }
id-ad-caIssuers OBJECT IDENTIFIER ::= { id-ad 2 }
id-ad-ocsp OBJECT IDENTIFIER ::= { id-ad 1 }
create an AuthorityInformationAccess with the oid and location provided.
The AuthorityKeyIdentifier object.
id-ce-authorityKeyIdentifier OBJECT IDENTIFIER ::= { id-ce 35 }
AuthorityKeyIdentifier ::= Sequence {
keyIdentifier [0] IMPLICIT KeyIdentifier OPTIONAL,
authorityCertIssuer [1] IMPLICIT GeneralNames OPTIONAL,
authorityCertSerialNumber [2] IMPLICIT CertificateSerialNumber OPTIONAL }
KeyIdentifier ::= OCTET STRING
*
* Calulates the keyidentifier using a SHA1 hash over the BIT STRING
* from SubjectPublicKeyInfo as defined in RFC2459.
*
* Example of making a AuthorityKeyIdentifier:
*
* SubjectPublicKeyInfo apki = new SubjectPublicKeyInfo((ASN1Sequence)new ASN1InputStream(
* publicKey.getEncoded()).readObject());
* AuthorityKeyIdentifier aki = new AuthorityKeyIdentifier(apki);
*
*
*
create an AuthorityKeyIdentifier with the GeneralNames tag and
the serial number provided as well.
create an AuthorityKeyIdentifier with the GeneralNames tag and
the serial number provided.
create an AuthorityKeyIdentifier with a precomputed key identifier
create an AuthorityKeyIdentifier with a precomupted key identifier
and the GeneralNames tag and the serial number provided as well.
Produce an object suitable for an Asn1OutputStream.
create a cA=true object for the given path length constraint.
@param pathLenConstraint
Produce an object suitable for an Asn1OutputStream.
BasicConstraints := Sequence {
cA Boolean DEFAULT FALSE,
pathLenConstraint Integer (0..MAX) OPTIONAL
}
PKIX RFC-2459
The X.509 v2 CRL syntax is as follows. For signature calculation,
the data that is to be signed is ASN.1 Der encoded.
CertificateList ::= Sequence {
tbsCertList TbsCertList,
signatureAlgorithm AlgorithmIdentifier,
signatureValue BIT STRING }
This class helps to support crossCerfificatePairs in a LDAP directory
according RFC 2587
crossCertificatePairATTRIBUTE::={
WITH SYNTAX CertificatePair
EQUALITY MATCHING RULE certificatePairExactMatch
ID joint-iso-ccitt(2) ds(5) attributeType(4) crossCertificatePair(40)}
The forward elements of the crossCertificatePair attribute of a
CA's directory entry shall be used to store all, except self-issued
certificates issued to this CA. Optionally, the reverse elements of the
crossCertificatePair attribute, of a CA's directory entry may contain a
subset of certificates issued by this CA to other CAs. When both the forward
and the reverse elements are present in a single attribute value, issuer name
in one certificate shall match the subject name in the other and vice versa,
and the subject public key in one certificate shall be capable of verifying
the digital signature on the other certificate and vice versa.
When a reverse element is present, the forward element value and the reverse
element value need not be stored in the same attribute value; in other words,
they can be stored in either a single attribute value or two attribute
values.
CertificatePair ::= SEQUENCE {
forward [0] Certificate OPTIONAL,
reverse [1] Certificate OPTIONAL,
-- at least one of the pair shall be present -- }
Constructor from Asn1Sequence.
The sequence is of type CertificatePair:
CertificatePair ::= SEQUENCE {
forward [0] Certificate OPTIONAL,
reverse [1] Certificate OPTIONAL,
-- at least one of the pair shall be present -- }
@param seq The ASN.1 sequence.
Constructor from a given details.
@param forward Certificates issued to this CA.
@param reverse Certificates issued by this CA to other CAs.
Produce an object suitable for an Asn1OutputStream.
Returns:
CertificatePair ::= SEQUENCE {
forward [0] Certificate OPTIONAL,
reverse [1] Certificate OPTIONAL,
-- at least one of the pair shall be present -- }
@return a DERObject
@return Returns the forward.
@return Returns the reverse.
Construct a CertificatePolicies object containing one PolicyInformation.
@param name the name to be contained.
Produce an object suitable for an ASN1OutputStream.
CertificatePolicies ::= SEQUENCE SIZE {1..MAX} OF PolicyInformation
CertPolicyId, used in the CertificatePolicies and PolicyMappings
X509V3 Extensions.
CertPolicyId ::= OBJECT IDENTIFIER
Return the distribution points making up the sequence.
@return DistributionPoint[]
Produce an object suitable for an Asn1OutputStream.
CrlDistPoint ::= Sequence SIZE {1..MAX} OF DistributionPoint
The CRLNumber object.
CRLNumber::= Integer(0..MAX)
The CRLReason enumeration.
CRLReason ::= Enumerated {
unspecified (0),
keyCompromise (1),
cACompromise (2),
affiliationChanged (3),
superseded (4),
cessationOfOperation (5),
certificateHold (6),
removeFromCRL (8),
privilegeWithdrawn (9),
aACompromise (10)
}
The DigestInfo object.
DigestInfo::=Sequence{
digestAlgorithm AlgorithmIdentifier,
digest OCTET STRING }
DisplayText
class, used in
CertificatePolicies
X509 V3 extensions (in policy qualifiers).
It stores a string in a chosen encoding.
DisplayText ::= CHOICE {
ia5String IA5String (SIZE (1..200)),
visibleString VisibleString (SIZE (1..200)),
bmpString BMPString (SIZE (1..200)),
utf8String UTF8String (SIZE (1..200)) }
@see PolicyQualifierInfo
@see PolicyInformation
Constant corresponding to ia5String encoding.
Constant corresponding to bmpString encoding.
Constant corresponding to utf8String encoding.
Constant corresponding to visibleString encoding.
Describe constant DisplayTextMaximumSize
here.
Creates a new DisplayText
instance.
@param type the desired encoding type for the text.
@param text the text to store. Strings longer than 200
characters are truncated.
Creates a new DisplayText
instance.
@param text the text to encapsulate. Strings longer than 200
characters are truncated.
Creates a new DisplayText
instance.
Useful when reading back a DisplayText
class
from it's Asn1Encodable form.
@param contents an Asn1Encodable
instance.
Returns the stored string
object.
@return the stored text as a string
.
The DistributionPoint object.
DistributionPoint ::= Sequence {
distributionPoint [0] DistributionPointName OPTIONAL,
reasons [1] ReasonFlags OPTIONAL,
cRLIssuer [2] GeneralNames OPTIONAL
}
The DistributionPointName object.
DistributionPointName ::= CHOICE {
fullName [0] GeneralNames,
nameRelativeToCRLIssuer [1] RDN
}
The extendedKeyUsage object.
extendedKeyUsage ::= Sequence SIZE (1..MAX) OF KeyPurposeId
Returns all extended key usages.
The returned ArrayList contains DerObjectIdentifier instances.
@return An ArrayList with all key purposes.
The GeneralName object.
GeneralName ::= CHOICE {
otherName [0] OtherName,
rfc822Name [1] IA5String,
dNSName [2] IA5String,
x400Address [3] ORAddress,
directoryName [4] Name,
ediPartyName [5] EDIPartyName,
uniformResourceIdentifier [6] IA5String,
iPAddress [7] OCTET STRING,
registeredID [8] OBJECT IDENTIFIER}
OtherName ::= Sequence {
type-id OBJECT IDENTIFIER,
value [0] EXPLICIT ANY DEFINED BY type-id }
EDIPartyName ::= Sequence {
nameAssigner [0] DirectoryString OPTIONAL,
partyName [1] DirectoryString }
When the subjectAltName extension contains an Internet mail address,
the address MUST be included as an rfc822Name. The format of an
rfc822Name is an "addr-spec" as defined in RFC 822 [RFC 822].
When the subjectAltName extension contains a domain name service
label, the domain name MUST be stored in the dNSName (an IA5String).
The name MUST be in the "preferred name syntax," as specified by RFC
1034 [RFC 1034].
When the subjectAltName extension contains a URI, the name MUST be
stored in the uniformResourceIdentifier (an IA5String). The name MUST
be a non-relative URL, and MUST follow the URL syntax and encoding
rules specified in [RFC 1738]. The name must include both a scheme
(e.g., "http" or "ftp") and a scheme-specific-part. The scheme-
specific-part must include a fully qualified domain name or IP
address as the host.
When the subjectAltName extension contains a iPAddress, the address
MUST be stored in the octet string in "network byte order," as
specified in RFC 791 [RFC 791]. The least significant bit (LSB) of
each octet is the LSB of the corresponding byte in the network
address. For IP Version 4, as specified in RFC 791, the octet string
MUST contain exactly four octets. For IP Version 6, as specified in
RFC 1883, the octet string MUST contain exactly sixteen octets [RFC
1883].
Create a GeneralName for the given tag from the passed in string.
This constructor can handle:
- rfc822Name
- iPAddress
- directoryName
- dNSName
- uniformResourceIdentifier
- registeredID
For x400Address, otherName and ediPartyName there is no common string
format defined.
Note: A directory name can be encoded in different ways into a byte
representation. Be aware of this if the byte representation is used for
comparing results.
@param tag tag number
@param name string representation of name
@throws ArgumentException if the string encoding is not correct or
not supported.
Construct a GeneralNames object containing one GeneralName.
The name to be contained.
Produce an object suitable for an Asn1OutputStream.
GeneralNames ::= Sequence SIZE {1..MAX} OF GeneralName
Class for containing a restriction object subtrees in NameConstraints. See
RFC 3280.
GeneralSubtree ::= SEQUENCE
{
baseName GeneralName,
minimum [0] BaseDistance DEFAULT 0,
maximum [1] BaseDistance OPTIONAL
}
@see org.bouncycastle.asn1.x509.NameConstraints
Constructor from a given details.
According RFC 3280, the minimum and maximum fields are not used with any
name forms, thus minimum MUST be zero, and maximum MUST be absent.
If minimum is null
, zero is assumed, if
maximum is null
, maximum is absent.
@param baseName
A restriction.
@param minimum
Minimum
@param maximum
Maximum
Produce an object suitable for an Asn1OutputStream.
Returns:
GeneralSubtree ::= SEQUENCE
{
baseName GeneralName,
minimum [0] BaseDistance DEFAULT 0,
maximum [1] BaseDistance OPTIONAL
}
@return a DERObject
The Holder object.
For an v2 attribute certificate this is:
Holder ::= SEQUENCE {
baseCertificateID [0] IssuerSerial OPTIONAL,
-- the issuer and serial number of
-- the holder's Public Key Certificate
entityName [1] GeneralNames OPTIONAL,
-- the name of the claimant or role
objectDigestInfo [2] ObjectDigestInfo OPTIONAL
-- used to directly authenticate the holder,
-- for example, an executable
}
For an v1 attribute certificate this is:
subject CHOICE {
baseCertificateID [0] IssuerSerial,
-- associated with a Public Key Certificate
subjectName [1] GeneralNames },
-- associated with a name
Constructor for a holder for an v1 attribute certificate.
@param tagObj The ASN.1 tagged holder object.
Constructor for a holder for an v2 attribute certificate. *
@param seq The ASN.1 sequence.
Constructs a holder from a IssuerSerial.
@param baseCertificateID The IssuerSerial.
@param version The version of the attribute certificate.
Constructs a holder with an entityName for v2 attribute certificates or
with a subjectName for v1 attribute certificates.
@param entityName The entity or subject name.
Constructs a holder with an entityName for v2 attribute certificates or
with a subjectName for v1 attribute certificates.
@param entityName The entity or subject name.
@param version The version of the attribute certificate.
Constructs a holder from an object digest info.
@param objectDigestInfo The object digest info object.
The Holder object.
Holder ::= Sequence {
baseCertificateID [0] IssuerSerial OPTIONAL,
-- the issuer and serial number of
-- the holder's Public Key Certificate
entityName [1] GeneralNames OPTIONAL,
-- the name of the claimant or role
objectDigestInfo [2] ObjectDigestInfo OPTIONAL
-- used to directly authenticate the holder,
-- for example, an executable
}
Returns 1 for v2 attribute certificates or 0 for v1 attribute
certificates.
@return The version of the attribute certificate.
Returns the entityName for an v2 attribute certificate or the subjectName
for an v1 attribute certificate.
@return The entityname or subjectname.
Implementation of IetfAttrSyntax
as specified by RFC3281.
IetfAttrSyntax ::= Sequence {
policyAuthority [0] GeneralNames OPTIONAL,
values Sequence OF CHOICE {
octets OCTET STRING,
oid OBJECT IDENTIFIER,
string UTF8String
}
}
Produce an object suitable for an Asn1OutputStream.
IssuerSerial ::= Sequence {
issuer GeneralNames,
serial CertificateSerialNumber,
issuerUid UniqueIdentifier OPTIONAL
}
IssuingDistributionPoint ::= SEQUENCE {
distributionPoint [0] DistributionPointName OPTIONAL,
onlyContainsUserCerts [1] BOOLEAN DEFAULT FALSE,
onlyContainsCACerts [2] BOOLEAN DEFAULT FALSE,
onlySomeReasons [3] ReasonFlags OPTIONAL,
indirectCRL [4] BOOLEAN DEFAULT FALSE,
onlyContainsAttributeCerts [5] BOOLEAN DEFAULT FALSE }
Constructor from given details.
@param distributionPoint
May contain an URI as pointer to most current CRL.
@param onlyContainsUserCerts Covers revocation information for end certificates.
@param onlyContainsCACerts Covers revocation information for CA certificates.
@param onlySomeReasons
Which revocation reasons does this point cover.
@param indirectCRL
If true
then the CRL contains revocation
information about certificates ssued by other CAs.
@param onlyContainsAttributeCerts Covers revocation information for attribute certificates.
Constructor from Asn1Sequence
@return Returns the distributionPoint.
@return Returns the onlySomeReasons.
The KeyPurposeID object.
KeyPurposeID ::= OBJECT IDENTIFIER
The KeyUsage object.
id-ce-keyUsage OBJECT IDENTIFIER ::= { id-ce 15 }
KeyUsage ::= BIT STRING {
digitalSignature (0),
nonRepudiation (1),
keyEncipherment (2),
dataEncipherment (3),
keyAgreement (4),
keyCertSign (5),
cRLSign (6),
encipherOnly (7),
decipherOnly (8) }
Basic constructor.
@param usage - the bitwise OR of the Key Usage flags giving the
allowed uses for the key.
e.g. (KeyUsage.keyEncipherment | KeyUsage.dataEncipherment)
Constructor from a given details.
permitted and excluded are Vectors of GeneralSubtree objects.
@param permitted Permitted subtrees
@param excluded Excluded subtrees
NoticeReference
class, used in
CertificatePolicies
X509 V3 extensions
(in policy qualifiers).
NoticeReference ::= Sequence {
organization DisplayText,
noticeNumbers Sequence OF Integer }
@see PolicyQualifierInfo
@see PolicyInformation
Creates a new NoticeReference
instance.
@param orgName a string
value
@param numbers a ArrayList
value
Creates a new NoticeReference
instance.
@param orgName a string
value
@param numbers an Asn1Sequence
value
Creates a new NoticeReference
instance.
@param displayTextType an int
value
@param orgName a string
value
@param numbers an Asn1Sequence
value
Creates a new NoticeReference
instance.
Useful for reconstructing a NoticeReference
instance from its encodable/encoded form.
@param as an Asn1Sequence
value obtained from either
calling @{link ToAsn1Object()} for a NoticeReference
instance or from parsing it from a Der-encoded stream.
Describe ToAsn1Object
method here.
@return a Asn1Object
value
ObjectDigestInfo ASN.1 structure used in v2 attribute certificates.
ObjectDigestInfo ::= SEQUENCE {
digestedObjectType ENUMERATED {
publicKey (0),
publicKeyCert (1),
otherObjectTypes (2) },
-- otherObjectTypes MUST NOT
-- be used in this profile
otherObjectTypeID OBJECT IDENTIFIER OPTIONAL,
digestAlgorithm AlgorithmIdentifier,
objectDigest BIT STRING
}
The public key is hashed.
The public key certificate is hashed.
An other object is hashed.
Constructor from given details.
If digestedObjectType
is not {@link #publicKeyCert} or
{@link #publicKey} otherObjectTypeID
must be given,
otherwise it is ignored.
@param digestedObjectType The digest object type.
@param otherObjectTypeID The object type ID for
otherObjectDigest
.
@param digestAlgorithm The algorithm identifier for the hash.
@param objectDigest The hash value.
Produce an object suitable for an Asn1OutputStream.
ObjectDigestInfo ::= SEQUENCE {
digestedObjectType ENUMERATED {
publicKey (0),
publicKeyCert (1),
otherObjectTypes (2) },
-- otherObjectTypes MUST NOT
-- be used in this profile
otherObjectTypeID OBJECT IDENTIFIER OPTIONAL,
digestAlgorithm AlgorithmIdentifier,
objectDigest BIT STRING
}
PolicyMappings V3 extension, described in RFC3280.
PolicyMappings ::= Sequence SIZE (1..MAX) OF Sequence {
issuerDomainPolicy CertPolicyId,
subjectDomainPolicy CertPolicyId }
@see RFC 3280, section 4.2.1.6
Creates a new PolicyMappings
instance.
@param seq an Asn1Sequence
constructed as specified
in RFC 3280
Creates a new PolicyMappings
instance.
@param mappings a HashMap
value that maps
string
oids
to other string
oids.
PolicyQualifierId, used in the CertificatePolicies
X509V3 extension.
id-qt OBJECT IDENTIFIER ::= { id-pkix 2 }
id-qt-cps OBJECT IDENTIFIER ::= { id-qt 1 }
id-qt-unotice OBJECT IDENTIFIER ::= { id-qt 2 }
PolicyQualifierId ::=
OBJECT IDENTIFIER ( id-qt-cps | id-qt-unotice )
Policy qualifiers, used in the X509V3 CertificatePolicies
extension.
PolicyQualifierInfo ::= Sequence {
policyQualifierId PolicyQualifierId,
qualifier ANY DEFINED BY policyQualifierId }
Creates a new PolicyQualifierInfo
instance.
@param policyQualifierId a PolicyQualifierId
value
@param qualifier the qualifier, defined by the above field.
Creates a new PolicyQualifierInfo
containing a
cPSuri qualifier.
@param cps the CPS (certification practice statement) uri as a
string
.
Creates a new PolicyQualifierInfo
instance.
@param as PolicyQualifierInfo
X509 structure
encoded as an Asn1Sequence.
Returns a Der-encodable representation of this instance.
@return a Asn1Object
value
PrivateKeyUsagePeriod ::= SEQUENCE
{
notBefore [0] GeneralizedTime OPTIONAL,
notAfter [1] GeneralizedTime OPTIONAL }
The BiometricData object.
BiometricData ::= SEQUENCE {
typeOfBiometricData TypeOfBiometricData,
hashAlgorithm AlgorithmIdentifier,
biometricDataHash OCTET STRING,
sourceDataUri IA5String OPTIONAL }
The Iso4217CurrencyCode object.
Iso4217CurrencyCode ::= CHOICE {
alphabetic PrintableString (SIZE 3), --Recommended
numeric INTEGER (1..999) }
-- Alphabetic or numeric currency code as defined in ISO 4217
-- It is recommended that the Alphabetic form is used
The MonetaryValue object.
MonetaryValue ::= SEQUENCE {
currency Iso4217CurrencyCode,
amount INTEGER,
exponent INTEGER }
-- value = amount * 10^exponent
The QCStatement object.
QCStatement ::= SEQUENCE {
statementId OBJECT IDENTIFIER,
statementInfo ANY DEFINED BY statementId OPTIONAL}
The SemanticsInformation object.
SemanticsInformation ::= SEQUENCE {
semanticsIdentifier OBJECT IDENTIFIER OPTIONAL,
nameRegistrationAuthorities NameRegistrationAuthorities
OPTIONAL }
(WITH COMPONENTS {..., semanticsIdentifier PRESENT}|
WITH COMPONENTS {..., nameRegistrationAuthorities PRESENT})
NameRegistrationAuthorities ::= SEQUENCE SIZE (1..MAX) OF
GeneralName
The TypeOfBiometricData object.
TypeOfBiometricData ::= CHOICE {
predefinedBiometricType PredefinedBiometricType,
biometricDataOid OBJECT IDENTIFIER }
PredefinedBiometricType ::= INTEGER {
picture(0),handwritten-signature(1)}
(picture|handwritten-signature)
The ReasonFlags object.
ReasonFlags ::= BIT STRING {
unused(0),
keyCompromise(1),
cACompromise(2),
affiliationChanged(3),
superseded(4),
cessationOfOperation(5),
certficateHold(6)
}
@param reasons - the bitwise OR of the Key Reason flags giving the
allowed uses for the key.
Implementation of the RoleSyntax object as specified by the RFC3281.
RoleSyntax ::= SEQUENCE {
roleAuthority [0] GeneralNames OPTIONAL,
roleName [1] GeneralName
}
RoleSyntax factory method.
@param obj the object used to construct an instance of
RoleSyntax
. It must be an instance of RoleSyntax
or Asn1Sequence
.
@return the instance of RoleSyntax
built from the
supplied object.
@throws java.lang.ArgumentException if the object passed
to the factory is not an instance of RoleSyntax
or
Asn1Sequence
.
Constructor.
@param roleAuthority the role authority of this RoleSyntax.
@param roleName the role name of this RoleSyntax.
Constructor. Invoking this constructor is the same as invoking
new RoleSyntax(null, roleName)
.
@param roleName the role name of this RoleSyntax.
Utility constructor. Takes a string
argument representing
the role name, builds a GeneralName
to hold the role name
and calls the constructor that takes a GeneralName
.
@param roleName
Constructor that builds an instance of RoleSyntax
by
extracting the encoded elements from the Asn1Sequence
object supplied.
@param seq an instance of Asn1Sequence
that holds
the encoded elements used to build this RoleSyntax
.
Gets the role name as a java.lang.string
object.
@return the role name of this RoleSyntax represented as a
string
object.
Gets the role authority as a string[]
object.
@return the role authority of this RoleSyntax represented as a
string[]
array.
Implementation of the method ToAsn1Object
as
required by the superclass ASN1Encodable
.
RoleSyntax ::= SEQUENCE {
roleAuthority [0] GeneralNames OPTIONAL,
roleName [1] GeneralName
}
Gets the role authority of this RoleSyntax.
@return an instance of GeneralNames
holding the
role authority of this RoleSyntax.
Gets the role name of this RoleSyntax.
@return an instance of GeneralName
holding the
role name of this RoleSyntax.
This outputs the key in Pkcs1v2 format.
RSAPublicKey ::= Sequence {
modulus Integer, -- n
publicExponent Integer, -- e
}
Structure for a name or pseudonym.
NameOrPseudonym ::= CHOICE {
surAndGivenName SEQUENCE {
surName DirectoryString,
givenName SEQUENCE OF DirectoryString
},
pseudonym DirectoryString
}
@see org.bouncycastle.asn1.x509.sigi.PersonalData
Constructor from DERString.
The sequence is of type NameOrPseudonym:
NameOrPseudonym ::= CHOICE {
surAndGivenName SEQUENCE {
surName DirectoryString,
givenName SEQUENCE OF DirectoryString
},
pseudonym DirectoryString
}
@param pseudonym pseudonym value to use.
Constructor from Asn1Sequence.
The sequence is of type NameOrPseudonym:
NameOrPseudonym ::= CHOICE {
surAndGivenName SEQUENCE {
surName DirectoryString,
givenName SEQUENCE OF DirectoryString
},
pseudonym DirectoryString
}
@param seq The ASN.1 sequence.
Constructor from a given details.
@param pseudonym The pseudonym.
Constructor from a given details.
@param surname The surname.
@param givenName A sequence of directory strings making up the givenName
Produce an object suitable for an Asn1OutputStream.
Returns:
NameOrPseudonym ::= CHOICE {
surAndGivenName SEQUENCE {
surName DirectoryString,
givenName SEQUENCE OF DirectoryString
},
pseudonym DirectoryString
}
@return an Asn1Object
Contains personal data for the otherName field in the subjectAltNames
extension.
PersonalData ::= SEQUENCE {
nameOrPseudonym NameOrPseudonym,
nameDistinguisher [0] INTEGER OPTIONAL,
dateOfBirth [1] GeneralizedTime OPTIONAL,
placeOfBirth [2] DirectoryString OPTIONAL,
gender [3] PrintableString OPTIONAL,
postalAddress [4] DirectoryString OPTIONAL
}
@see org.bouncycastle.asn1.x509.sigi.NameOrPseudonym
@see org.bouncycastle.asn1.x509.sigi.SigIObjectIdentifiers
Constructor from Asn1Sequence.
The sequence is of type NameOrPseudonym:
PersonalData ::= SEQUENCE {
nameOrPseudonym NameOrPseudonym,
nameDistinguisher [0] INTEGER OPTIONAL,
dateOfBirth [1] GeneralizedTime OPTIONAL,
placeOfBirth [2] DirectoryString OPTIONAL,
gender [3] PrintableString OPTIONAL,
postalAddress [4] DirectoryString OPTIONAL
}
@param seq The ASN.1 sequence.
Constructor from a given details.
@param nameOrPseudonym Name or pseudonym.
@param nameDistinguisher Name distinguisher.
@param dateOfBirth Date of birth.
@param placeOfBirth Place of birth.
@param gender Gender.
@param postalAddress Postal Address.
Produce an object suitable for an Asn1OutputStream.
Returns:
PersonalData ::= SEQUENCE {
nameOrPseudonym NameOrPseudonym,
nameDistinguisher [0] INTEGER OPTIONAL,
dateOfBirth [1] GeneralizedTime OPTIONAL,
placeOfBirth [2] DirectoryString OPTIONAL,
gender [3] PrintableString OPTIONAL,
postalAddress [4] DirectoryString OPTIONAL
}
@return an Asn1Object
Object Identifiers of SigI specifciation (German Signature Law
Interoperability specification).
Key purpose IDs for German SigI (Signature Interoperability
Specification)
Certificate policy IDs for German SigI (Signature Interoperability
Specification)
Other Name IDs for German SigI (Signature Interoperability Specification)
To be used for for the generation of directory service certificates.
ID for PersonalData
Certificate is conform to german signature law.
This extension may contain further X.500 attributes of the subject. See also
RFC 3039.
SubjectDirectoryAttributes ::= Attributes
Attributes ::= SEQUENCE SIZE (1..MAX) OF Attribute
Attribute ::= SEQUENCE
{
type AttributeType
values SET OF AttributeValue
}
AttributeType ::= OBJECT IDENTIFIER
AttributeValue ::= ANY DEFINED BY AttributeType
@see org.bouncycastle.asn1.x509.X509Name for AttributeType ObjectIdentifiers.
Constructor from Asn1Sequence.
The sequence is of type SubjectDirectoryAttributes:
SubjectDirectoryAttributes ::= Attributes
Attributes ::= SEQUENCE SIZE (1..MAX) OF Attribute
Attribute ::= SEQUENCE
{
type AttributeType
values SET OF AttributeValue
}
AttributeType ::= OBJECT IDENTIFIER
AttributeValue ::= ANY DEFINED BY AttributeType
@param seq
The ASN.1 sequence.
Constructor from an ArrayList of attributes.
The ArrayList consists of attributes of type {@link Attribute Attribute}
@param attributes The attributes.
Produce an object suitable for an Asn1OutputStream.
Returns:
SubjectDirectoryAttributes ::= Attributes
Attributes ::= SEQUENCE SIZE (1..MAX) OF Attribute
Attribute ::= SEQUENCE
{
type AttributeType
values SET OF AttributeValue
}
AttributeType ::= OBJECT IDENTIFIER
AttributeValue ::= ANY DEFINED BY AttributeType
@return a DERObject
@return Returns the attributes.
The SubjectKeyIdentifier object.
SubjectKeyIdentifier::= OCTET STRING
Calculates the keyIdentifier using a SHA1 hash over the BIT STRING
from SubjectPublicKeyInfo as defined in RFC3280.
@param spki the subject public key info.
Return a RFC 3280 type 1 key identifier. As in:
(1) The keyIdentifier is composed of the 160-bit SHA-1 hash of the
value of the BIT STRING subjectPublicKey (excluding the tag,
length, and number of unused bits).
@param keyInfo the key info object containing the subjectPublicKey field.
@return the key identifier.
Return a RFC 3280 type 2 key identifier. As in:
(2) The keyIdentifier is composed of a four bit type field with
the value 0100 followed by the least significant 60 bits of the
SHA-1 hash of the value of the BIT STRING subjectPublicKey.
@param keyInfo the key info object containing the subjectPublicKey field.
@return the key identifier.
The object that contains the public key stored in a certficate.
The GetEncoded() method in the public keys in the JCE produces a DER
encoded one of these.
for when the public key is an encoded object - if the bitstring
can't be decoded this routine raises an IOException.
@exception IOException - if the bit string doesn't represent a Der
encoded object.
Produce an object suitable for an Asn1OutputStream.
SubjectPublicKeyInfo ::= Sequence {
algorithm AlgorithmIdentifier,
publicKey BIT STRING }
for when the public key is raw bits...
Target structure used in target information extension for attribute
certificates from RFC 3281.
Target ::= CHOICE {
targetName [0] GeneralName,
targetGroup [1] GeneralName,
targetCert [2] TargetCert
}
The targetCert field is currently not supported and must not be used
according to RFC 3281.
Creates an instance of a Target from the given object.
obj
can be a Target or a {@link Asn1TaggedObject}
@param obj The object.
@return A Target instance.
@throws ArgumentException if the given object cannot be
interpreted as Target.
Constructor from Asn1TaggedObject.
@param tagObj The tagged object.
@throws ArgumentException if the encoding is wrong.
Constructor from given details.
Exactly one of the parameters must be not null
.
@param type the choice type to apply to the name.
@param name the general name.
@throws ArgumentException if type is invalid.
Produce an object suitable for an Asn1OutputStream.
Returns:
Target ::= CHOICE {
targetName [0] GeneralName,
targetGroup [1] GeneralName,
targetCert [2] TargetCert
}
@return an Asn1Object
@return Returns the targetGroup.
@return Returns the targetName.
Target information extension for attributes certificates according to RFC
3281.
SEQUENCE OF Targets
Creates an instance of a TargetInformation from the given object.
obj
can be a TargetInformation or a {@link Asn1Sequence}
@param obj The object.
@return A TargetInformation instance.
@throws ArgumentException if the given object cannot be interpreted as TargetInformation.
Constructor from a Asn1Sequence.
@param seq The Asn1Sequence.
@throws ArgumentException if the sequence does not contain
correctly encoded Targets elements.
Returns the targets in this target information extension.
The ArrayList is cloned before it is returned.
@return Returns the targets.
Constructs a target information from a single targets element.
According to RFC 3281 only one targets element must be produced.
@param targets A Targets instance.
According to RFC 3281 only one targets element must be produced. If
multiple targets are given they must be merged in
into one targets element.
@param targets An array with {@link Targets}.
Produce an object suitable for an Asn1OutputStream.
Returns:
SEQUENCE OF Targets
According to RFC 3281 only one targets element must be produced. If
multiple targets are given in the constructor they are merged into one
targets element. If this was produced from a
{@link Org.BouncyCastle.Asn1.Asn1Sequence} the encoding is kept.
@return an Asn1Object
Targets structure used in target information extension for attribute
certificates from RFC 3281.
Targets ::= SEQUENCE OF Target
Target ::= CHOICE {
targetName [0] GeneralName,
targetGroup [1] GeneralName,
targetCert [2] TargetCert
}
TargetCert ::= SEQUENCE {
targetCertificate IssuerSerial,
targetName GeneralName OPTIONAL,
certDigestInfo ObjectDigestInfo OPTIONAL
}
@see org.bouncycastle.asn1.x509.Target
@see org.bouncycastle.asn1.x509.TargetInformation
Creates an instance of a Targets from the given object.
obj
can be a Targets or a {@link Asn1Sequence}
@param obj The object.
@return A Targets instance.
@throws ArgumentException if the given object cannot be interpreted as Target.
Constructor from Asn1Sequence.
@param targets The ASN.1 SEQUENCE.
@throws ArgumentException if the contents of the sequence are
invalid.
Constructor from given targets.
The ArrayList is copied.
@param targets An ArrayList
of {@link Target}s.
@see Target
@throws ArgumentException if the ArrayList contains not only Targets.
Returns the targets in an ArrayList
.
The ArrayList is cloned before it is returned.
@return Returns the targets.
Produce an object suitable for an Asn1OutputStream.
Returns:
Targets ::= SEQUENCE OF Target
@return an Asn1Object
The TbsCertificate object.
TbsCertificate ::= Sequence {
version [ 0 ] Version DEFAULT v1(0),
serialNumber CertificateSerialNumber,
signature AlgorithmIdentifier,
issuer Name,
validity Validity,
subject Name,
subjectPublicKeyInfo SubjectPublicKeyInfo,
issuerUniqueID [ 1 ] IMPLICIT UniqueIdentifier OPTIONAL,
subjectUniqueID [ 2 ] IMPLICIT UniqueIdentifier OPTIONAL,
extensions [ 3 ] Extensions OPTIONAL
}
Note: issuerUniqueID and subjectUniqueID are both deprecated by the IETF. This class
will parse them, but you really shouldn't be creating new ones.
PKIX RFC-2459 - TbsCertList object.
TbsCertList ::= Sequence {
version Version OPTIONAL,
-- if present, shall be v2
signature AlgorithmIdentifier,
issuer Name,
thisUpdate Time,
nextUpdate Time OPTIONAL,
revokedCertificates Sequence OF Sequence {
userCertificate CertificateSerialNumber,
revocationDate Time,
crlEntryExtensions Extensions OPTIONAL
-- if present, shall be v2
} OPTIONAL,
crlExtensions [0] EXPLICIT Extensions OPTIONAL
-- if present, shall be v2
}
creates a time object from a given date - if the date is between 1950
and 2049 a UTCTime object is Generated, otherwise a GeneralizedTime
is used.
Return our time as DateTime.
A date time.
Produce an object suitable for an Asn1OutputStream.
Time ::= CHOICE {
utcTime UTCTime,
generalTime GeneralizedTime }
UserNotice
class, used in
CertificatePolicies
X509 extensions (in policy
qualifiers).
UserNotice ::= Sequence {
noticeRef NoticeReference OPTIONAL,
explicitText DisplayText OPTIONAL}
@see PolicyQualifierId
@see PolicyInformation
Creates a new UserNotice
instance.
@param noticeRef a NoticeReference
value
@param explicitText a DisplayText
value
Creates a new UserNotice
instance.
@param noticeRef a NoticeReference
value
@param str the explicitText field as a string.
Creates a new UserNotice
instance.
Useful from reconstructing a UserNotice
instance
from its encodable/encoded form.
@param as an ASN1Sequence
value obtained from either
calling @{link toASN1Object()} for a UserNotice
instance or from parsing it from a DER-encoded stream.
Generator for Version 1 TbsCertificateStructures.
TbsCertificate ::= Sequence {
version [ 0 ] Version DEFAULT v1(0),
serialNumber CertificateSerialNumber,
signature AlgorithmIdentifier,
issuer Name,
validity Validity,
subject Name,
subjectPublicKeyInfo SubjectPublicKeyInfo,
}
Generator for Version 2 AttributeCertificateInfo
AttributeCertificateInfo ::= Sequence {
version AttCertVersion -- version is v2,
holder Holder,
issuer AttCertIssuer,
signature AlgorithmIdentifier,
serialNumber CertificateSerialNumber,
attrCertValidityPeriod AttCertValidityPeriod,
attributes Sequence OF Attr,
issuerUniqueID UniqueIdentifier OPTIONAL,
extensions Extensions OPTIONAL
}
@param attribute
Produce an object suitable for an Asn1OutputStream.
V2Form ::= Sequence {
issuerName GeneralNames OPTIONAL,
baseCertificateID [0] IssuerSerial OPTIONAL,
objectDigestInfo [1] ObjectDigestInfo OPTIONAL
-- issuerName MUST be present in this profile
-- baseCertificateID and objectDigestInfo MUST NOT
-- be present in this profile
}
Generator for Version 2 TbsCertList structures.
TbsCertList ::= Sequence {
version Version OPTIONAL,
-- if present, shall be v2
signature AlgorithmIdentifier,
issuer Name,
thisUpdate Time,
nextUpdate Time OPTIONAL,
revokedCertificates Sequence OF Sequence {
userCertificate CertificateSerialNumber,
revocationDate Time,
crlEntryExtensions Extensions OPTIONAL
-- if present, shall be v2
} OPTIONAL,
crlExtensions [0] EXPLICIT Extensions OPTIONAL
-- if present, shall be v2
}
Note: This class may be subject to change
Generator for Version 3 TbsCertificateStructures.
TbsCertificate ::= Sequence {
version [ 0 ] Version DEFAULT v1(0),
serialNumber CertificateSerialNumber,
signature AlgorithmIdentifier,
issuer Name,
validity Validity,
subject Name,
subjectPublicKeyInfo SubjectPublicKeyInfo,
issuerUniqueID [ 1 ] IMPLICIT UniqueIdentifier OPTIONAL,
subjectUniqueID [ 2 ] IMPLICIT UniqueIdentifier OPTIONAL,
extensions [ 3 ] Extensions OPTIONAL
}
an X509Certificate structure.
Certificate ::= Sequence {
tbsCertificate TbsCertificate,
signatureAlgorithm AlgorithmIdentifier,
signature BIT STRING
}
The default converter for X509 DN entries when going from their
string value to ASN.1 strings.
* It turns out that the number of standard ways the fields in a DN should be
* encoded into their ASN.1 counterparts is rapidly approaching the
* number of machines on the internet. By default the X509Name class
* will produce UTF8Strings in line with the current recommendations (RFC 3280).
*
* An example of an encoder look like below:
*
* public class X509DirEntryConverter
* : X509NameEntryConverter
* {
* public Asn1Object GetConvertedValue(
* DerObjectIdentifier oid,
* string value)
* {
* if (str.Length() != 0 && str.charAt(0) == '#')
* {
* return ConvertHexEncoded(str, 1);
* }
* if (oid.Equals(EmailAddress))
* {
* return new DerIA5String(str);
* }
* else if (CanBePrintable(str))
* {
* return new DerPrintableString(str);
* }
* else if (CanBeUTF8(str))
* {
* return new DerUtf8String(str);
* }
* else
* {
* return new DerBmpString(str);
* }
* }
* }
*
*
Convert an inline encoded hex string rendition of an ASN.1
object back into its corresponding ASN.1 object.
@param str the hex encoded object
@param off the index at which the encoding starts
@return the decoded object
return true if the passed in string can be represented without
loss as a PrintableString, false otherwise.
Convert the passed in string value into the appropriate ASN.1
encoded object.
@param oid the oid associated with the value in the DN.
@param value the value of the particular DN component.
@return the ASN.1 equivalent for the value.
Apply default conversion for the given value depending on the oid
and the character range of the value.
@param oid the object identifier for the DN entry
@param value the value associated with it
@return the ASN.1 equivalent for the string value.
an object for the elements in the X.509 V3 extension block.
Convert the value of the passed in extension to an object.
The extension to parse.
The object the value string contains.
If conversion is not possible.
Subject Directory Attributes
Subject Key Identifier
Key Usage
Private Key Usage Period
Subject Alternative Name
Issuer Alternative Name
Basic Constraints
CRL Number
Reason code
Hold Instruction Code
Invalidity Date
Delta CRL indicator
Issuing Distribution Point
Certificate Issuer
Name Constraints
CRL Distribution Points
Certificate Policies
Policy Mappings
Authority Key Identifier
Policy Constraints
Extended Key Usage
Freshest CRL
Inhibit Any Policy
Authority Info Access
Subject Info Access
Logo Type
BiometricInfo
QCStatements
Audit identity extension in attribute certificates.
NoRevAvail extension in attribute certificates.
TargetInformation extension in attribute certificates.
Constructor from Asn1Sequence.
the extensions are a list of constructed sequences, either with (Oid, OctetString) or (Oid, Boolean, OctetString)
constructor from a table of extensions.
it's is assumed the table contains Oid/string pairs.
Constructor from a table of extensions with ordering.
It's is assumed the table contains Oid/string pairs.
Constructor from two vectors
@param objectIDs an ArrayList of the object identifiers.
@param values an ArrayList of the extension values.
constructor from a table of extensions.
it's is assumed the table contains Oid/string pairs.
Constructor from a table of extensions with ordering.
It's is assumed the table contains Oid/string pairs.
Constructor from two vectors
@param objectIDs an ArrayList of the object identifiers.
@param values an ArrayList of the extension values.
return the extension represented by the object identifier
passed in.
@return the extension if it's present, null otherwise.
Extensions ::= SEQUENCE SIZE (1..MAX) OF Extension
Extension ::= SEQUENCE {
extnId EXTENSION.&id ({ExtensionSet}),
critical BOOLEAN DEFAULT FALSE,
extnValue OCTET STRING }
return an Enumeration of the extension field's object ids.
Generator for X.509 extensions
Reset the generator
Add an extension with the given oid and the passed in value to be included
in the OCTET STRING associated with the extension.
OID for the extension.
True if critical, false otherwise.
The ASN.1 object to be included in the extension.
Add an extension with the given oid and the passed in byte array to be wrapped
in the OCTET STRING associated with the extension.
OID for the extension.
True if critical, false otherwise.
The byte array to be wrapped.
Generate an X509Extensions object based on the current state of the generator.
An X509Extensions object
Return true if there are no extension present in this generator.
True if empty, false otherwise
RDNSequence ::= SEQUENCE OF RelativeDistinguishedName
RelativeDistinguishedName ::= SET SIZE (1..MAX) OF AttributeTypeAndValue
AttributeTypeAndValue ::= SEQUENCE {
type OBJECT IDENTIFIER,
value ANY }
country code - StringType(SIZE(2))
organization - StringType(SIZE(1..64))
organizational unit name - StringType(SIZE(1..64))
Title
common name - StringType(SIZE(1..64))
street - StringType(SIZE(1..64))
device serial number name - StringType(SIZE(1..64))
locality name - StringType(SIZE(1..64))
state, or province name - StringType(SIZE(1..64))
Naming attributes of type X520name
businessCategory - DirectoryString(SIZE(1..128)
postalCode - DirectoryString(SIZE(1..40)
dnQualifier - DirectoryString(SIZE(1..64)
RFC 3039 Pseudonym - DirectoryString(SIZE(1..64)
RFC 3039 DateOfBirth - GeneralizedTime - YYYYMMDD000000Z
RFC 3039 PlaceOfBirth - DirectoryString(SIZE(1..128)
RFC 3039 DateOfBirth - PrintableString (SIZE(1)) -- "M", "F", "m" or "f"
RFC 3039 CountryOfCitizenship - PrintableString (SIZE (2)) -- ISO 3166
codes only
RFC 3039 CountryOfCitizenship - PrintableString (SIZE (2)) -- ISO 3166
codes only
ISIS-MTT NameAtBirth - DirectoryString(SIZE(1..64)
RFC 3039 PostalAddress - SEQUENCE SIZE (1..6) OF
DirectoryString(SIZE(1..30))
RFC 2256 dmdName
id-at-telephoneNumber
id-at-name
Email address (RSA PKCS#9 extension) - IA5String.
Note: if you're trying to be ultra orthodox, don't use this! It shouldn't be in here.
more from PKCS#9
email address in Verisign certificates
LDAP User id.
default look up table translating OID values into their common symbols following
the convention in RFC 2253 with a few extras
look up table translating OID values into their common symbols following the convention in RFC 2253
look up table translating OID values into their common symbols following the convention in RFC 1779
look up table translating common symbols into their OIDS.
Return a X509Name based on the passed in tagged object.
@param obj tag object holding name.
@param explicitly true if explicitly tagged false otherwise.
@return the X509Name
Constructor from Asn1Sequence
the principal will be a list of constructed sets, each containing an (OID, string) pair.
Constructor from a table of attributes with ordering.
it's is assumed the table contains OID/string pairs, and the contents
of the table are copied into an internal table as part of the
construction process. The ordering ArrayList should contain the OIDs
in the order they are meant to be encoded or printed in ToString.
Constructor from a table of attributes with ordering.
it's is assumed the table contains OID/string pairs, and the contents
of the table are copied into an internal table as part of the
construction process. The ordering ArrayList should contain the OIDs
in the order they are meant to be encoded or printed in ToString.
The passed in converter will be used to convert the strings into their
ASN.1 counterparts.
Takes two vectors one of the oids and the other of the values.
Takes two vectors one of the oids and the other of the values.
The passed in converter will be used to convert the strings into their
ASN.1 counterparts.
Takes an X509 dir name as a string of the format "C=AU, ST=Victoria", or
some such, converting it into an ordered set of name attributes.
Takes an X509 dir name as a string of the format "C=AU, ST=Victoria", or
some such, converting it into an ordered set of name attributes with each
string value being converted to its associated ASN.1 type using the passed
in converter.
Takes an X509 dir name as a string of the format "C=AU, ST=Victoria", or
some such, converting it into an ordered set of name attributes. If reverse
is true, create the encoded version of the sequence starting from the
last element in the string.
Takes an X509 dir name as a string of the format "C=AU, ST=Victoria", or
some such, converting it into an ordered set of name attributes with each
string value being converted to its associated ASN.1 type using the passed
in converter. If reverse is true the ASN.1 sequence representing the DN will
be built by starting at the end of the string, rather than the start.
Takes an X509 dir name as a string of the format "C=AU, ST=Victoria", or
some such, converting it into an ordered set of name attributes. lookUp
should provide a table of lookups, indexed by lowercase only strings and
yielding a DerObjectIdentifier, other than that OID. and numeric oids
will be processed automatically.
If reverse is true, create the encoded version of the sequence
starting from the last element in the string.
@param reverse true if we should start scanning from the end (RFC 2553).
@param lookUp table of names and their oids.
@param dirName the X.500 string to be parsed.
Takes an X509 dir name as a string of the format "C=AU, ST=Victoria", or
some such, converting it into an ordered set of name attributes. lookUp
should provide a table of lookups, indexed by lowercase only strings and
yielding a DerObjectIdentifier, other than that OID. and numeric oids
will be processed automatically. The passed in converter is used to convert the
string values to the right of each equals sign to their ASN.1 counterparts.
@param reverse true if we should start scanning from the end, false otherwise.
@param lookUp table of names and oids.
@param dirName the string dirName
@param converter the converter to convert string values into their ASN.1 equivalents
return an ArrayList of the oids in the name, in the order they were found.
return an IList of the oids in the name, in the order they were found.
return an ArrayList of the values found in the name, in the order they
were found.
return an IList of the values found in the name, in the order they
were found.
return an ArrayList of the values found in the name, in the order they
were found, with the DN label corresponding to passed in oid.
return an IList of the values found in the name, in the order they
were found, with the DN label corresponding to passed in oid.
The X509Name object to test equivalency against.
If true, the order of elements must be the same,
as well as the values associated with each element.
test for equivalence - note: case is ignored.
convert the structure to a string - if reverse is true the
oids and values are listed out starting with the last element
in the sequence (ala RFC 2253), otherwise the string will begin
with the first element of the structure. If no string definition
for the oid is found in oidSymbols the string value of the oid is
added. Two standard symbol tables are provided DefaultSymbols, and
RFC2253Symbols as part of this class.
@param reverse if true start at the end of the sequence and work back.
@param oidSymbols look up table strings for oids.
determines whether or not strings should be processed and printed
from back to front.
class for breaking up an X500 Name into it's component tokens, ala
java.util.StringTokenizer. We need this class as some of the
lightweight Java environment don't support classes like
StringTokenizer.
ASN.1 def for Diffie-Hellman key exchange KeySpecificInfo structure. See
RFC 2631, or X9.42, for further details.
Produce an object suitable for an Asn1OutputStream.
KeySpecificInfo ::= Sequence {
algorithm OBJECT IDENTIFIER,
counter OCTET STRING SIZE (4..4)
}
ANS.1 def for Diffie-Hellman key exchange OtherInfo structure. See
RFC 2631, or X9.42, for further details.
Produce an object suitable for an Asn1OutputStream.
OtherInfo ::= Sequence {
keyInfo KeySpecificInfo,
partyAInfo [0] OCTET STRING OPTIONAL,
suppPubInfo [2] OCTET STRING
}
table of the current named curves defined in X.962 EC-DSA.
return the X9ECParameters object for the named curve represented by
the passed in object identifier. Null if the curve isn't present.
@param oid an object identifier representing a named curve, if present.
return the object identifier signified by the passed in name. Null
if there is no object identifier associated with name.
@return the object identifier associated with name, if present.
return the named curve name represented by the given object identifier.
returns an enumeration containing the name strings for curves
contained in this structure.
Produce an object suitable for an Asn1OutputStream.
Parameters ::= CHOICE {
ecParameters ECParameters,
namedCurve CURVES.&id({CurveNames}),
implicitlyCA Null
}
ASN.1 def for Elliptic-Curve Curve structure. See
X9.62, for further details.
Produce an object suitable for an Asn1OutputStream.
Curve ::= Sequence {
a FieldElement,
b FieldElement,
seed BIT STRING OPTIONAL
}
ASN.1 def for Elliptic-Curve ECParameters structure. See
X9.62, for further details.
Produce an object suitable for an Asn1OutputStream.
ECParameters ::= Sequence {
version Integer { ecpVer1(1) } (ecpVer1),
fieldID FieldID {{FieldTypes}},
curve X9Curve,
base X9ECPoint,
order Integer,
cofactor Integer OPTIONAL
}
class for describing an ECPoint as a Der object.
Produce an object suitable for an Asn1OutputStream.
ECPoint ::= OCTET STRING
Octet string produced using ECPoint.GetEncoded().
Class for processing an ECFieldElement as a DER object.
Produce an object suitable for an Asn1OutputStream.
FieldElement ::= OCTET STRING
- if q is an odd prime then the field element is
processed as an Integer and converted to an octet string
according to x 9.62 4.3.1.
- if q is 2m then the bit string
contained in the field element is converted into an octet
string with the same ordering padded at the front if necessary.
ASN.1 def for Elliptic-Curve Field ID structure. See
X9.62, for further details.
Constructor for elliptic curves over prime fields
F2
.
@param primeP The prime p
defining the prime field.
Constructor for elliptic curves over binary fields
F2m
.
@param m The exponent m
of
F2m
.
@param k1 The integer k1
where xm +
xk3 + xk2 + xk1 + 1
represents the reduction polynomial f(z)
.
@param k2 The integer k2
where xm +
xk3 + xk2 + xk1 + 1
represents the reduction polynomial f(z)
.
@param k3 The integer k3
where xm +
xk3 + xk2 + xk1 + 1
represents the reduction polynomial f(z)
..
Produce a Der encoding of the following structure.
FieldID ::= Sequence {
fieldType FIELD-ID.&id({IOSet}),
parameters FIELD-ID.&Type({IOSet}{@fieldType})
}
id-dsa-with-sha1 OBJECT IDENTIFIER ::= { iso(1) member-body(2)
us(840) x9-57 (10040) x9cm(4) 3 }
X9.63
X9.42
reader for Base64 armored objects - read the headers and then start returning
bytes when the data is reached. An IOException is thrown if the CRC check
fails.
decode the base 64 encoded input data.
@return the offset the data starts in out.
Create a stream for reading a PGP armoured message, parsing up to a header
and then reading the data that follows.
@param input
Create an armoured input stream which will assume the data starts
straight away, or parse for headers first depending on the value of
hasHeaders.
@param input
@param hasHeaders true if headers are to be looked for, false otherwise.
@return true if we are inside the clear text section of a PGP
signed message.
@return true if the stream is actually at end of file.
Return the armor header line (if there is one)
@return the armor header line, null if none present.
Return the armor headers (the lines after the armor header line),
@return an array of armor headers, null if there aren't any.
Basic output stream.
encode the input data producing a base 64 encoded byte array.
Set an additional header entry.
@param name the name of the header entry.
@param v the value of the header entry.
Reset the headers to only contain a Version string.
Start a clear text signed message.
@param hashAlgorithm
Note: close does nor close the underlying stream. So it is possible to write
multiple objects using armoring to a single stream.
Basic type for a image attribute packet.
Basic type for a user attribute sub-packet.
return the generic data making up the packet.
Reader for PGP objects.
Returns the next packet tag in the stream.
A stream that overlays our input stream, allowing the user to only read a segment of it.
NB: dataLength will be negative if the segment length is in the upper range above 2**31.
Base class for a PGP object.
Basic output stream.
Create a stream representing a general packet.
Output stream to write to.
Create a stream representing an old style partial object.
Output stream to write to.
The packet tag for the object.
Create a stream representing a general packet.
Output stream to write to.
Packet tag.
Size of chunks making up the packet.
If true, the header is written out in old format.
Create a new style partial input stream buffered into chunks.
Output stream to write to.
Packet tag.
Size of chunks making up the packet.
Create a new style partial input stream buffered into chunks.
Output stream to write to.
Packet tag.
Buffer to use for collecting chunks.
Flush the underlying stream.
Finish writing out the current packet without closing the underlying stream.
Generic compressed data object.
Note: you can only read from this once...
The algorithm tag value.
Basic tags for compression algorithms.
Basic type for a PGP packet.
Base class for a DSA public key.
Base interface for a PGP key.
The base format for this key - in the case of the symmetric keys it will generally
be raw indicating that the key is just a straight byte representation, for an asymmetric
key the format will be PGP, indicating the key is a string of MPIs encoded in PGP format.
"RAW" or "PGP".
The stream to read the packet from.
Return the standard PGP encoding of the key.
The format, as a string, always "PGP".
Base class for a DSA secret key.
@param in
Return the standard PGP encoding of the key.
The format, as a string, always "PGP".
@return x
Base class for an ElGamal public key.
Return the standard PGP encoding of the key.
The format, as a string, always "PGP".
Base class for an ElGamal secret key.
@param in
@param x
Return the standard PGP encoding of the key.
The format, as a string, always "PGP".
Basic packet for an experimental packet.
Basic tags for hash algorithms.
Generic literal data packet.
The format tag value.
The modification time of the file in milli-seconds (since Jan 1, 1970 UTC)
Basic type for a marker packet.
Basic packet for a modification detection code packet.
A multiple precision integer
Generic signature object
The encryption algorithm tag.
The hash algorithm tag.
Basic PGP packet tag types.
Public Key Algorithm tag numbers.
Basic packet for a PGP public key.
Basic packet for a PGP public key.
Construct a version 4 public key packet.
Basic packet for a PGP public subkey
Construct a version 4 public subkey packet.
Base class for an RSA public key.
Construct an RSA public key from the passed in stream.
The modulus.
The public exponent.
Return the standard PGP encoding of the key.
The format, as a string, always "PGP".
Base class for an RSA secret (or priate) key.
Return the standard PGP encoding of the key.
The format, as a string, always "PGP".
The string to key specifier class.
The IV for the key generation algorithm.
The hash algorithm.
The iteration count
The protection mode - only if GnuDummyS2K
Basic packet for a PGP secret key.
Basic packet for a PGP secret key.
Generic signature packet.
Generate a version 4 signature packet.
@param signatureType
@param keyAlgorithm
@param hashAlgorithm
@param hashedData
@param unhashedData
@param fingerprint
@param signature
Generate a version 2/3 signature packet.
@param signatureType
@param keyAlgorithm
@param hashAlgorithm
@param fingerprint
@param signature
return the signature trailer that must be included with the data
to reconstruct the signature
@return byte[]
* return the signature as a set of integers - note this is normalised to be the
* ASN.1 encoding of what appears in the signature packet.
Return the byte encoding of the signature section.
@return uninterpreted signature bytes.
return the keyId
@return the keyId that created the signature.
Return the creation time in milliseconds since 1 Jan., 1970 UTC.
Basic type for a PGP Signature sub-packet.
Return the generic data making up the packet.
reader for signature sub-packets
Basic PGP signature sub-packet tag types.
Packet embedded signature
packet giving signature creation time.
packet giving signature creation time.
packet giving time after creation at which the key expires.
Return the number of seconds after creation time a key is valid for.
@return second count for key validity.
Packet holding the key flag values.
Return the flag values contained in the first 4 octets (note: at the moment
the standard only uses the first one).
Class provided a NotationData object according to
RFC2440, Chapter 5.2.3.15. Notation Data
packet giving signature creation time.
packet giving whether or not the signature is signed using the primary user ID for the key.
packet giving whether or not is revocable.
packet giving signature creation time.
packet giving signature expiration time.
return time in seconds before signature expires after creation time.
packet giving the User ID of the signer.
packet giving trust.
Basic type for a symmetric key encrypted packet.
Basic tags for symmetric key algorithms
Basic type for a symmetric encrypted session key packet
@return byte[]
@return int
@return S2k
@return int
Basic type for a trust packet.
Basic type for a user attribute packet.
reader for user attribute sub-packets
Basic PGP user attribute sub-packet tag types.
Basic type for a user ID packet.
The 'Signature' parameter is only available when generating unsigned attributes.
containing class for an CMS Authenticated Data object
return a store of the intended recipients for this message
return a table of the digested attributes indexed by
the OID of the attribute.
return a table of the undigested attributes indexed by
the OID of the attribute.
return the ASN.1 encoded representation of this object.
return the object identifier for the content MAC algorithm.
return the ContentInfo
General class for generating a CMS authenticated-data message.
A simple example of usage.
CMSAuthenticatedDataGenerator fact = new CMSAuthenticatedDataGenerator();
fact.addKeyTransRecipient(cert);
CMSAuthenticatedData data = fact.generate(content, algorithm, "BC");
General class for generating a CMS enveloped-data message.
A simple example of usage.
CMSEnvelopedDataGenerator fact = new CMSEnvelopedDataGenerator();
fact.addKeyTransRecipient(cert);
CMSEnvelopedData data = fact.generate(content, algorithm, "BC");
Constructor allowing specific source of randomness
Instance of SecureRandom to use.
add a recipient.
@param cert recipient's public key certificate
@exception ArgumentException if there is a problem with the certificate
add a recipient
@param key the public key used by the recipient
@param subKeyId the identifier for the recipient's public key
@exception ArgumentException if there is a problem with the key
add a KEK recipient.
@param key the secret key to use for wrapping
@param keyIdentifier the byte string that identifies the key
add a KEK recipient.
@param key the secret key to use for wrapping
@param keyIdentifier the byte string that identifies the key
Add a key agreement based recipient.
@param agreementAlgorithm key agreement algorithm to use.
@param senderPrivateKey private key to initialise sender side of agreement with.
@param senderPublicKey sender public key to include with message.
@param recipientCert recipient's public key certificate.
@param cekWrapAlgorithm OID for key wrapping algorithm to use.
@exception SecurityUtilityException if the algorithm requested cannot be found
@exception InvalidKeyException if the keys are inappropriate for the algorithm specified
Add multiple key agreement based recipients (sharing a single KeyAgreeRecipientInfo structure).
@param agreementAlgorithm key agreement algorithm to use.
@param senderPrivateKey private key to initialise sender side of agreement with.
@param senderPublicKey sender public key to include with message.
@param recipientCerts recipients' public key certificates.
@param cekWrapAlgorithm OID for key wrapping algorithm to use.
@exception SecurityUtilityException if the algorithm requested cannot be found
@exception InvalidKeyException if the keys are inappropriate for the algorithm specified
base constructor
constructor allowing specific source of randomness
@param rand instance of SecureRandom to use
base constructor
constructor allowing specific source of randomness
@param rand instance of SecureRandom to use
generate an enveloped object that contains an CMS Enveloped Data
object using the given provider and the passed in key generator.
generate an authenticated object that contains an CMS Authenticated Data object
Parsing class for an CMS Authenticated Data object from an input stream.
Note: that because we are in a streaming mode only one recipient can be tried and it is important
that the methods on the parser are called in the appropriate order.
Example of use - assuming the first recipient matches the private key we have.
CMSAuthenticatedDataParser ad = new CMSAuthenticatedDataParser(inputStream);
RecipientInformationStore recipients = ad.getRecipientInfos();
Collection c = recipients.getRecipients();
Iterator it = c.iterator();
if (it.hasNext())
{
RecipientInformation recipient = (RecipientInformation)it.next();
CMSTypedStream recData = recipient.getContentStream(privateKey, "BC");
processDataStream(recData.getContentStream());
if (!Arrays.equals(ad.getMac(), recipient.getMac())
{
System.err.println("Data corrupted!!!!");
}
}
Note: this class does not introduce buffering - if you are processing large files you should create
the parser with:
CMSAuthenticatedDataParser ep = new CMSAuthenticatedDataParser(new BufferedInputStream(inputStream, bufSize));
where bufSize is a suitably large buffer size.
Close the underlying data stream.
@throws IOException if the close fails.
return a store of the intended recipients for this message
return a table of the unauthenticated attributes indexed by
the OID of the attribute.
@exception java.io.IOException
return a table of the unauthenticated attributes indexed by
the OID of the attribute.
@exception java.io.IOException
return the object identifier for the mac algorithm.
return the ASN.1 encoded encryption algorithm parameters, or null if
there aren't any.
General class for generating a CMS authenticated-data message stream.
A simple example of usage.
CMSAuthenticatedDataStreamGenerator edGen = new CMSAuthenticatedDataStreamGenerator();
edGen.addKeyTransRecipient(cert);
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
OutputStream out = edGen.open(
bOut, CMSAuthenticatedDataGenerator.AES128_CBC, "BC");*
out.write(data);
out.close();
base constructor
constructor allowing specific source of randomness
@param rand instance of SecureRandom to use
Set the underlying string size for encapsulated data
@param bufferSize length of octet strings to buffer the data.
Use a BER Set to store the recipient information
generate an enveloped object that contains an CMS Enveloped Data
object using the given provider and the passed in key generator.
@throws java.io.IOException
generate an enveloped object that contains an CMS Enveloped Data object
generate an enveloped object that contains an CMS Enveloped Data object
containing class for an CMS AuthEnveloped Data object
containing class for an CMS Compressed Data object
Return the uncompressed content.
@return the uncompressed content
@throws CmsException if there is an exception uncompressing the data.
Return the uncompressed content, throwing an exception if the data size
is greater than the passed in limit. If the content is exceeded getCause()
on the CMSException will contain a StreamOverflowException
@param limit maximum number of bytes to read
@return the content read
@throws CMSException if there is an exception uncompressing the data.
return the ASN.1 encoded representation of this object.
return the ContentInfo
* General class for generating a compressed CMS message.
*
* A simple example of usage.
*
*
* CMSCompressedDataGenerator fact = new CMSCompressedDataGenerator();
* CMSCompressedData data = fact.Generate(content, algorithm);
*
*
Generate an object that contains an CMS Compressed Data
Class for reading a CMS Compressed Data stream.
CMSCompressedDataParser cp = new CMSCompressedDataParser(inputStream);
process(cp.GetContent().GetContentStream());
Note: this class does not introduce buffering - if you are processing large files you should create
the parser with:
CMSCompressedDataParser ep = new CMSCompressedDataParser(new BufferedInputStream(inputStream, bufSize));
where bufSize is a suitably large buffer size.
General class for generating a compressed CMS message stream.
A simple example of usage.
CMSCompressedDataStreamGenerator gen = new CMSCompressedDataStreamGenerator();
Stream cOut = gen.Open(outputStream, CMSCompressedDataStreamGenerator.ZLIB);
cOut.Write(data);
cOut.Close();
base constructor
Set the underlying string size for encapsulated data
@param bufferSize length of octet strings to buffer the data.
containing class for an CMS Enveloped Data object
return a store of the intended recipients for this message
return a table of the unprotected attributes indexed by
the OID of the attribute.
return the ASN.1 encoded representation of this object.
return the object identifier for the content encryption algorithm.
return the ContentInfo
General class for generating a CMS enveloped-data message.
A simple example of usage.
CmsEnvelopedDataGenerator fact = new CmsEnvelopedDataGenerator();
fact.AddKeyTransRecipient(cert);
CmsEnvelopedData data = fact.Generate(content, algorithm);
Constructor allowing specific source of randomness
Instance of SecureRandom to use.
Generate an enveloped object that contains a CMS Enveloped Data
object using the passed in key generator.
Generate an enveloped object that contains an CMS Enveloped Data object.
Generate an enveloped object that contains an CMS Enveloped Data object.
Parsing class for an CMS Enveloped Data object from an input stream.
Note: that because we are in a streaming mode only one recipient can be tried and it is important
that the methods on the parser are called in the appropriate order.
Example of use - assuming the first recipient matches the private key we have.
CmsEnvelopedDataParser ep = new CmsEnvelopedDataParser(inputStream);
RecipientInformationStore recipients = ep.GetRecipientInfos();
Collection c = recipients.getRecipients();
Iterator it = c.iterator();
if (it.hasNext())
{
RecipientInformation recipient = (RecipientInformation)it.next();
CMSTypedStream recData = recipient.getContentStream(privateKey);
processDataStream(recData.getContentStream());
}
Note: this class does not introduce buffering - if you are processing large files you should create
the parser with:
CmsEnvelopedDataParser ep = new CmsEnvelopedDataParser(new BufferedInputStream(inputStream, bufSize));
where bufSize is a suitably large buffer size.
return a store of the intended recipients for this message
return a table of the unprotected attributes indexed by
the OID of the attribute.
@throws IOException
return the object identifier for the content encryption algorithm.
return the ASN.1 encoded encryption algorithm parameters, or null if
there aren't any.
General class for generating a CMS enveloped-data message stream.
A simple example of usage.
CmsEnvelopedDataStreamGenerator edGen = new CmsEnvelopedDataStreamGenerator();
edGen.AddKeyTransRecipient(cert);
MemoryStream bOut = new MemoryStream();
Stream out = edGen.Open(
bOut, CMSEnvelopedDataGenerator.AES128_CBC);*
out.Write(data);
out.Close();
Constructor allowing specific source of randomness
Instance of SecureRandom to use.
Set the underlying string size for encapsulated data.
Length of octet strings to buffer the data.
Use a BER Set to store the recipient information.
Generate an enveloped object that contains an CMS Enveloped Data
object using the passed in key generator.
generate an enveloped object that contains an CMS Enveloped Data object
@throws IOException
generate an enveloped object that contains an CMS Enveloped Data object
@throws IOException
all parameter classes implement this.
Generic routine to copy out the data we want processed.
This routine may be called multiple times.
a holding class for a byte array of data to be processed.
A clone of the byte array
a holding class for a file of data to be processed.
The file handle
general class for handling a pkcs7-signature message.
A simple example of usage - note, in the example below the validity of
the certificate isn't verified, just the fact that one of the certs
matches the given signer...
IX509Store certs = s.GetCertificates();
SignerInformationStore signers = s.GetSignerInfos();
foreach (SignerInformation signer in signers.GetSigners())
{
ArrayList certList = new ArrayList(certs.GetMatches(signer.SignerID));
X509Certificate cert = (X509Certificate) certList[0];
if (signer.Verify(cert.GetPublicKey()))
{
verified++;
}
}
Content with detached signature, digests precomputed
@param hashes a map of precomputed digests for content indexed by name of hash.
@param sigBlock the signature object.
base constructor - content with detached signature.
@param signedContent the content that was signed.
@param sigData the signature object.
base constructor - with encapsulated content
return the collection of signers that are associated with the
signatures for the message.
return a X509Store containing the attribute certificates, if any, contained
in this message.
@param type type of store to create
@return a store of attribute certificates
@exception NoSuchStoreException if the store type isn't available.
@exception CmsException if a general exception prevents creation of the X509Store
return a X509Store containing the public key certificates, if any, contained
in this message.
@param type type of store to create
@return a store of public key certificates
@exception NoSuchStoreException if the store type isn't available.
@exception CmsException if a general exception prevents creation of the X509Store
return a X509Store containing CRLs, if any, contained
in this message.
@param type type of store to create
@return a store of CRLs
@exception NoSuchStoreException if the store type isn't available.
@exception CmsException if a general exception prevents creation of the X509Store
return the ASN.1 encoded representation of this object.
Replace the signerinformation store associated with this
CmsSignedData object with the new one passed in. You would
probably only want to do this if you wanted to change the unsigned
attributes associated with a signer, or perhaps delete one.
@param signedData the signed data object to be used as a base.
@param signerInformationStore the new signer information store to use.
@return a new signed data object.
Replace the certificate and CRL information associated with this
CmsSignedData object with the new one passed in.
@param signedData the signed data object to be used as a base.
@param x509Certs the new certificates to be used.
@param x509Crls the new CRLs to be used.
@return a new signed data object.
@exception CmsException if there is an error processing the stores
Return the version number for this object.
Return the DerObjectIdentifier associated with the encapsulated
content info structure carried in the signed data.
return the ContentInfo
* general class for generating a pkcs7-signature message.
*
* A simple example of usage.
*
*
* IX509Store certs...
* IX509Store crls...
* CmsSignedDataGenerator gen = new CmsSignedDataGenerator();
*
* gen.AddSigner(privKey, cert, CmsSignedGenerator.DigestSha1);
* gen.AddCertificates(certs);
* gen.AddCrls(crls);
*
* CmsSignedData data = gen.Generate(content);
*
*
Default type for the signed data.
Constructor allowing specific source of randomness
Instance of SecureRandom to use.
Add the attribute certificates contained in the passed in store to the
generator.
@param store a store of Version 2 attribute certificates
@throws CmsException if an error occurse processing the store.
Add a store of precalculated signers to the generator.
@param signerStore store of signers
Return a map of oids and byte arrays representing the digests calculated on the content during
the last generate.
@return a map of oids (as String objects) and byte[] representing digests.
Constructor allowing specific source of randomness
Instance of SecureRandom to use.
* add a signer - no attributes other than the default ones will be
* provided here.
*
* @param key signing key to use
* @param cert certificate containing corresponding public key
* @param digestOID digest algorithm OID
add a signer, specifying the digest encryption algorithm to use - no attributes other than the default ones will be
provided here.
@param key signing key to use
@param cert certificate containing corresponding public key
@param encryptionOID digest encryption algorithm OID
@param digestOID digest algorithm OID
add a signer - no attributes other than the default ones will be
provided here.
add a signer, specifying the digest encryption algorithm to use - no attributes other than the default ones will be
provided here.
* add a signer with extra signed/unsigned attributes.
*
* @param key signing key to use
* @param cert certificate containing corresponding public key
* @param digestOID digest algorithm OID
* @param signedAttr table of attributes to be included in signature
* @param unsignedAttr table of attributes to be included as unsigned
add a signer, specifying the digest encryption algorithm, with extra signed/unsigned attributes.
@param key signing key to use
@param cert certificate containing corresponding public key
@param encryptionOID digest encryption algorithm OID
@param digestOID digest algorithm OID
@param signedAttr table of attributes to be included in signature
@param unsignedAttr table of attributes to be included as unsigned
* add a signer with extra signed/unsigned attributes.
*
* @param key signing key to use
* @param subjectKeyID subjectKeyID of corresponding public key
* @param digestOID digest algorithm OID
* @param signedAttr table of attributes to be included in signature
* @param unsignedAttr table of attributes to be included as unsigned
add a signer, specifying the digest encryption algorithm, with extra signed/unsigned attributes.
@param key signing key to use
@param subjectKeyID subjectKeyID of corresponding public key
@param encryptionOID digest encryption algorithm OID
@param digestOID digest algorithm OID
@param signedAttr table of attributes to be included in signature
@param unsignedAttr table of attributes to be included as unsigned
add a signer with extra signed/unsigned attributes based on generators.
add a signer, specifying the digest encryption algorithm, with extra signed/unsigned attributes based on generators.
add a signer with extra signed/unsigned attributes based on generators.
add a signer, including digest encryption algorithm, with extra signed/unsigned attributes based on generators.
generate a signed object that for a CMS Signed Data object
generate a signed object that for a CMS Signed Data
object - if encapsulate is true a copy
of the message will be included in the signature. The content type
is set according to the OID represented by the string signedContentType.
generate a signed object that for a CMS Signed Data
object - if encapsulate is true a copy
of the message will be included in the signature with the
default content type "data".
generate a set of one or more SignerInformation objects representing counter signatures on
the passed in SignerInformation object.
@param signer the signer to be countersigned
@param sigProvider the provider to be used for counter signing.
@return a store containing the signers.
Parsing class for an CMS Signed Data object from an input stream.
Note: that because we are in a streaming mode only one signer can be tried and it is important
that the methods on the parser are called in the appropriate order.
A simple example of usage for an encapsulated signature.
Two notes: first, in the example below the validity of
the certificate isn't verified, just the fact that one of the certs
matches the given signer, and, second, because we are in a streaming
mode the order of the operations is important.
CmsSignedDataParser sp = new CmsSignedDataParser(encapSigData);
sp.GetSignedContent().Drain();
IX509Store certs = sp.GetCertificates();
SignerInformationStore signers = sp.GetSignerInfos();
foreach (SignerInformation signer in signers.GetSigners())
{
ArrayList certList = new ArrayList(certs.GetMatches(signer.SignerID));
X509Certificate cert = (X509Certificate) certList[0];
Console.WriteLine("verify returns: " + signer.Verify(cert));
}
Note also: this class does not introduce buffering - if you are processing large files you should create
the parser with:
CmsSignedDataParser ep = new CmsSignedDataParser(new BufferedInputStream(encapSigData, bufSize));
where bufSize is a suitably large buffer size.
base constructor - with encapsulated content
base constructor
@param signedContent the content that was signed.
@param sigData the signature object.
return the collection of signers that are associated with the
signatures for the message.
@throws CmsException
return a X509Store containing the attribute certificates, if any, contained
in this message.
@param type type of store to create
@return a store of attribute certificates
@exception org.bouncycastle.x509.NoSuchStoreException if the store type isn't available.
@exception CmsException if a general exception prevents creation of the X509Store
return a X509Store containing the public key certificates, if any, contained
in this message.
@param type type of store to create
@return a store of public key certificates
@exception NoSuchStoreException if the store type isn't available.
@exception CmsException if a general exception prevents creation of the X509Store
return a X509Store containing CRLs, if any, contained
in this message.
@param type type of store to create
@return a store of CRLs
@exception NoSuchStoreException if the store type isn't available.
@exception CmsException if a general exception prevents creation of the X509Store
Replace the signerinformation store associated with the passed
in message contained in the stream original with the new one passed in.
You would probably only want to do this if you wanted to change the unsigned
attributes associated with a signer, or perhaps delete one.
The output stream is returned unclosed.
@param original the signed data stream to be used as a base.
@param signerInformationStore the new signer information store to use.
@param out the stream to Write the new signed data object to.
@return out.
Replace the certificate and CRL information associated with this
CMSSignedData object with the new one passed in.
The output stream is returned unclosed.
@param original the signed data stream to be used as a base.
@param certsAndCrls the new certificates and CRLs to be used.
@param out the stream to Write the new signed data object to.
@return out.
@exception CmsException if there is an error processing the CertStore
Return the version number for the SignedData object
@return the version number
Return the DerObjectIdentifier associated with the encapsulated
content info structure carried in the signed data.
General class for generating a pkcs7-signature message stream.
A simple example of usage.
IX509Store certs...
CmsSignedDataStreamGenerator gen = new CmsSignedDataStreamGenerator();
gen.AddSigner(privateKey, cert, CmsSignedDataStreamGenerator.DIGEST_SHA1);
gen.AddCertificates(certs);
Stream sigOut = gen.Open(bOut);
sigOut.Write(Encoding.UTF8.GetBytes("Hello World!"));
sigOut.Close();
Constructor allowing specific source of randomness
Instance of SecureRandom to use.
Set the underlying string size for encapsulated data
@param bufferSize length of octet strings to buffer the data.
add a signer - no attributes other than the default ones will be
provided here.
@throws NoSuchAlgorithmException
@throws InvalidKeyException
add a signer, specifying the digest encryption algorithm - no attributes other than the default ones will be
provided here.
@throws NoSuchProviderException
@throws NoSuchAlgorithmException
@throws InvalidKeyException
add a signer with extra signed/unsigned attributes.
@throws NoSuchAlgorithmException
@throws InvalidKeyException
add a signer with extra signed/unsigned attributes - specifying digest
encryption algorithm.
@throws NoSuchProviderException
@throws NoSuchAlgorithmException
@throws InvalidKeyException
add a signer - no attributes other than the default ones will be
provided here.
@throws NoSuchAlgorithmException
@throws InvalidKeyException
add a signer - no attributes other than the default ones will be
provided here.
@throws NoSuchProviderException
@throws NoSuchAlgorithmException
@throws InvalidKeyException
add a signer with extra signed/unsigned attributes.
@throws NoSuchAlgorithmException
@throws InvalidKeyException
generate a signed object that for a CMS Signed Data object
generate a signed object that for a CMS Signed Data
object - if encapsulate is true a copy
of the message will be included in the signature with the
default content type "data".
generate a signed object that for a CMS Signed Data
object using the given provider - if encapsulate is true a copy
of the message will be included in the signature with the
default content type "data". If dataOutputStream is non null the data
being signed will be written to the stream as it is processed.
@param out stream the CMS object is to be written to.
@param encapsulate true if data should be encapsulated.
@param dataOutputStream output stream to copy the data being signed to.
generate a signed object that for a CMS Signed Data
object - if encapsulate is true a copy
of the message will be included in the signature. The content type
is set according to the OID represented by the string signedContentType.
generate a signed object that for a CMS Signed Data
object using the given provider - if encapsulate is true a copy
of the message will be included in the signature. The content type
is set according to the OID represented by the string signedContentType.
@param out stream the CMS object is to be written to.
@param signedContentType OID for data to be signed.
@param encapsulate true if data should be encapsulated.
@param dataOutputStream output stream to copy the data being signed to.
Return the digest algorithm using one of the standard JCA string
representations rather than the algorithm identifier (if possible).
Return the digest encryption algorithm using one of the standard
JCA string representations rather than the algorithm identifier (if
possible).
Default signed attributes generator.
Initialise to use all defaults
Initialise with some extra attributes or overrides.
@param attributeTable initial attribute table to use.
Create a standard attribute table from the passed in parameters - this will
normally include contentType, signingTime, and messageDigest. If the constructor
using an AttributeTable was used, entries in it for contentType, signingTime, and
messageDigest will override the generated ones.
@param parameters source parameters for table generation.
@return a filled in Hashtable of attributes.
@param parameters source parameters
@return the populated attribute table
Generate a RecipientInfo object for the given key.
A
A
A
the RecipientInfo class for a recipient who has been sent a message
encrypted using a secret key known to the other side.
Return the MAC calculated for the content stream. Note: this call is only meaningful once all
the content has been read.
@return byte array containing the mac.
* return the object identifier for the key encryption algorithm.
*
* @return OID for key encryption algorithm.
* return the ASN.1 encoded key encryption algorithm parameters, or null if
* there aren't any.
*
* @return ASN.1 encoding of key encryption algorithm parameters.
decrypt the content and return an input stream.
the RecipientInfo class for a recipient who has been sent a message
encrypted using key agreement.
decrypt the content and return an input stream.
the KeyTransRecipientInformation class for a recipient who has been sent a secret
key encrypted using their public key that needs to be used to
extract the message.
decrypt the content and return it as a byte array.
a basic index for an originator.
An ISet
of DerObjectIdentifier
objects.
the RecipientInfo class for a recipient who has been sent a message
encrypted using a password.
decrypt the content and return an input stream.
return the object identifier for the key derivation algorithm, or null
if there is none present.
@return OID for key derivation algorithm, if present.
PKCS5 scheme-2 - password converted to bytes assuming ASCII.
PKCS5 scheme-2 - password converted to bytes using UTF-8.
Return the first RecipientInformation object that matches the
passed in selector. Null if there are no matches.
@param selector to identify a recipient
@return a single RecipientInformation object. Null if none matches.
Return all recipients in the collection
@return a collection of recipients.
Return possible empty collection with recipients matching the passed in RecipientID
@param selector a recipient id to select against.
@return a collection of RecipientInformation objects.
Return the number of recipients in the collection.
@return number of recipients identified.
a basic index for a signer.
an expanded SignerInfo block from a CMS Signed message
return the content digest that was calculated during verification.
return the encoded signature
Return a SignerInformationStore containing the counter signatures attached to this
signer. If no counter signatures are present an empty store is returned.
return the DER encoding of the signed attributes.
@throws IOException if an encoding error occurs.
verify that the given public key successfully handles and confirms the
signature associated with this signer.
verify that the given certificate successfully handles and confirms
the signature associated with this signer and, if a signingTime
attribute is available, that the certificate was valid at the time the
signature was generated.
Return the base ASN.1 CMS structure that this object contains.
@return an object containing a CMS SignerInfo structure.
Return a signer information object with the passed in unsigned
attributes replacing the ones that are current associated with
the object passed in.
@param signerInformation the signerInfo to be used as the basis.
@param unsignedAttributes the unsigned attributes to add.
@return a copy of the original SignerInformationObject with the changed attributes.
Return a signer information object with passed in SignerInformationStore representing counter
signatures attached as an unsigned attribute.
@param signerInformation the signerInfo to be used as the basis.
@param counterSigners signer info objects carrying counter signature.
@return a copy of the original SignerInformationObject with the changed attributes.
return the version number for this objects underlying SignerInfo structure.
return the object identifier for the signature.
return the signature parameters, or null if there aren't any.
return the object identifier for the signature.
return the signature/encryption algorithm parameters, or null if
there aren't any.
return a table of the signed attributes - indexed by
the OID of the attribute.
return a table of the unsigned attributes indexed by
the OID of the attribute.
Return the first SignerInformation object that matches the
passed in selector. Null if there are no matches.
@param selector to identify a signer
@return a single SignerInformation object. Null if none matches.
An ICollection of all signers in the collection
Return possible empty collection with signers matching the passed in SignerID
@param selector a signer id to select against.
@return a collection of SignerInformation objects.
The number of signers in the collection.
Basic generator that just returns a preconstructed attribute table
a Diffie-Hellman key exchange engine.
note: This uses MTI/A0 key agreement in order to make the key agreement
secure against passive attacks. If you're doing Diffie-Hellman and both
parties have long term public keys you should look at using this. For
further information have a look at RFC 2631.
It's possible to extend this to more than two parties as well, for the moment
that is left as an exercise for the reader.
calculate our initial message.
given a message from a given party and the corresponding public key
calculate the next message in the agreement sequence. In this case
this will represent the shared secret.
a Diffie-Hellman key agreement class.
note: This is only the basic algorithm, it doesn't take advantage of
long term public keys if they are available. See the DHAgreement class
for a "better" implementation.
The basic interface that basic Diffie-Hellman implementations
conforms to.
initialise the agreement engine.
return the field size for the agreement algorithm in bytes.
given a public key from a given party calculate the next
message in the agreement sequence.
given a short term public key from a given party calculate the next
message in the agreement sequence.
P1363 7.2.1 ECSVDP-DH
ECSVDP-DH is Elliptic Curve Secret Value Derivation Primitive,
Diffie-Hellman version. It is based on the work of [DH76], [Mil86],
and [Kob87]. This primitive derives a shared secret value from one
party's private key and another party's public key, where both have
the same set of EC domain parameters. If two parties correctly
execute this primitive, they will produce the same output. This
primitive can be invoked by a scheme to derive a shared secret key;
specifically, it may be used with the schemes ECKAS-DH1 and
DL/ECKAS-DH2. It assumes that the input keys are valid (see also
Section 7.2.2).
P1363 7.2.2 ECSVDP-DHC
ECSVDP-DHC is Elliptic Curve Secret Value Derivation Primitive,
Diffie-Hellman version with cofactor multiplication. It is based on
the work of [DH76], [Mil86], [Kob87], [LMQ98] and [Kal98a]. This
primitive derives a shared secret value from one party's private key
and another party's public key, where both have the same set of EC
domain parameters. If two parties correctly execute this primitive,
they will produce the same output. This primitive can be invoked by a
scheme to derive a shared secret key; specifically, it may be used
with the schemes ECKAS-DH1 and DL/ECKAS-DH2. It does not assume the
validity of the input public key (see also Section 7.2.1).
Note: As stated P1363 compatibility mode with ECDH can be preset, and
in this case the implementation doesn't have a ECDH compatibility mode
(if you want that just use ECDHBasicAgreement and note they both implement
BasicAgreement!).
Parameters for key/byte stream derivation classes
RFC 2631 Diffie-hellman KEK derivation function.
base interface for general purpose byte derivation functions.
return the message digest used as the basis for the function
X9.63 based key derivation function for ECDH CMS.
Implements the client side SRP-6a protocol. Note that this class is stateful, and therefore NOT threadsafe.
This implementation of SRP is based on the optimized message sequence put forth by Thomas Wu in the paper
"SRP-6: Improvements and Refinements to the Secure Remote Password Protocol, 2002"
Initialises the client to begin new authentication attempt
@param N The safe prime associated with the client's verifier
@param g The group parameter associated with the client's verifier
@param digest The digest algorithm associated with the client's verifier
@param random For key generation
Generates client's credentials given the client's salt, identity and password
@param salt The salt used in the client's verifier.
@param identity The user's identity (eg. username)
@param password The user's password
@return Client's public value to send to server
Generates client's verification message given the server's credentials
@param serverB The server's credentials
@return Client's verification message for the server
@throws CryptoException If server's credentials are invalid
Implements the server side SRP-6a protocol. Note that this class is stateful, and therefore NOT threadsafe.
This implementation of SRP is based on the optimized message sequence put forth by Thomas Wu in the paper
"SRP-6: Improvements and Refinements to the Secure Remote Password Protocol, 2002"
Initialises the server to accept a new client authentication attempt
@param N The safe prime associated with the client's verifier
@param g The group parameter associated with the client's verifier
@param v The client's verifier
@param digest The digest algorithm associated with the client's verifier
@param random For key generation
Generates the server's credentials that are to be sent to the client.
@return The server's public value to the client
Processes the client's credentials. If valid the shared secret is generated and returned.
@param clientA The client's credentials
@return A shared secret BigInteger
@throws CryptoException If client's credentials are invalid
Generates new SRP verifier for user
Initialises generator to create new verifiers
@param N The safe prime to use (see DHParametersGenerator)
@param g The group parameter to use (see DHParametersGenerator)
@param digest The digest to use. The same digest type will need to be used later for the actual authentication
attempt. Also note that the final session key size is dependent on the chosen digest.
Creates a new SRP verifier
@param salt The salt to use, generally should be large and random
@param identity The user's identifying information (eg. username)
@param password The user's password
@return A new verifier for use in future SRP authentication
a holding class for public/private parameter pairs.
basic constructor.
@param publicParam a public key parameters object.
@param privateParam the corresponding private key parameters.
return the public key parameters.
@return the public key parameters.
return the private key parameters.
@return the private key parameters.
The AEAD block ciphers already handle buffering internally, so this class
just takes care of implementing IBufferedCipher methods.
Block cipher engines are expected to conform to this interface.
Initialise the cipher.
If true the cipher is initialised for encryption,
if false for decryption.
The key and other data required by the cipher.
Reset the cipher. After resetting the cipher is in the same state
as it was after the last init (if there was one).
The name of the algorithm this cipher implements.
initialise the cipher.
@param forEncryption if true the cipher is initialised for
encryption, if false for decryption.
@param param the key and other data required by the cipher.
@exception ArgumentException if the parameters argument is
inappropriate.
return the blocksize for the underlying cipher.
@return the blocksize for the underlying cipher.
return the size of the output buffer required for an update
an input of len bytes.
@param len the length of the input.
@return the space required to accommodate a call to update
with len bytes of input.
return the size of the output buffer required for an update plus a
doFinal with an input of len bytes.
@param len the length of the input.
@return the space required to accommodate a call to update and doFinal
with len bytes of input.
process a single byte, producing an output block if neccessary.
@param in the input byte.
@param out the space for any output that might be produced.
@param outOff the offset from which the output will be copied.
@return the number of output bytes copied to out.
@exception DataLengthException if there isn't enough space in out.
@exception InvalidOperationException if the cipher isn't initialised.
process an array of bytes, producing output if necessary.
@param in the input byte array.
@param inOff the offset at which the input data starts.
@param len the number of bytes to be copied out of the input array.
@param out the space for any output that might be produced.
@param outOff the offset from which the output will be copied.
@return the number of output bytes copied to out.
@exception DataLengthException if there isn't enough space in out.
@exception InvalidOperationException if the cipher isn't initialised.
Process the last block in the buffer.
@param out the array the block currently being held is copied into.
@param outOff the offset at which the copying starts.
@return the number of output bytes copied to out.
@exception DataLengthException if there is insufficient space in out for
the output, or the input is not block size aligned and should be.
@exception InvalidOperationException if the underlying cipher is not
initialised.
@exception InvalidCipherTextException if padding is expected and not found.
@exception DataLengthException if the input is not block size
aligned.
Reset the buffer and cipher. After resetting the object is in the same
state as it was after the last init (if there was one).
a buffer wrapper for an asymmetric block cipher, allowing input
to be accumulated in a piecemeal fashion until final processing.
base constructor.
@param cipher the cipher this buffering object wraps.
return the amount of data sitting in the buffer.
@return the amount of data sitting in the buffer.
initialise the buffer and the underlying cipher.
@param forEncryption if true the cipher is initialised for
encryption, if false for decryption.
@param param the key and other data required by the cipher.
process the contents of the buffer using the underlying
cipher.
@return the result of the encryption/decryption process on the
buffer.
@exception InvalidCipherTextException if we are given a garbage block.
Reset the buffer
A wrapper class that allows block ciphers to be used to process data in
a piecemeal fashion. The BufferedBlockCipher outputs a block only when the
buffer is full and more data is being added, or on a doFinal.
Note: in the case where the underlying cipher is either a CFB cipher or an
OFB one the last block may not be a multiple of the block size.
constructor for subclasses
Create a buffered block cipher without padding.
@param cipher the underlying block cipher this buffering object wraps.
false otherwise.
initialise the cipher.
@param forEncryption if true the cipher is initialised for
encryption, if false for decryption.
@param param the key and other data required by the cipher.
@exception ArgumentException if the parameters argument is
inappropriate.
return the blocksize for the underlying cipher.
@return the blocksize for the underlying cipher.
return the size of the output buffer required for an update
an input of len bytes.
@param len the length of the input.
@return the space required to accommodate a call to update
with len bytes of input.
return the size of the output buffer required for an update plus a
doFinal with an input of len bytes.
@param len the length of the input.
@return the space required to accommodate a call to update and doFinal
with len bytes of input.
process a single byte, producing an output block if neccessary.
@param in the input byte.
@param out the space for any output that might be produced.
@param outOff the offset from which the output will be copied.
@return the number of output bytes copied to out.
@exception DataLengthException if there isn't enough space in out.
@exception InvalidOperationException if the cipher isn't initialised.
process an array of bytes, producing output if necessary.
@param in the input byte array.
@param inOff the offset at which the input data starts.
@param len the number of bytes to be copied out of the input array.
@param out the space for any output that might be produced.
@param outOff the offset from which the output will be copied.
@return the number of output bytes copied to out.
@exception DataLengthException if there isn't enough space in out.
@exception InvalidOperationException if the cipher isn't initialised.
Process the last block in the buffer.
@param out the array the block currently being held is copied into.
@param outOff the offset at which the copying starts.
@return the number of output bytes copied to out.
@exception DataLengthException if there is insufficient space in out for
the output, or the input is not block size aligned and should be.
@exception InvalidOperationException if the underlying cipher is not
initialised.
@exception InvalidCipherTextException if padding is expected and not found.
@exception DataLengthException if the input is not block size
aligned.
Reset the buffer and cipher. After resetting the object is in the same
state as it was after the last init (if there was one).
The base class for symmetric, or secret, cipher key generators.
initialise the key generator.
@param param the parameters to be used for key generation
Generate a secret key.
@return a byte array containing the key value.
this exception is thrown if a buffer that is meant to have output
copied into it turns out to be too short, or if we've been given
insufficient input. In general this exception will Get thrown rather
than an ArrayOutOfBounds exception.
base constructor.
create a DataLengthException with the given message.
@param message the message to be carried with the exception.
base implementation of MD4 family style digest as outlined in
"Handbook of Applied Cryptography", pages 344 - 347.
interface that a message digest conforms to.
return the size, in bytes, of the digest produced by this message digest.
@return the size, in bytes, of the digest produced by this message digest.
return the size, in bytes, of the internal buffer used by this digest.
@return the size, in bytes, of the internal buffer used by this digest.
update the message digest with a single byte.
@param inByte the input byte to be entered.
update the message digest with a block of bytes.
@param input the byte array containing the data.
@param inOff the offset into the byte array where the data starts.
@param len the length of the data.
Close the digest, producing the final digest value. The doFinal
call leaves the digest reset.
@param output the array the digest is to be copied into.
@param outOff the offset into the out array the digest is to start at.
reset the digest back to it's initial state.
return the algorithm name
@return the algorithm name
implementation of GOST R 34.11-94
Standard constructor
Constructor to allow use of a particular sbox with GOST28147
@see GOST28147Engine#getSBox(String)
Copy constructor. This will copy the state of the provided
message digest.
reset the chaining variables to the IV values.
Base class for SHA-384 and SHA-512.
Constructor for variable length word
Copy constructor. We are using copy constructors in place
of the object.Clone() interface as this interface is not
supported by J2ME.
adjust the byte counts so that byteCount2 represents the
upper long (less 3 bits) word of the byte count.
implementation of MD2
as outlined in RFC1319 by B.Kaliski from RSA Laboratories April 1992
Close the digest, producing the final digest value. The doFinal
call leaves the digest reset.
@param out the array the digest is to be copied into.
@param outOff the offset into the out array the digest is to start at.
reset the digest back to it's initial state.
update the message digest with a single byte.
@param in the input byte to be entered.
update the message digest with a block of bytes.
@param in the byte array containing the data.
@param inOff the offset into the byte array where the data starts.
@param len the length of the data.
return the algorithm name
@return the algorithm name
implementation of MD4 as RFC 1320 by R. Rivest, MIT Laboratory for
Computer Science and RSA Data Security, Inc.
NOTE: This algorithm is only included for backwards compatibility
with legacy applications, it's not secure, don't use it for anything new!
Standard constructor
Copy constructor. This will copy the state of the provided
message digest.
reset the chaining variables to the IV values.
implementation of MD5 as outlined in "Handbook of Applied Cryptography", pages 346 - 347.
Copy constructor. This will copy the state of the provided
message digest.
reset the chaining variables to the IV values.
implementation of RipeMD128
Standard constructor
Copy constructor. This will copy the state of the provided
message digest.
reset the chaining variables to the IV values.
implementation of RipeMD see,
http://www.esat.kuleuven.ac.be/~bosselae/ripemd160.html
Standard constructor
Copy constructor. This will copy the state of the provided
message digest.
reset the chaining variables to the IV values.
Implementation of RipeMD256.
Note: this algorithm offers the same level of security as RipeMD128.
Standard constructor
Copy constructor. This will copy the state of the provided
message digest.
reset the chaining variables to the IV values.
Implementation of RipeMD 320.
Note: this algorithm offers the same level of security as RipeMD160.
Standard constructor
Copy constructor. This will copy the state of the provided
message digest.
reset the chaining variables to the IV values.
implementation of SHA-1 as outlined in "Handbook of Applied Cryptography", pages 346 - 349.
It is interesting to ponder why the, apart from the extra IV, the other difference here from MD5
is the "endianness" of the word processing!
Copy constructor. This will copy the state of the provided
message digest.
reset the chaining variables
SHA-224 as described in RFC 3874
block word digest
SHA-1 512 32 160
SHA-224 512 32 224
SHA-256 512 32 256
SHA-384 1024 64 384
SHA-512 1024 64 512
Standard constructor
Copy constructor. This will copy the state of the provided
message digest.
reset the chaining variables
Draft FIPS 180-2 implementation of SHA-256. Note: As this is
based on a draft this implementation is subject to change.
block word digest
SHA-1 512 32 160
SHA-256 512 32 256
SHA-384 1024 64 384
SHA-512 1024 64 512
Copy constructor. This will copy the state of the provided
message digest.
reset the chaining variables
Draft FIPS 180-2 implementation of SHA-384. Note: As this is
based on a draft this implementation is subject to change.
block word digest
SHA-1 512 32 160
SHA-256 512 32 256
SHA-384 1024 64 384
SHA-512 1024 64 512
Copy constructor. This will copy the state of the provided
message digest.
reset the chaining variables
Implementation of SHA-3 based on following KeccakNISTInterface.c from http://keccak.noekeon.org/
Following the naming conventions used in the C source code to enable easy review of the implementation.
Return the size of block that the compression function is applied to in bytes.
@return internal byte length of a block.
Draft FIPS 180-2 implementation of SHA-512. Note: As this is
based on a draft this implementation is subject to change.
block word digest
SHA-1 512 32 160
SHA-256 512 32 256
SHA-384 1024 64 384
SHA-512 1024 64 512
Copy constructor. This will copy the state of the provided
message digest.
reset the chaining variables
FIPS 180-4 implementation of SHA-512/t
Standard constructor
Copy constructor. This will copy the state of the provided
message digest.
reset the chaining variables
Wrapper class that reduces the output length of a particular digest to
only the first n bytes of the digest function.
Base constructor.
@param baseDigest underlying digest to use.
@param length length in bytes of the output of doFinal.
@exception ArgumentException if baseDigest is null, or length is greater than baseDigest.GetDigestSize().
implementation of Tiger based on:
http://www.cs.technion.ac.il/~biham/Reports/Tiger
Standard constructor
Copy constructor. This will copy the state of the provided
message digest.
reset the chaining variables
Implementation of WhirlpoolDigest, based on Java source published by Barreto
and Rijmen.
Copy constructor. This will copy the state of the provided message
digest.
Reset the chaining variables
ISO 9796-1 padding. Note in the light of recent results you should
only use this with RSA (rather than the "simpler" Rabin keys) and you
should never use it with anything other than a hash (ie. even if the
message is small don't sign the message, sign it's hash) or some "random"
value. See your favorite search engine for details.
Base interface for a public/private key block cipher.
Initialise the cipher.
Initialise for encryption if true, for decryption if false.
The key or other data required by the cipher.
The maximum size, in bytes, an input block may be.
The maximum size, in bytes, an output block will be.
Process a block.
The input buffer.
The offset into inBuf that the input block begins.
The length of the input block.
Input decrypts improperly.
Input is too large for the cipher.
The name of the algorithm this cipher implements.
return the input block size. The largest message we can process
is (key_size_in_bits + 3)/16, which in our world comes to
key_size_in_bytes / 2.
return the maximum possible size for the output.
set the number of bits in the next message to be treated as
pad bits.
retrieve the number of pad bits in the last decoded message.
@exception InvalidCipherTextException if the decrypted block is not a valid ISO 9796 bit string
Optimal Asymmetric Encryption Padding (OAEP) - see PKCS 1 V 2.
@exception InvalidCipherTextException if the decrypted block turns out to
be badly formatted.
int to octet string.
mask generator function, as described in PKCS1v2.
this does your basic Pkcs 1 v1.5 padding - whether or not you should be using this
depends on your application - see Pkcs1 Version 2 for details.
some providers fail to include the leading zero in PKCS1 encoded blocks. If you need to
work with one of these set the system property Org.BouncyCastle.Pkcs1.Strict to false.
Basic constructor.
@param cipher
@exception InvalidCipherTextException if the decrypted block is not in Pkcs1 format.
The same effect can be achieved by setting the static property directly
The static property is checked during construction of the encoding object, it is set to
true by default.
an implementation of the AES (Rijndael), from FIPS-197.
For further details see: http://csrc.nist.gov/encryption/aes/.
This implementation is based on optimizations from Dr. Brian Gladman's paper and C code at
http://fp.gladman.plus.com/cryptography_technology/rijndael/
There are three levels of tradeoff of speed vs memory
Because java has no preprocessor, they are written as three separate classes from which to choose
The fastest uses 8Kbytes of static tables to precompute round calculations, 4 256 word tables for encryption
and 4 for decryption.
The middle performance version uses only one 256 word table for each, for a total of 2Kbytes,
adding 12 rotate operations per round to compute the values contained in the other tables from
the contents of the first.
The slowest version uses no static tables at all and computes the values in each round.
This file contains the middle performance version with 2Kbytes of static tables for round precomputation.
Base interface for a symmetric key block cipher.
Initialise the cipher.
Initialise for encryption if true, for decryption if false.
The key or other data required by the cipher.
The block size for this cipher, in bytes.
Process a block.
The input buffer.
The offset into inBuf that the input block begins.
The output buffer.
The offset into outBuf to write the output block.
If input block is wrong size, or outBuf too small.
The number of bytes processed and produced.
Reset the cipher to the same state as it was after the last init (if there was one).
The name of the algorithm this cipher implements.
Indicates whether this cipher can handle partial blocks.
Calculate the necessary round keys
The number of calculations depends on key size and block size
AES specified a fixed block size of 128 bits and key sizes 128/192/256 bits
This code is written assuming those are the only possible values
default constructor - 128 bit block size.
initialise an AES cipher.
@param forEncryption whether or not we are for encryption.
@param parameters the parameters required to set up the cipher.
@exception ArgumentException if the parameters argument is
inappropriate.
an implementation of the AES (Rijndael)), from FIPS-197.
For further details see: http://csrc.nist.gov/encryption/aes/.
This implementation is based on optimizations from Dr. Brian Gladman's paper and C code at
http://fp.gladman.plus.com/cryptography_technology/rijndael/
There are three levels of tradeoff of speed vs memory
Because java has no preprocessor), they are written as three separate classes from which to choose
The fastest uses 8Kbytes of static tables to precompute round calculations), 4 256 word tables for encryption
and 4 for decryption.
The middle performance version uses only one 256 word table for each), for a total of 2Kbytes),
adding 12 rotate operations per round to compute the values contained in the other tables from
the contents of the first
The slowest version uses no static tables at all and computes the values in each round
This file contains the fast version with 8Kbytes of static tables for round precomputation
Calculate the necessary round keys
The number of calculations depends on key size and block size
AES specified a fixed block size of 128 bits and key sizes 128/192/256 bits
This code is written assuming those are the only possible values
default constructor - 128 bit block size.
initialise an AES cipher.
@param forEncryption whether or not we are for encryption.
@param parameters the parameters required to set up the cipher.
@exception ArgumentException if the parameters argument is
inappropriate.
an implementation of the AES (Rijndael), from FIPS-197.
For further details see: http://csrc.nist.gov/encryption/aes/.
This implementation is based on optimizations from Dr. Brian Gladman's paper and C code at
http://fp.gladman.plus.com/cryptography_technology/rijndael/
There are three levels of tradeoff of speed vs memory
Because java has no preprocessor, they are written as three separate classes from which to choose
The fastest uses 8Kbytes of static tables to precompute round calculations, 4 256 word tables for encryption
and 4 for decryption.
The middle performance version uses only one 256 word table for each, for a total of 2Kbytes,
adding 12 rotate operations per round to compute the values contained in the other tables from
the contents of the first
The slowest version uses no static tables at all and computes the values
in each round.
This file contains the slowest performance version with no static tables
for round precomputation, but it has the smallest foot print.
Calculate the necessary round keys
The number of calculations depends on key size and block size
AES specified a fixed block size of 128 bits and key sizes 128/192/256 bits
This code is written assuming those are the only possible values
default constructor - 128 bit block size.
initialise an AES cipher.
@param forEncryption whether or not we are for encryption.
@param parameters the parameters required to set up the cipher.
@exception ArgumentException if the parameters argument is
inappropriate.
An implementation of the AES Key Wrapper from the NIST Key Wrap Specification.
For further details see: http://csrc.nist.gov/encryption/kms/key-wrap.pdf.
An implementation of the AES Key Wrapper from the NIST Key Wrap
Specification as described in RFC 3394.
For further details see: http://www.ietf.org/rfc/rfc3394.txt
and http://csrc.nist.gov/encryption/kms/key-wrap.pdf.
The name of the algorithm this cipher implements.
A class that provides Blowfish key encryption operations,
such as encoding data and generating keys.
All the algorithms herein are from Applied Cryptography
and implement a simplified cryptography interface.
initialise a Blowfish cipher.
@param forEncryption whether or not we are for encryption.
@param parameters the parameters required to set up the cipher.
@exception ArgumentException if the parameters argument is
inappropriate.
apply the encryption cycle to each value pair in the table.
Encrypt the given input starting at the given offset and place
the result in the provided buffer starting at the given offset.
The input will be an exact multiple of our blocksize.
Decrypt the given input starting at the given offset and place
the result in the provided buffer starting at the given offset.
The input will be an exact multiple of our blocksize.
Camellia - based on RFC 3713.
Camellia - based on RFC 3713, smaller implementation, about half the size of CamelliaEngine.
An implementation of the Camellia key wrapper based on RFC 3657/RFC 3394.
For further details see: http://www.ietf.org/rfc/rfc3657.txt.
A class that provides CAST key encryption operations,
such as encoding data and generating keys.
All the algorithms herein are from the Internet RFC's
RFC2144 - Cast5 (64bit block, 40-128bit key)
RFC2612 - CAST6 (128bit block, 128-256bit key)
and implement a simplified cryptography interface.
initialise a CAST cipher.
@param forEncryption whether or not we are for encryption.
@param parameters the parameters required to set up the cipher.
@exception ArgumentException if the parameters argument is
inappropriate.
Encrypt the given input starting at the given offset and place
the result in the provided buffer starting at the given offset.
@param src The plaintext buffer
@param srcIndex An offset into src
@param dst The ciphertext buffer
@param dstIndex An offset into dst
Decrypt the given input starting at the given offset and place
the result in the provided buffer starting at the given offset.
@param src The plaintext buffer
@param srcIndex An offset into src
@param dst The ciphertext buffer
@param dstIndex An offset into dst
The first of the three processing functions for the
encryption and decryption.
@param D the input to be processed
@param Kmi the mask to be used from Km[n]
@param Kri the rotation value to be used
The second of the three processing functions for the
encryption and decryption.
@param D the input to be processed
@param Kmi the mask to be used from Km[n]
@param Kri the rotation value to be used
The third of the three processing functions for the
encryption and decryption.
@param D the input to be processed
@param Kmi the mask to be used from Km[n]
@param Kri the rotation value to be used
Does the 16 rounds to encrypt the block.
@param L0 the LH-32bits of the plaintext block
@param R0 the RH-32bits of the plaintext block
A class that provides CAST6 key encryption operations,
such as encoding data and generating keys.
All the algorithms herein are from the Internet RFC
RFC2612 - CAST6 (128bit block, 128-256bit key)
and implement a simplified cryptography interface.
Encrypt the given input starting at the given offset and place
the result in the provided buffer starting at the given offset.
@param src The plaintext buffer
@param srcIndex An offset into src
@param dst The ciphertext buffer
@param dstIndex An offset into dst
Decrypt the given input starting at the given offset and place
the result in the provided buffer starting at the given offset.
@param src The plaintext buffer
@param srcIndex An offset into src
@param dst The ciphertext buffer
@param dstIndex An offset into dst
Does the 12 quad rounds rounds to encrypt the block.
@param A the 00-31 bits of the plaintext block
@param B the 32-63 bits of the plaintext block
@param C the 64-95 bits of the plaintext block
@param D the 96-127 bits of the plaintext block
@param result the resulting ciphertext
Does the 12 quad rounds rounds to decrypt the block.
@param A the 00-31 bits of the ciphertext block
@param B the 32-63 bits of the ciphertext block
@param C the 64-95 bits of the ciphertext block
@param D the 96-127 bits of the ciphertext block
@param result the resulting plaintext
A class that provides a basic DESede (or Triple DES) engine.
A class that provides a basic DES engine.
initialise a DES cipher.
@param forEncryption whether or not we are for encryption.
@param parameters the parameters required to set up the cipher.
@exception ArgumentException if the parameters argument is
inappropriate.
what follows is mainly taken from "Applied Cryptography", by
Bruce Schneier, however it also bears great resemblance to Richard
Outerbridge's D3DES...
Generate an integer based working key based on our secret key
and what we processing we are planning to do.
Acknowledgements for this routine go to James Gillogly and Phil Karn.
(whoever, and wherever they are!).
the DES engine.
initialise a DESede cipher.
@param forEncryption whether or not we are for encryption.
@param parameters the parameters required to set up the cipher.
@exception ArgumentException if the parameters argument is
inappropriate.
* Wrap keys according to
*
* draft-ietf-smime-key-wrap-01.txt.
*
* Note:
*
* - this is based on a draft, and as such is subject to change - don't use this class for anything requiring long term storage.
* - if you are using this to wrap triple-des keys you need to set the
* parity bits on the key and, if it's a two-key triple-des key, pad it
* yourself.
*
*
Field engine
Field param
Field paramPlusIV
Field iv
Field forWrapping
Field IV2
Method init
@param forWrapping
@param param
Method wrap
@param in
@param inOff
@param inLen
@return
Method unwrap
@param in
@param inOff
@param inLen
@return
@throws InvalidCipherTextException
Some key wrap algorithms make use of the Key Checksum defined
in CMS [CMS-Algorithms]. This is used to provide an integrity
check value for the key being wrapped. The algorithm is
- Compute the 20 octet SHA-1 hash on the key being wrapped.
- Use the first 8 octets of this hash as the checksum value.
@param key
@return
@throws Exception
@see http://www.w3.org/TR/xmlenc-core/#sec-CMSKeyChecksum
@param key
@param checksum
@return
@see http://www.w3.org/TR/xmlenc-core/#sec-CMSKeyChecksum
Method GetAlgorithmName
@return
this does your basic ElGamal algorithm.
initialise the ElGamal engine.
@param forEncryption true if we are encrypting, false otherwise.
@param param the necessary ElGamal key parameters.
Return the maximum size for an input block to this engine.
For ElGamal this is always one byte less than the size of P on
encryption, and twice the length as the size of P on decryption.
@return maximum size for an input block.
Return the maximum size for an output block to this engine.
For ElGamal this is always one byte less than the size of P on
decryption, and twice the length as the size of P on encryption.
@return maximum size for an output block.
Process a single block using the basic ElGamal algorithm.
@param in the input array.
@param inOff the offset into the input buffer where the data starts.
@param length the length of the data to be processed.
@return the result of the ElGamal process.
@exception DataLengthException the input block is too large.
implementation of GOST 28147-89
standard constructor.
initialise an Gost28147 cipher.
@param forEncryption whether or not we are for encryption.
@param parameters the parameters required to set up the cipher.
@exception ArgumentException if the parameters argument is inappropriate.
Return the S-Box associated with SBoxName
@param sBoxName name of the S-Box
@return byte array representing the S-Box
HC-128 is a software-efficient stream cipher created by Hongjun Wu. It
generates keystream from a 128-bit secret key and a 128-bit initialization
vector.
http://www.ecrypt.eu.org/stream/p3ciphers/hc/hc128_p3.pdf
It is a third phase candidate in the eStream contest, and is patent-free.
No attacks are known as of today (April 2007). See
http://www.ecrypt.eu.org/stream/hcp3.html
The interface stream ciphers conform to.
Initialise the cipher.
If true the cipher is initialised for encryption,
if false for decryption.
The key and other data required by the cipher.
If the parameters argument is inappropriate.
encrypt/decrypt a single byte returning the result.
the byte to be processed.
the result of processing the input byte.
Process a block of bytes from input putting the result into output.
The input byte array.
The offset into input where the data to be processed starts.
The number of bytes to be processed.
The output buffer the processed bytes go into.
The offset into output the processed data starts at.
If the output buffer is too small.
Reset the cipher to the same state as it was after the last init (if there was one).
The name of the algorithm this cipher implements.
Initialise a HC-128 cipher.
@param forEncryption whether or not we are for encryption. Irrelevant, as
encryption and decryption are the same.
@param params the parameters required to set up the cipher.
@throws ArgumentException if the params argument is
inappropriate (ie. the key is not 128 bit long).
HC-256 is a software-efficient stream cipher created by Hongjun Wu. It
generates keystream from a 256-bit secret key and a 256-bit initialization
vector.
http://www.ecrypt.eu.org/stream/p3ciphers/hc/hc256_p3.pdf
Its brother, HC-128, is a third phase candidate in the eStream contest.
The algorithm is patent-free. No attacks are known as of today (April 2007).
See
http://www.ecrypt.eu.org/stream/hcp3.html
Initialise a HC-256 cipher.
@param forEncryption whether or not we are for encryption. Irrelevant, as
encryption and decryption are the same.
@param params the parameters required to set up the cipher.
@throws ArgumentException if the params argument is
inappropriate (ie. the key is not 256 bit long).
support class for constructing intergrated encryption ciphers
for doing basic message exchanges on top of key agreement ciphers
set up for use with stream mode, where the key derivation function
is used to provide a stream of bytes to xor with the message.
@param agree the key agreement used as the basis for the encryption
@param kdf the key derivation function used for byte generation
@param mac the message authentication code generator for the message
set up for use in conjunction with a block cipher to handle the
message.
@param agree the key agreement used as the basis for the encryption
@param kdf the key derivation function used for byte generation
@param mac the message authentication code generator for the message
@param cipher the cipher to used for encrypting the message
Initialise the encryptor.
@param forEncryption whether or not this is encryption/decryption.
@param privParam our private key parameters
@param pubParam the recipient's/sender's public key parameters
@param param encoding and derivation parameters.
Implementation of Bob Jenkin's ISAAC (Indirection Shift Accumulate Add and Count).
see: http://www.burtleburtle.net/bob/rand/isaacafa.html
initialise an ISAAC cipher.
@param forEncryption whether or not we are for encryption.
@param params the parameters required to set up the cipher.
@exception ArgumentException if the params argument is
inappropriate.
NaccacheStern Engine. For details on this cipher, please see
http://www.gemplus.com/smart/rd/publications/pdf/NS98pkcs.pdf
Initializes this algorithm. Must be called before all other Functions.
@see org.bouncycastle.crypto.AsymmetricBlockCipher#init(bool,
org.bouncycastle.crypto.CipherParameters)
Returns the input block size of this algorithm.
@see org.bouncycastle.crypto.AsymmetricBlockCipher#GetInputBlockSize()
Returns the output block size of this algorithm.
@see org.bouncycastle.crypto.AsymmetricBlockCipher#GetOutputBlockSize()
Process a single Block using the Naccache-Stern algorithm.
@see org.bouncycastle.crypto.AsymmetricBlockCipher#ProcessBlock(byte[],
int, int)
Encrypts a BigInteger aka Plaintext with the public key.
@param plain
The BigInteger to encrypt
@return The byte[] representation of the encrypted BigInteger (i.e.
crypted.toByteArray())
Adds the contents of two encrypted blocks mod sigma
@param block1
the first encrypted block
@param block2
the second encrypted block
@return encrypt((block1 + block2) mod sigma)
@throws InvalidCipherTextException
Convenience Method for data exchange with the cipher.
Determines blocksize and splits data to blocksize.
@param data the data to be processed
@return the data after it went through the NaccacheSternEngine.
@throws InvalidCipherTextException
Computes the integer x that is expressed through the given primes and the
congruences with the chinese remainder theorem (CRT).
@param congruences
the congruences c_i
@param primes
the primes p_i
@return an integer x for that x % p_i == c_i
A Noekeon engine, using direct-key mode.
Create an instance of the Noekeon encryption algorithm
and set some defaults
initialise
@param forEncryption whether or not we are for encryption.
@param params the parameters required to set up the cipher.
@exception ArgumentException if the params argument is
inappropriate.
Re-key the cipher.
@param key the key to be used
The no-op engine that just copies bytes through, irrespective of whether encrypting and decrypting.
Provided for the sake of completeness.
an implementation of RC2 as described in RFC 2268
"A Description of the RC2(r) Encryption Algorithm" R. Rivest.
initialise a RC2 cipher.
@param forEncryption whether or not we are for encryption.
@param parameters the parameters required to set up the cipher.
@exception ArgumentException if the parameters argument is
inappropriate.
return the result rotating the 16 bit number in x left by y
Wrap keys according to RFC 3217 - RC2 mechanism
Field engine
Field param
Field paramPlusIV
Field iv
Field forWrapping
Field IV2
Method init
@param forWrapping
@param param
Method wrap
@param in
@param inOff
@param inLen
@return
Method unwrap
@param in
@param inOff
@param inLen
@return
@throws InvalidCipherTextException
Some key wrap algorithms make use of the Key Checksum defined
in CMS [CMS-Algorithms]. This is used to provide an integrity
check value for the key being wrapped. The algorithm is
- Compute the 20 octet SHA-1 hash on the key being wrapped.
- Use the first 8 octets of this hash as the checksum value.
@param key
@return
@throws Exception
@see http://www.w3.org/TR/xmlenc-core/#sec-CMSKeyChecksum
@param key
@param checksum
@return
@see http://www.w3.org/TR/xmlenc-core/#sec-CMSKeyChecksum
Method GetAlgorithmName
@return
initialise a RC4 cipher.
@param forEncryption whether or not we are for encryption.
@param parameters the parameters required to set up the cipher.
@exception ArgumentException if the parameters argument is
inappropriate.
The specification for RC5 came from the RC5 Encryption Algorithm
publication in RSA CryptoBytes, Spring of 1995.
http://www.rsasecurity.com/rsalabs/cryptobytes.
This implementation has a word size of 32 bits.
Create an instance of the RC5 encryption algorithm
and set some defaults
initialise a RC5-32 cipher.
@param forEncryption whether or not we are for encryption.
@param parameters the parameters required to set up the cipher.
@exception ArgumentException if the parameters argument is
inappropriate.
Re-key the cipher.
@param key the key to be used
Encrypt the given block starting at the given offset and place
the result in the provided buffer starting at the given offset.
@param in in byte buffer containing data to encrypt
@param inOff offset into src buffer
@param out out buffer where encrypted data is written
@param outOff offset into out buffer
Perform a left "spin" of the word. The rotation of the given
word x is rotated left by y bits.
Only the lg(32) low-order bits of y
are used to determine the rotation amount. Here it is
assumed that the wordsize used is a power of 2.
@param x word to rotate
@param y number of bits to rotate % 32
Perform a right "spin" of the word. The rotation of the given
word x is rotated left by y bits.
Only the lg(32) low-order bits of y
are used to determine the rotation amount. Here it is
assumed that the wordsize used is a power of 2.
@param x word to rotate
@param y number of bits to rotate % 32
The specification for RC5 came from the RC5 Encryption Algorithm
publication in RSA CryptoBytes, Spring of 1995.
http://www.rsasecurity.com/rsalabs/cryptobytes.
This implementation is set to work with a 64 bit word size.
Create an instance of the RC5 encryption algorithm
and set some defaults
initialise a RC5-64 cipher.
@param forEncryption whether or not we are for encryption.
@param parameters the parameters required to set up the cipher.
@exception ArgumentException if the parameters argument is
inappropriate.
Re-key the cipher.
@param key the key to be used
Encrypt the given block starting at the given offset and place
the result in the provided buffer starting at the given offset.
@param in in byte buffer containing data to encrypt
@param inOff offset into src buffer
@param out out buffer where encrypted data is written
@param outOff offset into out buffer
Perform a left "spin" of the word. The rotation of the given
word x is rotated left by y bits.
Only the lg(wordSize) low-order bits of y
are used to determine the rotation amount. Here it is
assumed that the wordsize used is a power of 2.
@param x word to rotate
@param y number of bits to rotate % wordSize
Perform a right "spin" of the word. The rotation of the given
word x is rotated left by y bits.
Only the lg(wordSize) low-order bits of y
are used to determine the rotation amount. Here it is
assumed that the wordsize used is a power of 2.
@param x word to rotate
@param y number of bits to rotate % wordSize
An RC6 engine.
Create an instance of the RC6 encryption algorithm
and set some defaults
initialise a RC5-32 cipher.
@param forEncryption whether or not we are for encryption.
@param parameters the parameters required to set up the cipher.
@exception ArgumentException if the parameters argument is
inappropriate.
Re-key the cipher.
@param inKey the key to be used
Perform a left "spin" of the word. The rotation of the given
word x is rotated left by y bits.
Only the lg(wordSize) low-order bits of y
are used to determine the rotation amount. Here it is
assumed that the wordsize used is a power of 2.
@param x word to rotate
@param y number of bits to rotate % wordSize
Perform a right "spin" of the word. The rotation of the given
word x is rotated left by y bits.
Only the lg(wordSize) low-order bits of y
are used to determine the rotation amount. Here it is
assumed that the wordsize used is a power of 2.
@param x word to rotate
@param y number of bits to rotate % wordSize
an implementation of the RFC 3211 Key Wrap
Specification.
an implementation of Rijndael, based on the documentation and reference implementation
by Paulo Barreto, Vincent Rijmen, for v2.0 August '99.
Note: this implementation is based on information prior to readonly NIST publication.
multiply two elements of GF(2^m)
needed for MixColumn and InvMixColumn
xor corresponding text input and round key input bytes
Row 0 remains unchanged
The other three rows are shifted a variable amount
Replace every byte of the input by the byte at that place
in the nonlinear S-box
Mix the bytes of every column in a linear way
Mix the bytes of every column in a linear way
This is the opposite operation of Mixcolumn
Calculate the necessary round keys
The number of calculations depends on keyBits and blockBits
default constructor - 128 bit block size.
basic constructor - set the cipher up for a given blocksize
@param blocksize the blocksize in bits, must be 128, 192, or 256.
initialise a Rijndael cipher.
@param forEncryption whether or not we are for encryption.
@param parameters the parameters required to set up the cipher.
@exception ArgumentException if the parameters argument is
inappropriate.
this does your basic RSA algorithm with blinding
initialise the RSA engine.
@param forEncryption true if we are encrypting, false otherwise.
@param param the necessary RSA key parameters.
Return the maximum size for an input block to this engine.
For RSA this is always one byte less than the key size on
encryption, and the same length as the key size on decryption.
@return maximum size for an input block.
Return the maximum size for an output block to this engine.
For RSA this is always one byte less than the key size on
decryption, and the same length as the key size on encryption.
@return maximum size for an output block.
Process a single block using the basic RSA algorithm.
@param inBuf the input array.
@param inOff the offset into the input buffer where the data starts.
@param inLen the length of the data to be processed.
@return the result of the RSA process.
@exception DataLengthException the input block is too large.
This does your basic RSA Chaum's blinding and unblinding as outlined in
"Handbook of Applied Cryptography", page 475. You need to use this if you are
trying to get another party to generate signatures without them being aware
of the message they are signing.
Initialise the blinding engine.
@param forEncryption true if we are encrypting (blinding), false otherwise.
@param param the necessary RSA key parameters.
Return the maximum size for an input block to this engine.
For RSA this is always one byte less than the key size on
encryption, and the same length as the key size on decryption.
@return maximum size for an input block.
Return the maximum size for an output block to this engine.
For RSA this is always one byte less than the key size on
decryption, and the same length as the key size on encryption.
@return maximum size for an output block.
Process a single block using the RSA blinding algorithm.
@param in the input array.
@param inOff the offset into the input buffer where the data starts.
@param inLen the length of the data to be processed.
@return the result of the RSA process.
@throws DataLengthException the input block is too large.
this does your basic RSA algorithm.
initialise the RSA engine.
@param forEncryption true if we are encrypting, false otherwise.
@param param the necessary RSA key parameters.
Return the maximum size for an input block to this engine.
For RSA this is always one byte less than the key size on
encryption, and the same length as the key size on decryption.
@return maximum size for an input block.
Return the maximum size for an output block to this engine.
For RSA this is always one byte less than the key size on
decryption, and the same length as the key size on encryption.
@return maximum size for an output block.
this does your basic RSA algorithm.
initialise the RSA engine.
@param forEncryption true if we are encrypting, false otherwise.
@param param the necessary RSA key parameters.
Return the maximum size for an input block to this engine.
For RSA this is always one byte less than the key size on
encryption, and the same length as the key size on decryption.
@return maximum size for an input block.
Return the maximum size for an output block to this engine.
For RSA this is always one byte less than the key size on
decryption, and the same length as the key size on encryption.
@return maximum size for an output block.
Process a single block using the basic RSA algorithm.
@param inBuf the input array.
@param inOff the offset into the input buffer where the data starts.
@param inLen the length of the data to be processed.
@return the result of the RSA process.
@exception DataLengthException the input block is too large.
Implementation of Daniel J. Bernstein's Salsa20 stream cipher, Snuffle 2005
Constants
initialise a Salsa20 cipher.
@param forEncryption whether or not we are for encryption.
@param params the parameters required to set up the cipher.
@exception ArgumentException if the params argument is
inappropriate.
Implementation of the SEED algorithm as described in RFC 4009
An implementation of the SEED key wrapper based on RFC 4010/RFC 3394.
For further details see: http://www.ietf.org/rfc/rfc4010.txt.
* Serpent is a 128-bit 32-round block cipher with variable key lengths,
* including 128, 192 and 256 bit keys conjectured to be at least as
* secure as three-key triple-DES.
*
* Serpent was designed by Ross Anderson, Eli Biham and Lars Knudsen as a
* candidate algorithm for the NIST AES Quest.>
*
*
* For full details see the The Serpent home page
*
initialise a Serpent cipher.
@param forEncryption whether or not we are for encryption.
@param parameters the parameters required to set up the cipher.
@exception ArgumentException if the parameters argument is
inappropriate.
Process one block of input from the array in and write it to
the out array.
@param in the array containing the input data.
@param inOff offset into the in array the data starts at.
@param out the array the output data will be copied into.
@param outOff the offset into the out array the output will start at.
@exception DataLengthException if there isn't enough data in in, or
space in out.
@exception InvalidOperationException if the cipher isn't initialised.
@return the number of bytes processed and produced.
Expand a user-supplied key material into a session key.
@param key The user-key bytes (multiples of 4) to use.
@exception ArgumentException
Encrypt one block of plaintext.
@param in the array containing the input data.
@param inOff offset into the in array the data starts at.
@param out the array the output data will be copied into.
@param outOff the offset into the out array the output will start at.
Decrypt one block of ciphertext.
@param in the array containing the input data.
@param inOff offset into the in array the data starts at.
@param out the array the output data will be copied into.
@param outOff the offset into the out array the output will start at.
S0 - { 3, 8,15, 1,10, 6, 5,11,14,13, 4, 2, 7, 0, 9,12 } - 15 terms.
InvSO - {13, 3,11, 0,10, 6, 5,12, 1,14, 4, 7,15, 9, 8, 2 } - 15 terms.
S1 - {15,12, 2, 7, 9, 0, 5,10, 1,11,14, 8, 6,13, 3, 4 } - 14 terms.
InvS1 - { 5, 8, 2,14,15, 6,12, 3,11, 4, 7, 9, 1,13,10, 0 } - 14 steps.
S2 - { 8, 6, 7, 9, 3,12,10,15,13, 1,14, 4, 0,11, 5, 2 } - 16 terms.
InvS2 - {12, 9,15, 4,11,14, 1, 2, 0, 3, 6,13, 5, 8,10, 7 } - 16 steps.
S3 - { 0,15,11, 8,12, 9, 6, 3,13, 1, 2, 4,10, 7, 5,14 } - 16 terms.
InvS3 - { 0, 9,10, 7,11,14, 6,13, 3, 5,12, 2, 4, 8,15, 1 } - 15 terms
S4 - { 1,15, 8, 3,12, 0,11, 6, 2, 5, 4,10, 9,14, 7,13 } - 15 terms.
InvS4 - { 5, 0, 8, 3,10, 9, 7,14, 2,12,11, 6, 4,15,13, 1 } - 15 terms.
S5 - {15, 5, 2,11, 4,10, 9,12, 0, 3,14, 8,13, 6, 7, 1 } - 16 terms.
InvS5 - { 8,15, 2, 9, 4, 1,13,14,11, 6, 5, 3, 7,12,10, 0 } - 16 terms.
S6 - { 7, 2,12, 5, 8, 4, 6,11,14, 9, 1,15,13, 3,10, 0 } - 15 terms.
InvS6 - {15,10, 1,13, 5, 3, 6, 0, 4, 9,14, 7, 2,12, 8,11 } - 15 terms.
S7 - { 1,13,15, 0,14, 8, 2,11, 7, 4,12,10, 9, 3, 5, 6 } - 16 terms.
InvS7 - { 3, 0, 6,13, 9,14,15, 8, 5,12,11, 7,10, 1, 4, 2 } - 17 terms.
Apply the linear transformation to the register set.
Apply the inverse of the linear transformation to the register set.
a class that provides a basic SKIPJACK engine.
initialise a SKIPJACK cipher.
@param forEncryption whether or not we are for encryption.
@param parameters the parameters required to set up the cipher.
@exception ArgumentException if the parameters argument is
inappropriate.
The G permutation
the inverse of the G permutation.
An TEA engine.
Create an instance of the TEA encryption algorithm
and set some defaults
initialise
@param forEncryption whether or not we are for encryption.
@param params the parameters required to set up the cipher.
@exception ArgumentException if the params argument is
inappropriate.
Re-key the cipher.
@param key the key to be used
A class that provides Twofish encryption operations.
This Java implementation is based on the Java reference
implementation provided by Bruce Schneier and developed
by Raif S. Naffah.
Define the fixed p0/p1 permutations used in keyed S-box lookup.
By changing the following constant definitions, the S-boxes will
automatically Get changed in the Twofish engine.
gSubKeys[] and gSBox[] are eventually used in the
encryption and decryption methods.
initialise a Twofish cipher.
@param forEncryption whether or not we are for encryption.
@param parameters the parameters required to set up the cipher.
@exception ArgumentException if the parameters argument is
inappropriate.
Encrypt the given input starting at the given offset and place
the result in the provided buffer starting at the given offset.
The input will be an exact multiple of our blocksize.
encryptBlock uses the pre-calculated gSBox[] and subKey[]
arrays.
Decrypt the given input starting at the given offset and place
the result in the provided buffer starting at the given offset.
The input will be an exact multiple of our blocksize.
Use (12, 8) Reed-Solomon code over GF(256) to produce
a key S-box 32-bit entity from 2 key material 32-bit
entities.
@param k0 first 32-bit entity
@param k1 second 32-bit entity
@return Remainder polynomial Generated using RS code
* Reed-Solomon code parameters: (12,8) reversible code:
*
*
* G(x) = x^4 + (a+1/a)x^3 + ax^2 + (a+1/a)x + 1
*
* where a = primitive root of field generator 0x14D
*
initialise a VMPC cipher.
@param forEncryption
whether or not we are for encryption.
@param params
the parameters required to set up the cipher.
@exception ArgumentException
if the params argument is inappropriate.
An XTEA engine.
Create an instance of the TEA encryption algorithm
and set some defaults
initialise
@param forEncryption whether or not we are for encryption.
@param params the parameters required to set up the cipher.
@exception ArgumentException if the params argument is
inappropriate.
Re-key the cipher.
@param key the key to be used
Basic KDF generator for derived keys and ivs as defined by IEEE P1363a/ISO 18033
This implementation is based on ISO 18033/P1363a.
Construct a KDF Parameters generator.
@param counterStart value of counter.
@param digest the digest to be used as the source of derived keys.
fill len bytes of the output buffer with bytes generated from
the derivation function.
@throws ArgumentException if the size of the request will cause an overflow.
@throws DataLengthException if the out buffer is too small.
return the underlying digest.
initialise the key generator - if strength is set to zero
the key generated will be 64 bits in size, otherwise
strength can be 64 or 56 bits (if you don't count the parity bits).
@param param the parameters to be used for key generation
initialise the key generator - if strength is set to zero
the key Generated will be 192 bits in size, otherwise
strength can be 128 or 192 (or 112 or 168 if you don't count
parity bits), depending on whether you wish to do 2-key or 3-key
triple DES.
@param param the parameters to be used for key generation
a basic Diffie-Hellman key pair generator.
This generates keys consistent for use with the basic algorithm for
Diffie-Hellman.
interface that a public/private key pair generator should conform to.
intialise the key pair generator.
@param the parameters the key pair is to be initialised with.
return an AsymmetricCipherKeyPair containing the Generated keys.
@return an AsymmetricCipherKeyPair containing the Generated keys.
a Diffie-Hellman key pair generator.
This generates keys consistent for use in the MTI/A0 key agreement protocol
as described in "Handbook of Applied Cryptography", Pages 516-519.
which Generates the p and g values from the given parameters,
returning the DHParameters object.
Note: can take a while...
* a DSA key pair generator.
*
* This Generates DSA keys in line with the method described
* in FIPS 186-3 B.1 FFC Key Pair Generation.
Generate suitable parameters for DSA, in line with FIPS 186-2, or FIPS 186-3.
initialise the key generator.
@param size size of the key (range 2^512 -> 2^1024 - 64 bit increments)
@param certainty measure of robustness of prime (for FIPS 186-2 compliance this should be at least 80).
@param random random byte source.
Initialise the key generator for DSA 2.
Use this init method if you need to generate parameters for DSA 2 keys.
@param params DSA 2 key generation parameters.
which Generates the p and g values from the given parameters,
returning the DsaParameters object.
Note: can take a while...
generate suitable parameters for DSA, in line with
FIPS 186-3 A.1 Generation of the FFC Primes p and q.
Given the domain parameters this routine Generates an EC key
pair in accordance with X9.62 section 5.2.1 pages 26, 27.
a ElGamal key pair generator.
This Generates keys consistent for use with ElGamal as described in
page 164 of "Handbook of Applied Cryptography".
* which Generates the p and g values from the given parameters,
* returning the ElGamalParameters object.
*
* Note: can take a while...
*
a GOST3410 key pair generator.
This generates GOST3410 keys in line with the method described
in GOST R 34.10-94.
generate suitable parameters for GOST3410.
initialise the key generator.
@param size size of the key
@param typeProcedure type procedure A,B = 1; A',B' - else
@param random random byte source.
Procedure C
procedure generates the a value from the given p,q,
returning the a value.
which generates the p , q and a values from the given parameters,
returning the Gost3410Parameters object.
KFD2 generator for derived keys and ivs as defined by IEEE P1363a/ISO 18033
This implementation is based on IEEE P1363/ISO 18033.
Construct a KDF1 byte generator.
@param digest the digest to be used as the source of derived keys.
KDF2 generator for derived keys and ivs as defined by IEEE P1363a/ISO 18033
This implementation is based on IEEE P1363/ISO 18033.
Construct a KDF2 bytes generator. Generates key material
according to IEEE P1363 or ISO 18033 depending on the initialisation.
@param digest the digest to be used as the source of derived keys.
Generator for MGF1 as defined in Pkcs 1v2
@param digest the digest to be used as the source of Generated bytes
int to octet string.
fill len bytes of the output buffer with bytes Generated from
the derivation function.
@throws DataLengthException if the out buffer is too small.
return the underlying digest.
Key generation parameters for NaccacheStern cipher. For details on this cipher, please see
http://www.gemplus.com/smart/rd/publications/pdf/NS98pkcs.pdf
Generates a permuted ArrayList from the original one. The original List
is not modified
@param arr
the ArrayList to be permuted
@param rand
the source of Randomness for permutation
@return a new IList with the permuted elements.
Finds the first 'count' primes starting with 3
@param count
the number of primes to find
@return a vector containing the found primes as Integer
Generator for PBE derived keys and ivs as usd by OpenSSL.
The scheme is a simple extension of PKCS 5 V2.0 Scheme 1 using MD5 with an
iteration count of 1.
super class for all Password Based Encyrption (Pbe) parameter generator classes.
base constructor.
initialise the Pbe generator.
@param password the password converted into bytes (see below).
@param salt the salt to be mixed with the password.
@param iterationCount the number of iterations the "mixing" function
is to be applied for.
return the password byte array.
@return the password byte array.
return the salt byte array.
@return the salt byte array.
Generate derived parameters for a key of length keySize.
@param keySize the length, in bits, of the key required.
@return a parameters object representing a key.
Generate derived parameters for a key of length keySize, and
an initialisation vector (IV) of length ivSize.
@param keySize the length, in bits, of the key required.
@param ivSize the length, in bits, of the iv required.
@return a parameters object representing a key and an IV.
Generate derived parameters for a key of length keySize, specifically
for use with a MAC.
@param keySize the length, in bits, of the key required.
@return a parameters object representing a key.
converts a password to a byte array according to the scheme in
Pkcs5 (ascii, no padding)
@param password a character array representing the password.
@return a byte array representing the password.
converts a password to a byte array according to the scheme in
PKCS5 (UTF-8, no padding)
@param password a character array representing the password.
@return a byte array representing the password.
converts a password to a byte array according to the scheme in
Pkcs12 (unicode, big endian, 2 zero pad bytes at the end).
@param password a character array representing the password.
@return a byte array representing the password.
return the iteration count.
@return the iteration count.
Construct a OpenSSL Parameters generator.
Initialise - note the iteration count for this algorithm is fixed at 1.
@param password password to use.
@param salt salt to use.
the derived key function, the ith hash of the password and the salt.
Generate a key parameter derived from the password, salt, and iteration
count we are currently initialised with.
@param keySize the size of the key we want (in bits)
@return a KeyParameter object.
@exception ArgumentException if the key length larger than the base hash size.
Generate a key with initialisation vector parameter derived from
the password, salt, and iteration count we are currently initialised
with.
@param keySize the size of the key we want (in bits)
@param ivSize the size of the iv we want (in bits)
@return a ParametersWithIV object.
@exception ArgumentException if keySize + ivSize is larger than the base hash size.
Generate a key parameter for use with a MAC derived from the password,
salt, and iteration count we are currently initialised with.
@param keySize the size of the key we want (in bits)
@return a KeyParameter object.
@exception ArgumentException if the key length larger than the base hash size.
Generator for Pbe derived keys and ivs as defined by Pkcs 12 V1.0.
The document this implementation is based on can be found at
RSA's Pkcs12 Page
Construct a Pkcs 12 Parameters generator.
@param digest the digest to be used as the source of derived keys.
@exception ArgumentException if an unknown digest is passed in.
add a + b + 1, returning the result in a. The a value is treated
as a BigInteger of length (b.Length * 8) bits. The result is
modulo 2^b.Length in case of overflow.
generation of a derived key ala Pkcs12 V1.0.
Generate a key parameter derived from the password, salt, and iteration
count we are currently initialised with.
@param keySize the size of the key we want (in bits)
@return a KeyParameter object.
Generate a key with initialisation vector parameter derived from
the password, salt, and iteration count we are currently initialised
with.
@param keySize the size of the key we want (in bits)
@param ivSize the size of the iv we want (in bits)
@return a ParametersWithIV object.
Generate a key parameter for use with a MAC derived from the password,
salt, and iteration count we are currently initialised with.
@param keySize the size of the key we want (in bits)
@return a KeyParameter object.
Generator for Pbe derived keys and ivs as defined by Pkcs 5 V2.0 Scheme 1.
Note this generator is limited to the size of the hash produced by the
digest used to drive it.
The document this implementation is based on can be found at
RSA's Pkcs5 Page
Construct a Pkcs 5 Scheme 1 Parameters generator.
@param digest the digest to be used as the source of derived keys.
the derived key function, the ith hash of the mPassword and the mSalt.
Generate a key parameter derived from the mPassword, mSalt, and iteration
count we are currently initialised with.
@param keySize the size of the key we want (in bits)
@return a KeyParameter object.
@exception ArgumentException if the key length larger than the base hash size.
Generate a key with initialisation vector parameter derived from
the mPassword, mSalt, and iteration count we are currently initialised
with.
@param keySize the size of the key we want (in bits)
@param ivSize the size of the iv we want (in bits)
@return a ParametersWithIV object.
@exception ArgumentException if keySize + ivSize is larger than the base hash size.
Generate a key parameter for use with a MAC derived from the mPassword,
mSalt, and iteration count we are currently initialised with.
@param keySize the size of the key we want (in bits)
@return a KeyParameter object.
@exception ArgumentException if the key length larger than the base hash size.
Generator for Pbe derived keys and ivs as defined by Pkcs 5 V2.0 Scheme 2.
This generator uses a SHA-1 HMac as the calculation function.
The document this implementation is based on can be found at
RSA's Pkcs5 Page
construct a Pkcs5 Scheme 2 Parameters generator.
Generate a key parameter derived from the password, salt, and iteration
count we are currently initialised with.
@param keySize the size of the key we want (in bits)
@return a KeyParameter object.
Generate a key with initialisation vector parameter derived from
the password, salt, and iteration count we are currently initialised
with.
@param keySize the size of the key we want (in bits)
@param ivSize the size of the iv we want (in bits)
@return a ParametersWithIV object.
Generate a key parameter for use with a MAC derived from the password,
salt, and iteration count we are currently initialised with.
@param keySize the size of the key we want (in bits)
@return a KeyParameter object.
Generate a random factor suitable for use with RSA blind signatures
as outlined in Chaum's blinding and unblinding as outlined in
"Handbook of Applied Cryptography", page 475.
Initialise the factor generator
@param param the necessary RSA key parameters.
Generate a suitable blind factor for the public key the generator was initialised with.
@return a random blind factor
an RSA key pair generator.
interface for classes implementing the Digital Signature Algorithm
initialise the signer for signature generation or signature
verification.
@param forSigning true if we are generating a signature, false
otherwise.
@param param key parameters for signature generation.
sign the passed in message (usually the output of a hash function).
@param message the message to be signed.
@return two big integers representing the r and s values respectively.
verify the message message against the signature values r and s.
@param message the message that was supposed to have been signed.
@param r the r signature value.
@param s the s signature value.
The base interface for implementations of message authentication codes (MACs).
Initialise the MAC.
@param param the key and other data required by the MAC.
@exception ArgumentException if the parameters argument is
inappropriate.
Return the block size for this MAC (in bytes).
@return the block size for this MAC in bytes.
add a single byte to the mac for processing.
@param in the byte to be processed.
@exception InvalidOperationException if the MAC is not initialised.
@param in the array containing the input.
@param inOff the index in the array the data begins at.
@param len the length of the input starting at inOff.
@exception InvalidOperationException if the MAC is not initialised.
@exception DataLengthException if there isn't enough data in in.
Compute the final stage of the MAC writing the output to the out
parameter.
doFinal leaves the MAC in the same state it was after the last init.
@param out the array the MAC is to be output to.
@param outOff the offset into the out buffer the output is to start at.
@exception DataLengthException if there isn't enough space in out.
@exception InvalidOperationException if the MAC is not initialised.
Reset the MAC. At the end of resetting the MAC should be in the
in the same state it was after the last init (if there was one).
Return the name of the algorithm the MAC implements.
@return the name of the algorithm the MAC implements.
this exception is thrown whenever we find something we don't expect in a
message.
base constructor.
create a InvalidCipherTextException with the given message.
@param message the message to be carried with the exception.
Initialise the signer for signing or verification.
@param forSigning true if for signing, false otherwise
@param param necessary parameters.
update the internal digest with the byte b
update the internal digest with the byte array in
Generate a signature for the message we've been loaded with using
the key we were initialised with.
return true if the internal state represents the signature described
in the passed in array.
reset the internal state
Return the name of the algorithm the signer implements.
@return the name of the algorithm the signer implements.
Signer with message recovery.
Returns true if the signer has recovered the full message as
part of signature verification.
@return true if full message recovered.
Returns a reference to what message was recovered (if any).
@return full/partial message, null if nothing.
Perform an update with the recovered message before adding any other data. This must
be the first update method called, and calling it will result in the signer assuming
that further calls to update will include message content past what is recoverable.
@param signature the signature that we are in the process of verifying.
@throws IllegalStateException
The base class for parameters to key generators.
initialise the generator with a source of randomness
and a strength (in bits).
@param random the random byte source.
@param strength the size, in bits, of the keys we want to produce.
return the random source associated with this
generator.
@return the generators random source.
return the bit strength for keys produced by this generator,
@return the strength of the keys this generator produces (in bits).
standard CBC Block Cipher MAC - if no padding is specified the default of
pad of zeroes is used.
create a standard MAC based on a CBC block cipher. This will produce an
authentication code half the length of the block size of the cipher.
@param cipher the cipher to be used as the basis of the MAC generation.
create a standard MAC based on a CBC block cipher. This will produce an
authentication code half the length of the block size of the cipher.
@param cipher the cipher to be used as the basis of the MAC generation.
@param padding the padding to be used to complete the last block.
create a standard MAC based on a block cipher with the size of the
MAC been given in bits. This class uses CBC mode as the basis for the
MAC generation.
Note: the size of the MAC must be at least 24 bits (FIPS Publication 81),
or 16 bits if being used as a data authenticator (FIPS Publication 113),
and in general should be less than the size of the block cipher as it reduces
the chance of an exhaustive attack (see Handbook of Applied Cryptography).
@param cipher the cipher to be used as the basis of the MAC generation.
@param macSizeInBits the size of the MAC in bits, must be a multiple of 8.
create a standard MAC based on a block cipher with the size of the
MAC been given in bits. This class uses CBC mode as the basis for the
MAC generation.
Note: the size of the MAC must be at least 24 bits (FIPS Publication 81),
or 16 bits if being used as a data authenticator (FIPS Publication 113),
and in general should be less than the size of the block cipher as it reduces
the chance of an exhaustive attack (see Handbook of Applied Cryptography).
@param cipher the cipher to be used as the basis of the MAC generation.
@param macSizeInBits the size of the MAC in bits, must be a multiple of 8.
@param padding the padding to be used to complete the last block.
Reset the mac generator.
implements a Cipher-FeedBack (CFB) mode on top of a simple cipher.
Basic constructor.
@param cipher the block cipher to be used as the basis of the
feedback mode.
@param blockSize the block size in bits (note: a multiple of 8)
Initialise the cipher and, possibly, the initialisation vector (IV).
If an IV isn't passed as part of the parameter, the IV will be all zeros.
An IV which is too short is handled in FIPS compliant fashion.
@param param the key and other data required by the cipher.
@exception ArgumentException if the parameters argument is
inappropriate.
return the block size we are operating at.
@return the block size we are operating at (in bytes).
Process one block of input from the array in and write it to
the out array.
@param in the array containing the input data.
@param inOff offset into the in array the data starts at.
@param out the array the output data will be copied into.
@param outOff the offset into the out array the output will start at.
@exception DataLengthException if there isn't enough data in in, or
space in out.
@exception InvalidOperationException if the cipher isn't initialised.
@return the number of bytes processed and produced.
reset the chaining vector back to the IV and reset the underlying
cipher.
return the algorithm name and mode.
@return the name of the underlying algorithm followed by "/CFB"
and the block size in bits.
create a standard MAC based on a CFB block cipher. This will produce an
authentication code half the length of the block size of the cipher, with
the CFB mode set to 8 bits.
@param cipher the cipher to be used as the basis of the MAC generation.
create a standard MAC based on a CFB block cipher. This will produce an
authentication code half the length of the block size of the cipher, with
the CFB mode set to 8 bits.
@param cipher the cipher to be used as the basis of the MAC generation.
@param padding the padding to be used.
create a standard MAC based on a block cipher with the size of the
MAC been given in bits. This class uses CFB mode as the basis for the
MAC generation.
Note: the size of the MAC must be at least 24 bits (FIPS Publication 81),
or 16 bits if being used as a data authenticator (FIPS Publication 113),
and in general should be less than the size of the block cipher as it reduces
the chance of an exhaustive attack (see Handbook of Applied Cryptography).
@param cipher the cipher to be used as the basis of the MAC generation.
@param cfbBitSize the size of an output block produced by the CFB mode.
@param macSizeInBits the size of the MAC in bits, must be a multiple of 8.
create a standard MAC based on a block cipher with the size of the
MAC been given in bits. This class uses CFB mode as the basis for the
MAC generation.
Note: the size of the MAC must be at least 24 bits (FIPS Publication 81),
or 16 bits if being used as a data authenticator (FIPS Publication 113),
and in general should be less than the size of the block cipher as it reduces
the chance of an exhaustive attack (see Handbook of Applied Cryptography).
@param cipher the cipher to be used as the basis of the MAC generation.
@param cfbBitSize the size of an output block produced by the CFB mode.
@param macSizeInBits the size of the MAC in bits, must be a multiple of 8.
@param padding a padding to be used.
Reset the mac generator.
CMAC - as specified at www.nuee.nagoya-u.ac.jp/labs/tiwata/omac/omac.html
CMAC is analogous to OMAC1 - see also en.wikipedia.org/wiki/CMAC
CMAC is a NIST recomendation - see
csrc.nist.gov/CryptoToolkit/modes/800-38_Series_Publications/SP800-38B.pdf
CMAC/OMAC1 is a blockcipher-based message authentication code designed and
analyzed by Tetsu Iwata and Kaoru Kurosawa.
CMAC/OMAC1 is a simple variant of the CBC MAC (Cipher Block Chaining Message
Authentication Code). OMAC stands for One-Key CBC MAC.
It supports 128- or 64-bits block ciphers, with any key size, and returns
a MAC with dimension less or equal to the block size of the underlying
cipher.
create a standard MAC based on a CBC block cipher (64 or 128 bit block).
This will produce an authentication code the length of the block size
of the cipher.
@param cipher the cipher to be used as the basis of the MAC generation.
create a standard MAC based on a block cipher with the size of the
MAC been given in bits.
Note: the size of the MAC must be at least 24 bits (FIPS Publication 81),
or 16 bits if being used as a data authenticator (FIPS Publication 113),
and in general should be less than the size of the block cipher as it reduces
the chance of an exhaustive attack (see Handbook of Applied Cryptography).
@param cipher the cipher to be used as the basis of the MAC generation.
@param macSizeInBits the size of the MAC in bits, must be a multiple of 8 and @lt;= 128.
Reset the mac generator.
implementation of GOST 28147-89 MAC
HMAC implementation based on RFC2104
H(K XOR opad, H(K XOR ipad, text))
Reset the mac generator.
DES based CBC Block Cipher MAC according to ISO9797, algorithm 3 (ANSI X9.19 Retail MAC)
This could as well be derived from CBCBlockCipherMac, but then the property mac in the base
class must be changed to protected
create a Retail-MAC based on a CBC block cipher. This will produce an
authentication code of the length of the block size of the cipher.
@param cipher the cipher to be used as the basis of the MAC generation. This must
be DESEngine.
create a Retail-MAC based on a CBC block cipher. This will produce an
authentication code of the length of the block size of the cipher.
@param cipher the cipher to be used as the basis of the MAC generation.
@param padding the padding to be used to complete the last block.
create a Retail-MAC based on a block cipher with the size of the
MAC been given in bits. This class uses single DES CBC mode as the basis for the
MAC generation.
Note: the size of the MAC must be at least 24 bits (FIPS Publication 81),
or 16 bits if being used as a data authenticator (FIPS Publication 113),
and in general should be less than the size of the block cipher as it reduces
the chance of an exhaustive attack (see Handbook of Applied Cryptography).
@param cipher the cipher to be used as the basis of the MAC generation.
@param macSizeInBits the size of the MAC in bits, must be a multiple of 8.
create a standard MAC based on a block cipher with the size of the
MAC been given in bits. This class uses single DES CBC mode as the basis for the
MAC generation. The final block is decrypted and then encrypted using the
middle and right part of the key.
Note: the size of the MAC must be at least 24 bits (FIPS Publication 81),
or 16 bits if being used as a data authenticator (FIPS Publication 113),
and in general should be less than the size of the block cipher as it reduces
the chance of an exhaustive attack (see Handbook of Applied Cryptography).
@param cipher the cipher to be used as the basis of the MAC generation.
@param macSizeInBits the size of the MAC in bits, must be a multiple of 8.
@param padding the padding to be used to complete the last block.
Reset the mac generator.
Implementation of SipHash as specified in "SipHash: a fast short-input PRF", by Jean-Philippe
Aumasson and Daniel J. Bernstein (https://131002.net/siphash/siphash.pdf).
"SipHash is a family of PRFs SipHash-c-d where the integer parameters c and d are the number of
compression rounds and the number of finalization rounds. A compression round is identical to a
finalization round and this round function is called SipRound. Given a 128-bit key k and a
(possibly empty) byte string m, SipHash-c-d returns a 64-bit value..."
SipHash-2-4
SipHash-c-d
the number of compression rounds
the number of finalization rounds
This exception is thrown whenever a cipher requires a change of key, iv
or similar after x amount of bytes enciphered
implements Cipher-Block-Chaining (CBC) mode on top of a simple cipher.
Basic constructor.
@param cipher the block cipher to be used as the basis of chaining.
return the underlying block cipher that we are wrapping.
@return the underlying block cipher that we are wrapping.
Initialise the cipher and, possibly, the initialisation vector (IV).
If an IV isn't passed as part of the parameter, the IV will be all zeros.
@param forEncryption if true the cipher is initialised for
encryption, if false for decryption.
@param param the key and other data required by the cipher.
@exception ArgumentException if the parameters argument is
inappropriate.
return the block size of the underlying cipher.
@return the block size of the underlying cipher.
Process one block of input from the array in and write it to
the out array.
@param in the array containing the input data.
@param inOff offset into the in array the data starts at.
@param out the array the output data will be copied into.
@param outOff the offset into the out array the output will start at.
@exception DataLengthException if there isn't enough data in in, or
space in out.
@exception InvalidOperationException if the cipher isn't initialised.
@return the number of bytes processed and produced.
reset the chaining vector back to the IV and reset the underlying
cipher.
Do the appropriate chaining step for CBC mode encryption.
@param in the array containing the data to be encrypted.
@param inOff offset into the in array the data starts at.
@param out the array the encrypted data will be copied into.
@param outOff the offset into the out array the output will start at.
@exception DataLengthException if there isn't enough data in in, or
space in out.
@exception InvalidOperationException if the cipher isn't initialised.
@return the number of bytes processed and produced.
Do the appropriate chaining step for CBC mode decryption.
@param in the array containing the data to be decrypted.
@param inOff offset into the in array the data starts at.
@param out the array the decrypted data will be copied into.
@param outOff the offset into the out array the output will start at.
@exception DataLengthException if there isn't enough data in in, or
space in out.
@exception InvalidOperationException if the cipher isn't initialised.
@return the number of bytes processed and produced.
return the algorithm name and mode.
@return the name of the underlying algorithm followed by "/CBC".
Implements the Counter with Cipher Block Chaining mode (CCM) detailed in
NIST Special Publication 800-38C.
Note: this mode is a packet mode - it needs all the data up front.
A block cipher mode that includes authenticated encryption with a streaming mode
and optional associated data.
Initialise the cipher.
Parameter can either be an AeadParameters or a ParametersWithIV object.
Initialise for encryption if true, for decryption if false.
The key or other data required by the cipher.
The block size for this cipher, in bytes.
Add a single byte to the associated data check.
If the implementation supports it, this will be an online operation and will not retain the associated data.
The byte to be processed.
Add a sequence of bytes to the associated data check.
If the implementation supports it, this will be an online operation and will not retain the associated data.
The input byte array.
The offset into the input array where the data to be processed starts.
The number of bytes to be processed.
Encrypt/decrypt a single byte.
@param input the byte to be processed.
@param outBytes the output buffer the processed byte goes into.
@param outOff the offset into the output byte array the processed data starts at.
@return the number of bytes written to out.
@exception DataLengthException if the output buffer is too small.
Process a block of bytes from in putting the result into out.
@param inBytes the input byte array.
@param inOff the offset into the in array where the data to be processed starts.
@param len the number of bytes to be processed.
@param outBytes the output buffer the processed bytes go into.
@param outOff the offset into the output byte array the processed data starts at.
@return the number of bytes written to out.
@exception DataLengthException if the output buffer is too small.
Finish the operation either appending or verifying the MAC at the end of the data.
@param outBytes space for any resulting output data.
@param outOff offset into out to start copying the data at.
@return number of bytes written into out.
@throws InvalidOperationException if the cipher is in an inappropriate state.
@throws InvalidCipherTextException if the MAC fails to match.
Return the value of the MAC associated with the last stream processed.
@return MAC for plaintext data.
Return the size of the output buffer required for a ProcessBytes
an input of len bytes.
@param len the length of the input.
@return the space required to accommodate a call to ProcessBytes
with len bytes of input.
Return the size of the output buffer required for a ProcessBytes plus a
DoFinal with an input of len bytes.
@param len the length of the input.
@return the space required to accommodate a call to ProcessBytes and DoFinal
with len bytes of input.
Reset the cipher to the same state as it was after the last init (if there was one).
The name of the algorithm this cipher implements.
Basic constructor.
@param cipher the block cipher to be used.
return the underlying block cipher that we are wrapping.
@return the underlying block cipher that we are wrapping.
Returns a byte array containing the mac calculated as part of the
last encrypt or decrypt operation.
@return the last mac calculated.
implements a Cipher-FeedBack (CFB) mode on top of a simple cipher.
Basic constructor.
@param cipher the block cipher to be used as the basis of the
feedback mode.
@param blockSize the block size in bits (note: a multiple of 8)
return the underlying block cipher that we are wrapping.
@return the underlying block cipher that we are wrapping.
Initialise the cipher and, possibly, the initialisation vector (IV).
If an IV isn't passed as part of the parameter, the IV will be all zeros.
An IV which is too short is handled in FIPS compliant fashion.
@param forEncryption if true the cipher is initialised for
encryption, if false for decryption.
@param param the key and other data required by the cipher.
@exception ArgumentException if the parameters argument is
inappropriate.
return the block size we are operating at.
@return the block size we are operating at (in bytes).
Process one block of input from the array in and write it to
the out array.
@param in the array containing the input data.
@param inOff offset into the in array the data starts at.
@param out the array the output data will be copied into.
@param outOff the offset into the out array the output will start at.
@exception DataLengthException if there isn't enough data in in, or
space in out.
@exception InvalidOperationException if the cipher isn't initialised.
@return the number of bytes processed and produced.
Do the appropriate processing for CFB mode encryption.
@param in the array containing the data to be encrypted.
@param inOff offset into the in array the data starts at.
@param out the array the encrypted data will be copied into.
@param outOff the offset into the out array the output will start at.
@exception DataLengthException if there isn't enough data in in, or
space in out.
@exception InvalidOperationException if the cipher isn't initialised.
@return the number of bytes processed and produced.
Do the appropriate processing for CFB mode decryption.
@param in the array containing the data to be decrypted.
@param inOff offset into the in array the data starts at.
@param out the array the encrypted data will be copied into.
@param outOff the offset into the out array the output will start at.
@exception DataLengthException if there isn't enough data in in, or
space in out.
@exception InvalidOperationException if the cipher isn't initialised.
@return the number of bytes processed and produced.
reset the chaining vector back to the IV and reset the underlying
cipher.
return the algorithm name and mode.
@return the name of the underlying algorithm followed by "/CFB"
and the block size in bits.
A Cipher Text Stealing (CTS) mode cipher. CTS allows block ciphers to
be used to produce cipher text which is the same outLength as the plain text.
Create a buffered block cipher that uses Cipher Text Stealing
@param cipher the underlying block cipher this buffering object wraps.
return the size of the output buffer required for an update of 'length' bytes.
@param length the outLength of the input.
@return the space required to accommodate a call to update
with length bytes of input.
return the size of the output buffer required for an update plus a
doFinal with an input of length bytes.
@param length the outLength of the input.
@return the space required to accommodate a call to update and doFinal
with length bytes of input.
process a single byte, producing an output block if neccessary.
@param in the input byte.
@param out the space for any output that might be produced.
@param outOff the offset from which the output will be copied.
@return the number of output bytes copied to out.
@exception DataLengthException if there isn't enough space in out.
@exception InvalidOperationException if the cipher isn't initialised.
process an array of bytes, producing output if necessary.
@param in the input byte array.
@param inOff the offset at which the input data starts.
@param length the number of bytes to be copied out of the input array.
@param out the space for any output that might be produced.
@param outOff the offset from which the output will be copied.
@return the number of output bytes copied to out.
@exception DataLengthException if there isn't enough space in out.
@exception InvalidOperationException if the cipher isn't initialised.
Process the last block in the buffer.
@param out the array the block currently being held is copied into.
@param outOff the offset at which the copying starts.
@return the number of output bytes copied to out.
@exception DataLengthException if there is insufficient space in out for
the output.
@exception InvalidOperationException if the underlying cipher is not
initialised.
@exception InvalidCipherTextException if cipher text decrypts wrongly (in
case the exception will never Get thrown).
A Two-Pass Authenticated-Encryption Scheme Optimized for Simplicity and
Efficiency - by M. Bellare, P. Rogaway, D. Wagner.
http://www.cs.ucdavis.edu/~rogaway/papers/eax.pdf
EAX is an AEAD scheme based on CTR and OMAC1/CMAC, that uses a single block
cipher to encrypt and authenticate data. It's on-line (the length of a
message isn't needed to begin processing it), has good performances, it's
simple and provably secure (provided the underlying block cipher is secure).
Of course, this implementations is NOT thread-safe.
Constructor that accepts an instance of a block cipher engine.
@param cipher the engine to use
Implements the Galois/Counter mode (GCM) detailed in
NIST Special Publication 800-38D.
implements the GOST 28147 OFB counter mode (GCTR).
Basic constructor.
@param cipher the block cipher to be used as the basis of the
counter mode (must have a 64 bit block size).
return the underlying block cipher that we are wrapping.
@return the underlying block cipher that we are wrapping.
Initialise the cipher and, possibly, the initialisation vector (IV).
If an IV isn't passed as part of the parameter, the IV will be all zeros.
An IV which is too short is handled in FIPS compliant fashion.
@param encrypting if true the cipher is initialised for
encryption, if false for decryption.
@param parameters the key and other data required by the cipher.
@exception ArgumentException if the parameters argument is inappropriate.
return the block size we are operating at (in bytes).
@return the block size we are operating at (in bytes).
Process one block of input from the array in and write it to
the out array.
@param in the array containing the input data.
@param inOff offset into the in array the data starts at.
@param out the array the output data will be copied into.
@param outOff the offset into the out array the output will start at.
@exception DataLengthException if there isn't enough data in in, or
space in out.
@exception InvalidOperationException if the cipher isn't initialised.
@return the number of bytes processed and produced.
reset the feedback vector back to the IV and reset the underlying
cipher.
return the algorithm name and mode.
@return the name of the underlying algorithm followed by "/GCTR"
and the block size in bits
An implementation of the "work in progress" Internet-Draft The OCB Authenticated-Encryption
Algorithm, licensed per:
License for
Open-Source Software Implementations of OCB (Jan 9, 2013) - 'License 1'
Under this license, you are authorized to make, use, and distribute open-source software
implementations of OCB. This license terminates for you if you sue someone over their open-source
software implementation of OCB claiming that you have a patent covering their implementation.
This is a non-binding summary of a legal document (the link above). The parameters of the license
are specified in the license document and that document is controlling.
implements a Output-FeedBack (OFB) mode on top of a simple cipher.
Basic constructor.
@param cipher the block cipher to be used as the basis of the
feedback mode.
@param blockSize the block size in bits (note: a multiple of 8)
return the underlying block cipher that we are wrapping.
@return the underlying block cipher that we are wrapping.
Initialise the cipher and, possibly, the initialisation vector (IV).
If an IV isn't passed as part of the parameter, the IV will be all zeros.
An IV which is too short is handled in FIPS compliant fashion.
@param forEncryption if true the cipher is initialised for
encryption, if false for decryption.
@param param the key and other data required by the cipher.
@exception ArgumentException if the parameters argument is
inappropriate.
return the block size we are operating at (in bytes).
@return the block size we are operating at (in bytes).
Process one block of input from the array in and write it to
the out array.
@param in the array containing the input data.
@param inOff offset into the in array the data starts at.
@param out the array the output data will be copied into.
@param outOff the offset into the out array the output will start at.
@exception DataLengthException if there isn't enough data in in, or
space in out.
@exception InvalidOperationException if the cipher isn't initialised.
@return the number of bytes processed and produced.
reset the feedback vector back to the IV and reset the underlying
cipher.
return the algorithm name and mode.
@return the name of the underlying algorithm followed by "/OFB"
and the block size in bits
* Implements OpenPGP's rather strange version of Cipher-FeedBack (CFB) mode
* on top of a simple cipher. This class assumes the IV has been prepended
* to the data stream already, and just accomodates the reset after
* (blockSize + 2) bytes have been read.
*
* For further info see RFC 2440.
*
Basic constructor.
@param cipher the block cipher to be used as the basis of the
feedback mode.
return the underlying block cipher that we are wrapping.
@return the underlying block cipher that we are wrapping.
return the block size we are operating at.
@return the block size we are operating at (in bytes).
Process one block of input from the array in and write it to
the out array.
@param in the array containing the input data.
@param inOff offset into the in array the data starts at.
@param out the array the output data will be copied into.
@param outOff the offset into the out array the output will start at.
@exception DataLengthException if there isn't enough data in in, or
space in out.
@exception InvalidOperationException if the cipher isn't initialised.
@return the number of bytes processed and produced.
reset the chaining vector back to the IV and reset the underlying
cipher.
Initialise the cipher and, possibly, the initialisation vector (IV).
If an IV isn't passed as part of the parameter, the IV will be all zeros.
An IV which is too short is handled in FIPS compliant fashion.
@param forEncryption if true the cipher is initialised for
encryption, if false for decryption.
@param parameters the key and other data required by the cipher.
@exception ArgumentException if the parameters argument is
inappropriate.
Encrypt one byte of data according to CFB mode.
@param data the byte to encrypt
@param blockOff offset in the current block
@returns the encrypted byte
Do the appropriate processing for CFB IV mode encryption.
@param in the array containing the data to be encrypted.
@param inOff offset into the in array the data starts at.
@param out the array the encrypted data will be copied into.
@param outOff the offset into the out array the output will start at.
@exception DataLengthException if there isn't enough data in in, or
space in out.
@exception InvalidOperationException if the cipher isn't initialised.
@return the number of bytes processed and produced.
Do the appropriate processing for CFB IV mode decryption.
@param in the array containing the data to be decrypted.
@param inOff offset into the in array the data starts at.
@param out the array the encrypted data will be copied into.
@param outOff the offset into the out array the output will start at.
@exception DataLengthException if there isn't enough data in in, or
space in out.
@exception InvalidOperationException if the cipher isn't initialised.
@return the number of bytes processed and produced.
return the algorithm name and mode.
@return the name of the underlying algorithm followed by "/PGPCFB"
and the block size in bits.
Implements the Segmented Integer Counter (SIC) mode on top of a simple
block cipher.
Basic constructor.
@param c the block cipher to be used.
return the underlying block cipher that we are wrapping.
@return the underlying block cipher that we are wrapping.
Block cipher padders are expected to conform to this interface
Initialise the padder.
@param param parameters, if any required.
add the pad bytes to the passed in block, returning the
number of bytes added.
return the number of pad bytes present in the block.
@exception InvalidCipherTextException if the padding is badly formed
or invalid.
Return the name of the algorithm the cipher implements.
@return the name of the algorithm the cipher implements.
A padder that adds ISO10126-2 padding to a block.
Initialise the padder.
@param random a SecureRandom if available.
add the pad bytes to the passed in block, returning the
number of bytes added.
return the number of pad bytes present in the block.
Return the name of the algorithm the cipher implements.
@return the name of the algorithm the cipher implements.
A padder that adds the padding according to the scheme referenced in
ISO 7814-4 - scheme 2 from ISO 9797-1. The first byte is 0x80, rest is 0x00
Initialise the padder.
@param random - a SecureRandom if available.
add the pad bytes to the passed in block, returning the
number of bytes added.
return the number of pad bytes present in the block.
Return the name of the algorithm the padder implements.
@return the name of the algorithm the padder implements.
A wrapper class that allows block ciphers to be used to process data in
a piecemeal fashion with padding. The PaddedBufferedBlockCipher
outputs a block only when the buffer is full and more data is being added,
or on a doFinal (unless the current block in the buffer is a pad block).
The default padding mechanism used is the one outlined in Pkcs5/Pkcs7.
Create a buffered block cipher with the desired padding.
@param cipher the underlying block cipher this buffering object wraps.
@param padding the padding type.
Create a buffered block cipher Pkcs7 padding
@param cipher the underlying block cipher this buffering object wraps.
initialise the cipher.
@param forEncryption if true the cipher is initialised for
encryption, if false for decryption.
@param param the key and other data required by the cipher.
@exception ArgumentException if the parameters argument is
inappropriate.
return the minimum size of the output buffer required for an update
plus a doFinal with an input of len bytes.
@param len the length of the input.
@return the space required to accommodate a call to update and doFinal
with len bytes of input.
return the size of the output buffer required for an update
an input of len bytes.
@param len the length of the input.
@return the space required to accommodate a call to update
with len bytes of input.
process a single byte, producing an output block if neccessary.
@param in the input byte.
@param out the space for any output that might be produced.
@param outOff the offset from which the output will be copied.
@return the number of output bytes copied to out.
@exception DataLengthException if there isn't enough space in out.
@exception InvalidOperationException if the cipher isn't initialised.
process an array of bytes, producing output if necessary.
@param in the input byte array.
@param inOff the offset at which the input data starts.
@param len the number of bytes to be copied out of the input array.
@param out the space for any output that might be produced.
@param outOff the offset from which the output will be copied.
@return the number of output bytes copied to out.
@exception DataLengthException if there isn't enough space in out.
@exception InvalidOperationException if the cipher isn't initialised.
Process the last block in the buffer. If the buffer is currently
full and padding needs to be added a call to doFinal will produce
2 * GetBlockSize() bytes.
@param out the array the block currently being held is copied into.
@param outOff the offset at which the copying starts.
@return the number of output bytes copied to out.
@exception DataLengthException if there is insufficient space in out for
the output or we are decrypting and the input is not block size aligned.
@exception InvalidOperationException if the underlying cipher is not
initialised.
@exception InvalidCipherTextException if padding is expected and not found.
A padder that adds Pkcs7/Pkcs5 padding to a block.
Initialise the padder.
@param random - a SecureRandom if available.
add the pad bytes to the passed in block, returning the
number of bytes added.
return the number of pad bytes present in the block.
Return the name of the algorithm the cipher implements.
@return the name of the algorithm the cipher implements.
A padder that adds Trailing-Bit-Compliment padding to a block.
This padding pads the block out compliment of the last bit
of the plain text.
Initialise the padder.
- a SecureRandom if available.
add the pad bytes to the passed in block, returning the
number of bytes added.
Note: this assumes that the last block of plain text is always
passed to it inside in. i.e. if inOff is zero, indicating the
entire block is to be overwritten with padding the value of in
should be the same as the last block of plain text.
return the number of pad bytes present in the block.
Return the name of the algorithm the cipher implements.
the name of the algorithm the cipher implements.
A padder that adds X9.23 padding to a block - if a SecureRandom is
passed in random padding is assumed, otherwise padding with zeros is used.
Initialise the padder.
@param random a SecureRandom if one is available.
add the pad bytes to the passed in block, returning the
number of bytes added.
return the number of pad bytes present in the block.
Return the name of the algorithm the cipher implements.
@return the name of the algorithm the cipher implements.
A padder that adds Null byte padding to a block.
Initialise the padder.
- a SecureRandom if available.
add the pad bytes to the passed in block, returning the
number of bytes added.
return the number of pad bytes present in the block.
Return the name of the algorithm the cipher implements.
the name of the algorithm the cipher implements.
Base constructor.
@param key key to be used by underlying cipher
@param macSize macSize in bits
@param nonce nonce to be used
Base constructor.
@param key key to be used by underlying cipher
@param macSize macSize in bits
@param nonce nonce to be used
@param associatedText associated text, if any
Base constructor.
@param key key to be used by underlying cipher
@param macSize macSize in bits
@param nonce nonce to be used
@param associatedText associated text, if any
DES has 16 weak keys. This method will check
if the given DES key material is weak or semi-weak.
Key material that is too short is regarded as weak.
See "Applied
Cryptography" by Bruce Schneier for more information.
@return true if the given DES key material is weak or semi-weak,
false otherwise.
DES Keys use the LSB as the odd parity bit. This can
be used to check for corrupt keys.
@param bytes the byte array to set the parity on.
return true if the passed in key is a DES-EDE weak key.
@param key bytes making up the key
@param offset offset into the byte array the key starts at
@param length number of bytes making up the key
return true if the passed in key is a DES-EDE weak key.
@param key bytes making up the key
@param offset offset into the byte array the key starts at
The minimum bitlength of the private value.
The bitlength of the private value.
Construct without a usage index, this will do a random construction of G.
@param L desired length of prime P in bits (the effective key size).
@param N desired length of prime Q in bits.
@param certainty certainty level for prime number generation.
@param random the source of randomness to use.
Construct for a specific usage index - this has the effect of using verifiable canonical generation of G.
@param L desired length of prime P in bits (the effective key size).
@param N desired length of prime Q in bits.
@param certainty certainty level for prime number generation.
@param random the source of randomness to use.
@param usageIndex a valid usage index.
return the generator - g
return private value limit - l
parameters for using an integrated cipher in stream mode.
@param derivation the derivation parameter for the KDF function.
@param encoding the encoding parameter for the KDF function.
@param macKeySize the size of the MAC key (in bits).
@param derivation the derivation parameter for the KDF function.
@param encoding the encoding parameter for the KDF function.
@param macKeySize the size of the MAC key (in bits).
@param cipherKeySize the size of the associated Cipher key (in bits).
parameters for Key derivation functions for ISO-18033
parameters for Key derivation functions for IEEE P1363a
Parameters for mask derivation functions.
Parameters for NaccacheStern public private key generation. For details on
this cipher, please see
http://www.gemplus.com/smart/rd/publications/pdf/NS98pkcs.pdf
Parameters for generating a NaccacheStern KeyPair.
@param random
The source of randomness
@param strength
The desired strength of the Key in Bits
@param certainty
the probability that the generated primes are not really prime
as integer: 2^(-certainty) is then the probability
@param countSmallPrimes
How many small key factors are desired
Parameters for a NaccacheStern KeyPair.
@param random
The source of randomness
@param strength
The desired strength of the Key in Bits
@param certainty
the probability that the generated primes are not really prime
as integer: 2^(-certainty) is then the probability
@param cntSmallPrimes
How many small key factors are desired
@param debug
Turn debugging on or off (reveals secret information, use with
caution)
@return Returns the certainty.
@return Returns the countSmallPrimes.
Public key parameters for NaccacheStern cipher. For details on this cipher,
please see
http://www.gemplus.com/smart/rd/publications/pdf/NS98pkcs.pdf
@param privateKey
@return Returns the g.
@return Returns the lowerSigmaBound.
@return Returns the n.
Private key parameters for NaccacheStern cipher. For details on this cipher,
please see
http://www.gemplus.com/smart/rd/publications/pdf/NS98pkcs.pdf
Constructs a NaccacheSternPrivateKey
@param g
the public enryption parameter g
@param n
the public modulus n = p*q
@param lowerSigmaBound
the public lower sigma bound up to which data can be encrypted
@param smallPrimes
the small primes, of which sigma is constructed in the right
order
@param phi_n
the private modulus phi(n) = (p-1)(q-1)
Cipher parameters with a fixed salt value associated with them.
Uses Microsoft's RNGCryptoServiceProvider
Generic interface for objects generating random bytes.
Add more seed material to the generator.
A byte array to be mixed into the generator's state.
Add more seed material to the generator.
A long value to be mixed into the generator's state.
Fill byte array with random values.
Array to be filled.
Fill byte array with random values.
Array to receive bytes.
Index to start filling at.
Length of segment to fill.
Random generation based on the digest with counter. Calling AddSeedMaterial will
always increase the entropy of the hash.
Internal access to the digest is synchronized so a single one of these can be shared.
Takes bytes generated by an underling RandomGenerator and reverses the order in
each small window (of configurable size).
Access to internals is synchronized so a single one of these can be shared.
Add more seed material to the generator.
A byte array to be mixed into the generator's state.
Add more seed material to the generator.
A long value to be mixed into the generator's state.
Fill byte array with random values.
Array to be filled.
Fill byte array with random values.
Array to receive bytes.
Index to start filling at.
Length of segment to fill.
A thread based seed generator - one source of randomness.
Based on an idea from Marcus Lippert.
Generate seed bytes. Set fast to false for best quality.
If fast is set to true, the code should be round about 8 times faster when
generating a long sequence of random bytes. 20 bytes of random values using
the fast mode take less than half a second on a Nokia e70. If fast is set to false,
it takes round about 2500 ms.
@param numBytes the number of bytes to generate
@param fast true if fast mode should be used
Permutation generated by code:
// First 1850 fractional digit of Pi number.
byte[] key = new BigInteger("14159265358979323846...5068006422512520511").ToByteArray();
s = 0;
P = new byte[256];
for (int i = 0; i < 256; i++)
{
P[i] = (byte) i;
}
for (int m = 0; m < 768; m++)
{
s = P[(s + P[m & 0xff] + key[m % key.length]) & 0xff];
byte temp = P[m & 0xff];
P[m & 0xff] = P[s & 0xff];
P[s & 0xff] = temp;
}
Value generated in the same way as P.
update the internal digest with the byte b
update the internal digest with the byte array in
Generate a signature for the message we've been loaded with using
the key we were initialised with.
true if the internal state represents the signature described in the passed in array.
Reset the internal state
The Digital Signature Algorithm - as described in "Handbook of Applied
Cryptography", pages 452 - 453.
Generate a signature for the given message using the key we were
initialised with. For conventional DSA the message should be a SHA-1
hash of the message of interest.
@param message the message that will be verified later.
return true if the value r and s represent a DSA signature for
the passed in message for standard DSA the message should be a
SHA-1 hash of the real message to be verified.
EC-DSA as described in X9.62
Generate a signature for the given message using the key we were
initialised with. For conventional DSA the message should be a SHA-1
hash of the message of interest.
@param message the message that will be verified later.
return true if the value r and s represent a DSA signature for
the passed in message (for standard DSA the message should be
a SHA-1 hash of the real message to be verified).
GOST R 34.10-2001 Signature Algorithm
generate a signature for the given message using the key we were
initialised with. For conventional GOST3410 the message should be a GOST3411
hash of the message of interest.
@param message the message that will be verified later.
return true if the value r and s represent a GOST3410 signature for
the passed in message (for standard GOST3410 the message should be
a GOST3411 hash of the real message to be verified).
EC-NR as described in IEEE 1363-2000
generate a signature for the given message using the key we were
initialised with. Generally, the order of the curve should be at
least as long as the hash of the message of interest, and with
ECNR it *must* be at least as long.
@param digest the digest to be signed.
@exception DataLengthException if the digest is longer than the key allows
return true if the value r and s represent a signature for the
message passed in. Generally, the order of the curve should be at
least as long as the hash of the message of interest, and with
ECNR, it *must* be at least as long. But just in case the signer
applied mod(n) to the longer digest, this implementation will
apply mod(n) during verification.
@param digest the digest to be verified.
@param r the r value of the signature.
@param s the s value of the signature.
@exception DataLengthException if the digest is longer than the key allows
initialise the signer for signing or verification.
@param forSigning
true if for signing, false otherwise
@param parameters
necessary parameters.
update the internal digest with the byte b
update the internal digest with the byte array in
Generate a signature for the message we've been loaded with using the key
we were initialised with.
return true if the internal state represents the signature described in
the passed in array.
update the internal digest with the byte b
update the internal digest with the byte array in
Generate a signature for the message we've been loaded with using
the key we were initialised with.
true if the internal state represents the signature described in the passed in array.
Reset the internal state
Gost R 34.10-94 Signature Algorithm
generate a signature for the given message using the key we were
initialised with. For conventional Gost3410 the message should be a Gost3411
hash of the message of interest.
@param message the message that will be verified later.
return true if the value r and s represent a Gost3410 signature for
the passed in message for standard Gost3410 the message should be a
Gost3411 hash of the real message to be verified.
ISO9796-2 - mechanism using a hash function with recovery (scheme 2 and 3).
Note: the usual length for the salt is the length of the hash
function used in bytes.
Return a reference to the recoveredMessage message.
The full/partial recoveredMessage message.
Generate a signer for the with either implicit or explicit trailers
for ISO9796-2, scheme 2 or 3.
base cipher to use for signature creation/verification
digest to use.
length of salt in bytes.
whether or not the trailer is implicit or gives the hash.
Constructor for a signer with an explicit digest trailer.
cipher to use.
digest to sign with.
length of salt in bytes.
Initialise the signer.
true if for signing, false if for verification.
parameters for signature generation/verification. If the
parameters are for generation they should be a ParametersWithRandom,
a ParametersWithSalt, or just an RsaKeyParameters object. If RsaKeyParameters
are passed in a SecureRandom will be created.
if wrong parameter type or a fixed
salt is passed in which is the wrong length.
compare two byte arrays - constant time.
clear possible sensitive data
update the internal digest with the byte b
update the internal digest with the byte array in
reset the internal state
Generate a signature for the loaded message using the key we were
initialised with.
return true if the signature represents a ISO9796-2 signature
for the passed in message.
Return true if the full message was recoveredMessage.
true on full message recovery, false otherwise, or if not sure.
int to octet string.
int to octet string.
long to octet string.
mask generator function, as described in Pkcs1v2.
ISO9796-2 - mechanism using a hash function with recovery (scheme 1)
Return a reference to the recoveredMessage message.
The full/partial recoveredMessage message.
Generate a signer for the with either implicit or explicit trailers
for ISO9796-2.
base cipher to use for signature creation/verification
digest to use.
whether or not the trailer is implicit or gives the hash.
Constructor for a signer with an explicit digest trailer.
cipher to use.
digest to sign with.
compare two byte arrays - constant time.
clear possible sensitive data
update the internal digest with the byte b
update the internal digest with the byte array in
reset the internal state
Generate a signature for the loaded message using the key we were
initialised with.
return true if the signature represents a ISO9796-2 signature
for the passed in message.
Return true if the full message was recoveredMessage.
true on full message recovery, false otherwise.
RSA-PSS as described in Pkcs# 1 v 2.1.
Note: the usual value for the salt length is the number of
bytes in the hash function.
Basic constructor
the asymmetric cipher to use.
the digest to use.
the length of the salt to use (in bytes).
clear possible sensitive data
update the internal digest with the byte b
update the internal digest with the byte array in
reset the internal state
Generate a signature for the message we've been loaded with using
the key we were initialised with.
return true if the internal state represents the signature described
in the passed in array.
int to octet string.
mask generator function, as described in Pkcs1v2.
Load oid table.
Initialise the signer for signing or verification.
@param forSigning true if for signing, false otherwise
@param param necessary parameters.
update the internal digest with the byte b
update the internal digest with the byte array in
Generate a signature for the message we've been loaded with using
the key we were initialised with.
return true if the internal state represents the signature described
in the passed in array.
a wrapper for block ciphers with a single byte block size, so that they
can be treated like stream ciphers.
basic constructor.
@param cipher the block cipher to be wrapped.
@exception ArgumentException if the cipher has a block size other than
one.
initialise the underlying cipher.
@param forEncryption true if we are setting up for encryption, false otherwise.
@param param the necessary parameters for the underlying cipher to be initialised.
encrypt/decrypt a single byte returning the result.
@param in the byte to be processed.
@return the result of processing the input byte.
process a block of bytes from in putting the result into out.
@param in the input byte array.
@param inOff the offset into the in array where the data to be processed starts.
@param len the number of bytes to be processed.
@param out the output buffer the processed bytes go into.
@param outOff the offset into the output byte array the processed data stars at.
@exception DataLengthException if the output buffer is too small.
reset the underlying cipher. This leaves it in the same state
it was at after the last init (if there was one).
return the name of the algorithm we are wrapping.
@return the name of the algorithm we are wrapping.
A certificate verifyer, that will always return true.
DO NOT USE THIS FILE UNLESS YOU KNOW EXACTLY WHAT YOU ARE DOING.
This should be implemented by any class which can find out, if a given
certificate chain is being accepted by an client.
The certs, which are part of the chain.
True, if the chain is accepted, false otherwise
Return true.
A queue for bytes.
This file could be more optimized.
The initial size for our buffer.
The smallest number which can be written as 2^x which is bigger than i.
The buffer where we store our data.
How many bytes at the beginning of the buffer are skipped.
How many bytes in the buffer are valid data.
Read data from the buffer.
The buffer where the read data will be copied to.
How many bytes to skip at the beginning of buf.
How many bytes to read at all.
How many bytes from our data to skip.
Add some data to our buffer.
A byte-array to read data from.
How many bytes to skip at the beginning of the array.
How many bytes to read from the array.
Remove some bytes from our data from the beginning.
How many bytes to remove.
The number of bytes which are available in this buffer.
A representation for a certificate chain.
The certificates.
Parse the ServerCertificate message.
@param inStr The stream where to parse from.
@return A Certificate object with the certs, the server has sended.
@throws IOException If something goes wrong during parsing.
Encodes version of the ClientCertificate message
@param outStr stream to write the message to
@throws IOException If something goes wrong
Private constructor from a cert array.
@param certs The certs the chain should contain.
An array which contains the certs, this chain contains.
A combined hash, which implements md5(m) || sha1(m).
Called at the start of a new TLS session, before any other methods.
A
Get the list of cipher suites that this client supports.
An array of , each specifying a supported cipher suite.
Get the list of compression methods that this client supports.
An array of , each specifying a supported compression method.
Get the (optional) table of client extensions to be included in (extended) client hello.
A ( -> byte[]). May be null.
Reports the session ID once it has been determined.
A
Report the cipher suite that was selected by the server.
The protocol handler validates this value against the offered cipher suites
A
Report the compression method that was selected by the server.
The protocol handler validates this value against the offered compression methods
A
Report whether the server supports secure renegotiation
The protocol handler automatically processes the relevant extensions
A , true if the server supports secure renegotiation
Report the extensions from an extended server hello.
Will only be called if we returned a non-null result from .
A ( -> byte[])
Return an implementation of to negotiate the key exchange
part of the protocol.
A
Return an implementation of to handle authentication
part of the protocol.
Return an implementation of to handle record compression.
Return an implementation of to use for encryption/decryption.
A
An implementation of the TLS 1.0 record layer.
A generic TLS 1.0 block cipher. This can be used for AES or 3DES for example.
TLS 1.0 DH key exchange.
A generic interface for key exchange implementations in TLS 1.0.
A generic TLS MAC implementation, which can be used with any kind of
IDigest to act as an HMAC.
Generate a new instance of an TlsMac.
@param digest The digest to use.
@param key_block A byte-array where the key for this mac is located.
@param offset The number of bytes to skip, before the key starts in the buffer.
@param len The length of the key.
@return the MAC write secret
Increment the current write sequence number
Calculate the mac for some given data.
TlsMac will keep track of the sequence number internally.
@param type The message type of the message.
@param message A byte-buffer containing the message.
@param offset The number of bytes to skip, before the message starts.
@param len The length of the message.
@return A new byte-buffer containing the mac value.
@return the current write sequence number
@return The Keysize of the mac.
A NULL cipher suite, for use during handshake.
An implementation of all high level protocols in TLS 1.0.
Both streams can be the same object
Both streams can be the same object
This method is called, when a change cipher spec message is received.
@throws IOException If the message has an invalid content or the
handshake is not in the correct state.
Connects to the remote system.
Will be used when a certificate is received to verify
that this certificate is accepted by the client.
If handshake was not successful
Read data from the network. The method will return immediately, if there is
still some data left in the buffer, or block until some application
data has been read from the network.
@param buf The buffer where the data will be copied to.
@param offset The position where the data will be placed in the buffer.
@param len The maximum number of bytes to read.
@return The number of bytes read.
@throws IOException If something goes wrong during reading data.
Send some application data to the remote system.
The method will handle fragmentation internally.
@param buf The buffer with the data.
@param offset The position in the buffer where the data is placed.
@param len The length of the data.
@throws IOException If something goes wrong during sending.
Terminate this connection with an alert.
Can be used for normal closure too.
@param alertLevel The level of the alert, an be AlertLevel.fatal or AL_warning.
@param alertDescription The exact alert message.
@throws IOException If alert was fatal.
Closes this connection
If something goes wrong during closing.
Make sure the Stream is now empty. Fail otherwise.
@param is The Stream to check.
@throws IOException If is is not empty.
A Stream which can be used to send data.
A Stream which can be used to read data.
The secure bidirectional stream for this connection
TLS 1.0 RSA key exchange.
TLS 1.1 SRP key exchange.
Some helper functions for MicroTLS.
return a = a + b - b preserved.
unsigned comparison on two arrays - note the arrays may
start with leading zeros.
return z = x / y - done in place (z value preserved, x contains the
remainder)
return whether or not a BigInteger is probably prime with a
probability of 1 - (1/2)**certainty.
From Knuth Vol 2, pg 395.
Calculate the numbers u1, u2, and u3 such that:
u1 * a + u2 * b = u3
where u3 is the greatest common divider of a and b.
a and b using the extended Euclid algorithm (refer p. 323
of The Art of Computer Programming vol 2, 2nd ed).
This also seems to have the side effect of calculating
some form of multiplicative inverse.
@param a First number to calculate gcd for
@param b Second number to calculate gcd for
@param u1Out the return object for the u1 value
@param u2Out the return object for the u2 value
@return The greatest common divisor of a and b
return w with w = x * x - w is assumed to have enough space.
return x with x = y * z - x is assumed to have enough space.
Calculate mQuote = -m^(-1) mod b with b = 2^32 (32 = word size)
Montgomery multiplication: a = x * y * R^(-1) mod m
Based algorithm 14.36 of Handbook of Applied Cryptography.
m, x, y should have length n
a should have length (n + 1)
b = 2^32, R = b^n
The result is put in x
NOTE: the indices of x, y, m, a different in HAC and in Java
return x = x % y - done in place (y value preserved)
do a left shift - this returns a new array.
do a right shift - this does it in place.
do a right shift by one - this does it in place.
returns x = x - y - we assume x is >= y
Class representing a simple version of a big decimal. A
SimpleBigDecimal
is basically a
{@link java.math.BigInteger BigInteger} with a few digits on the right of
the decimal point. The number of (binary) digits on the right of the decimal
point is called the scale
of the SimpleBigDecimal
.
Unlike in {@link java.math.BigDecimal BigDecimal}, the scale is not adjusted
automatically, but must be set manually. All SimpleBigDecimal
s
taking part in the same arithmetic operation must have equal scale. The
result of a multiplication of two SimpleBigDecimal
s returns a
SimpleBigDecimal
with double scale.
Returns a SimpleBigDecimal
representing the same numerical
value as value
.
@param value The value of the SimpleBigDecimal
to be
created.
@param scale The scale of the SimpleBigDecimal
to be
created.
@return The such created SimpleBigDecimal
.
Constructor for SimpleBigDecimal
. The value of the
constructed SimpleBigDecimal
Equals bigInt /
2scale
.
@param bigInt The bigInt
value parameter.
@param scale The scale of the constructed SimpleBigDecimal
.
Class holding methods for point multiplication based on the window
τ-adic nonadjacent form (WTNAF). The algorithms are based on the
paper "Improved Algorithms for Arithmetic on Anomalous Binary Curves"
by Jerome A. Solinas. The paper first appeared in the Proceedings of
Crypto 1997.
The window width of WTNAF. The standard value of 4 is slightly less
than optimal for running time, but keeps space requirements for
precomputation low. For typical curves, a value of 5 or 6 results in
a better running time. When changing this value, the
αu
's must be computed differently, see
e.g. "Guide to Elliptic Curve Cryptography", Darrel Hankerson,
Alfred Menezes, Scott Vanstone, Springer-Verlag New York Inc., 2004,
p. 121-122
24
The αu
's for a=0
as an array
of ZTauElement
s.
The αu
's for a=0
as an array
of TNAFs.
The αu
's for a=1
as an array
of ZTauElement
s.
The αu
's for a=1
as an array
of TNAFs.
Computes the norm of an element λ
of
Z[τ]
.
@param mu The parameter μ
of the elliptic curve.
@param lambda The element λ
of
Z[τ]
.
@return The norm of λ
.
Computes the norm of an element λ
of
R[τ]
, where λ = u + vτ
and u
and u
are real numbers (elements of
R
).
@param mu The parameter μ
of the elliptic curve.
@param u The real part of the element λ
of
R[τ]
.
@param v The τ
-adic part of the element
λ
of R[τ]
.
@return The norm of λ
.
Rounds an element λ
of R[τ]
to an element of Z[τ]
, such that their difference
has minimal norm. λ
is given as
λ = λ0 + λ1τ
.
@param lambda0 The component λ0
.
@param lambda1 The component λ1
.
@param mu The parameter μ
of the elliptic curve. Must
equal 1 or -1.
@return The rounded element of Z[τ]
.
@throws ArgumentException if lambda0
and
lambda1
do not have same scale.
Approximate division by n
. For an integer
k
, the value λ = s k / n
is
computed to c
bits of accuracy.
@param k The parameter k
.
@param s The curve parameter s0
or
s1
.
@param vm The Lucas Sequence element Vm
.
@param a The parameter a
of the elliptic curve.
@param m The bit length of the finite field
Fm
.
@param c The number of bits of accuracy, i.e. the scale of the returned
SimpleBigDecimal
.
@return The value λ = s k / n
computed to
c
bits of accuracy.
Computes the τ
-adic NAF (non-adjacent form) of an
element λ
of Z[τ]
.
@param mu The parameter μ
of the elliptic curve.
@param lambda The element λ
of
Z[τ]
.
@return The τ
-adic NAF of λ
.
Applies the operation τ()
to an
F2mPoint
.
@param p The F2mPoint to which τ()
is applied.
@return τ(p)
Returns the parameter μ
of the elliptic curve.
@param curve The elliptic curve from which to obtain μ
.
The curve must be a Koblitz curve, i.e. a
Equals
0
or 1
and b
Equals
1
.
@return μ
of the elliptic curve.
@throws ArgumentException if the given ECCurve is not a Koblitz
curve.
Calculates the Lucas Sequence elements Uk-1
and
Uk
or Vk-1
and
Vk
.
@param mu The parameter μ
of the elliptic curve.
@param k The index of the second element of the Lucas Sequence to be
returned.
@param doV If set to true, computes Vk-1
and
Vk
, otherwise Uk-1
and
Uk
.
@return An array with 2 elements, containing Uk-1
and Uk
or Vk-1
and Vk
.
Computes the auxiliary value tw
. If the width is
4, then for mu = 1
, tw = 6
and for
mu = -1
, tw = 10
@param mu The parameter μ
of the elliptic curve.
@param w The window width of the WTNAF.
@return the auxiliary value tw
Computes the auxiliary values s0
and
s1
used for partial modular reduction.
@param curve The elliptic curve for which to compute
s0
and s1
.
@throws ArgumentException if curve
is not a
Koblitz curve (Anomalous Binary Curve, ABC).
Partial modular reduction modulo
(τm - 1)/(τ - 1)
.
@param k The integer to be reduced.
@param m The bitlength of the underlying finite field.
@param a The parameter a
of the elliptic curve.
@param s The auxiliary values s0
and
s1
.
@param mu The parameter μ of the elliptic curve.
@param c The precision (number of bits of accuracy) of the partial
modular reduction.
@return ρ := k partmod (τm - 1)/(τ - 1)
Multiplies a {@link org.bouncycastle.math.ec.F2mPoint F2mPoint}
by a BigInteger
using the reduced τ
-adic
NAF (RTNAF) method.
@param p The F2mPoint to Multiply.
@param k The BigInteger
by which to Multiply p
.
@return k * p
Multiplies a {@link org.bouncycastle.math.ec.F2mPoint F2mPoint}
by an element λ
of Z[τ]
using the τ
-adic NAF (TNAF) method.
@param p The F2mPoint to Multiply.
@param lambda The element λ
of
Z[τ]
.
@return λ * p
Multiplies a {@link org.bouncycastle.math.ec.F2mPoint F2mPoint}
by an element λ
of Z[τ]
using the τ
-adic NAF (TNAF) method, given the TNAF
of λ
.
@param p The F2mPoint to Multiply.
@param u The the TNAF of λ
..
@return λ * p
Computes the [τ]
-adic window NAF of an element
λ
of Z[τ]
.
@param mu The parameter μ of the elliptic curve.
@param lambda The element λ
of
Z[τ]
of which to compute the
[τ]
-adic NAF.
@param width The window width of the resulting WNAF.
@param pow2w 2width.
@param tw The auxiliary value tw
.
@param alpha The αu
's for the window width.
@return The [τ]
-adic window NAF of
λ
.
Does the precomputation for WTNAF multiplication.
@param p The ECPoint
for which to do the precomputation.
@param a The parameter a
of the elliptic curve.
@return The precomputation array for p
.
Class representing an element of Z[τ]
. Let
λ
be an element of Z[τ]
. Then
λ
is given as λ = u + vτ
. The
components u
and v
may be used directly, there
are no accessor methods.
Immutable class.
The "real" part of λ
.
The "τ
-adic" part of λ
.
Constructor for an element λ
of
Z[τ]
.
@param u The "real" part of λ
.
@param v The "τ
-adic" part of
λ
.
Base class for an elliptic curve.
Decode a point on this curve from its ASN.1 encoding. The different
encodings are taken account of, including point compression for
Fp
(X9.62 s 4.2.1 pg 17).
@return The decoded point.
Elliptic curve over Fp
Elliptic curves over F2m. The Weierstrass equation is given by
y2 + xy = x3 + ax2 + b
.
The exponent m
of F2m
.
TPB: The integer k
where xm +
xk + 1
represents the reduction polynomial
f(z)
.
PPB: The integer k1
where xm +
xk3 + xk2 + xk1 + 1
represents the reduction polynomial f(z)
.
TPB: Always set to 0
PPB: The integer k2
where xm +
xk3 + xk2 + xk1 + 1
represents the reduction polynomial f(z)
.
TPB: Always set to 0
PPB: The integer k3
where xm +
xk3 + xk2 + xk1 + 1
represents the reduction polynomial f(z)
.
The order of the base point of the curve.
The cofactor of the curve.
The point at infinity on this curve.
The parameter μ
of the elliptic curve if this is
a Koblitz curve.
The auxiliary values s0
and
s1
used for partial modular reduction for
Koblitz curves.
Constructor for Trinomial Polynomial Basis (TPB).
@param m The exponent m
of
F2m
.
@param k The integer k
where xm +
xk + 1
represents the reduction
polynomial f(z)
.
@param a The coefficient a
in the Weierstrass equation
for non-supersingular elliptic curves over
F2m
.
@param b The coefficient b
in the Weierstrass equation
for non-supersingular elliptic curves over
F2m
.
Constructor for Trinomial Polynomial Basis (TPB).
@param m The exponent m
of
F2m
.
@param k The integer k
where xm +
xk + 1
represents the reduction
polynomial f(z)
.
@param a The coefficient a
in the Weierstrass equation
for non-supersingular elliptic curves over
F2m
.
@param b The coefficient b
in the Weierstrass equation
for non-supersingular elliptic curves over
F2m
.
@param n The order of the main subgroup of the elliptic curve.
@param h The cofactor of the elliptic curve, i.e.
#Ea(F2m) = h * n
.
Constructor for Pentanomial Polynomial Basis (PPB).
@param m The exponent m
of
F2m
.
@param k1 The integer k1
where xm +
xk3 + xk2 + xk1 + 1
represents the reduction polynomial f(z)
.
@param k2 The integer k2
where xm +
xk3 + xk2 + xk1 + 1
represents the reduction polynomial f(z)
.
@param k3 The integer k3
where xm +
xk3 + xk2 + xk1 + 1
represents the reduction polynomial f(z)
.
@param a The coefficient a
in the Weierstrass equation
for non-supersingular elliptic curves over
F2m
.
@param b The coefficient b
in the Weierstrass equation
for non-supersingular elliptic curves over
F2m
.
Constructor for Pentanomial Polynomial Basis (PPB).
@param m The exponent m
of
F2m
.
@param k1 The integer k1
where xm +
xk3 + xk2 + xk1 + 1
represents the reduction polynomial f(z)
.
@param k2 The integer k2
where xm +
xk3 + xk2 + xk1 + 1
represents the reduction polynomial f(z)
.
@param k3 The integer k3
where xm +
xk3 + xk2 + xk1 + 1
represents the reduction polynomial f(z)
.
@param a The coefficient a
in the Weierstrass equation
for non-supersingular elliptic curves over
F2m
.
@param b The coefficient b
in the Weierstrass equation
for non-supersingular elliptic curves over
F2m
.
@param n The order of the main subgroup of the elliptic curve.
@param h The cofactor of the elliptic curve, i.e.
#Ea(F2m) = h * n
.
Returns the parameter μ
of the elliptic curve.
@return μ
of the elliptic curve.
@throws ArgumentException if the given ECCurve is not a
Koblitz curve.
@return the auxiliary values s0
and
s1
used for partial modular reduction for
Koblitz curves.
Solves a quadratic equation z2 + z = beta
(X9.62
D.1.6) The other solution is z + 1
.
@param beta
The value to solve the qradratic equation for.
@return the solution for z2 + z = beta
or
null
if no solution exists.
Return true if curve uses a Trinomial basis.
@return true if curve Trinomial, false otherwise.
Returns true if this is a Koblitz curve (ABC curve).
@return true if this is a Koblitz curve (ABC curve), false otherwise
return a sqrt root - the routine verifies that the calculation
returns the right value - if none exists it returns null.
return the field name for this field.
@return the string "Fp".
Class representing the Elements of the finite field
F2m
in polynomial basis (PB)
representation. Both trinomial (Tpb) and pentanomial (Ppb) polynomial
basis representations are supported. Gaussian normal basis (GNB)
representation is not supported.
Indicates gaussian normal basis representation (GNB). Number chosen
according to X9.62. GNB is not implemented at present.
Indicates trinomial basis representation (Tpb). Number chosen
according to X9.62.
Indicates pentanomial basis representation (Ppb). Number chosen
according to X9.62.
Tpb or Ppb.
The exponent m
of F2m
.
Tpb: The integer k
where xm +
xk + 1
represents the reduction polynomial
f(z)
.
Ppb: The integer k1
where xm +
xk3 + xk2 + xk1 + 1
represents the reduction polynomial f(z)
.
Tpb: Always set to 0
Ppb: The integer k2
where xm +
xk3 + xk2 + xk1 + 1
represents the reduction polynomial f(z)
.
Tpb: Always set to 0
Ppb: The integer k3
where xm +
xk3 + xk2 + xk1 + 1
represents the reduction polynomial f(z)
.
The IntArray
holding the bits.
The number of int
s required to hold m
bits.
Constructor for Ppb.
@param m The exponent m
of
F2m
.
@param k1 The integer k1
where xm +
xk3 + xk2 + xk1 + 1
represents the reduction polynomial f(z)
.
@param k2 The integer k2
where xm +
xk3 + xk2 + xk1 + 1
represents the reduction polynomial f(z)
.
@param k3 The integer k3
where xm +
xk3 + xk2 + xk1 + 1
represents the reduction polynomial f(z)
.
@param x The BigInteger representing the value of the field element.
Constructor for Tpb.
@param m The exponent m
of
F2m
.
@param k The integer k
where xm +
xk + 1
represents the reduction
polynomial f(z)
.
@param x The BigInteger representing the value of the field element.
Checks, if the ECFieldElements a
and b
are elements of the same field F2m
(having the same representation).
@param a field element.
@param b field element to be compared.
@throws ArgumentException if a
and b
are not elements of the same field
F2m
(having the same
representation).
@return the representation of the field
F2m
, either of
{@link F2mFieldElement.Tpb} (trinomial
basis representation) or
{@link F2mFieldElement.Ppb} (pentanomial
basis representation).
@return the degree m
of the reduction polynomial
f(z)
.
@return Tpb: The integer k
where xm +
xk + 1
represents the reduction polynomial
f(z)
.
Ppb: The integer k1
where xm +
xk3 + xk2 + xk1 + 1
represents the reduction polynomial f(z)
.
@return Tpb: Always returns 0
Ppb: The integer k2
where xm +
xk3 + xk2 + xk1 + 1
represents the reduction polynomial f(z)
.
@return Tpb: Always set to 0
Ppb: The integer k3
where xm +
xk3 + xk2 + xk1 + 1
represents the reduction polynomial f(z)
.
base class for points on elliptic curves.
Sets the PreCompInfo
. Used by ECMultiplier
s
to save the precomputation for this ECPoint
to store the
precomputation result for use by subsequent multiplication.
@param preCompInfo The values precomputed by the
ECMultiplier
.
Sets the appropriate ECMultiplier
, unless already set.
return the field element encoded with point compression. (S 4.3.6)
Multiplies this ECPoint
by the given number.
@param k The multiplicator.
@return k * this
.
Elliptic curve points over Fp
Create a point which encodes with point compression.
@param curve the curve to use
@param x affine x co-ordinate
@param y affine y co-ordinate
Create a point that encodes with or without point compresion.
@param curve the curve to use
@param x affine x co-ordinate
@param y affine y co-ordinate
@param withCompression if true encode with point compression
Sets the default ECMultiplier
, unless already set.
Elliptic curve points over F2m
@param curve base curve
@param x x point
@param y y point
@param curve base curve
@param x x point
@param y y point
@param withCompression true if encode with point compression.
Constructor for point at infinity
Check, if two ECPoint
s can be added or subtracted.
@param a The first ECPoint
to check.
@param b The second ECPoint
to check.
@throws IllegalArgumentException if a
and b
cannot be added.
Adds another ECPoints.F2m
to this
without
checking if both points are on the same curve. Used by multiplication
algorithms, because there all points are a multiple of the same point
and hence the checks can be omitted.
@param b The other ECPoints.F2m
to add to
this
.
@return this + b
Subtracts another ECPoints.F2m
from this
without checking if both points are on the same curve. Used by
multiplication algorithms, because there all points are a multiple
of the same point and hence the checks can be omitted.
@param b The other ECPoints.F2m
to subtract from
this
.
@return this - b
Sets the appropriate ECMultiplier
, unless already set.
Interface for classes encapsulating a point multiplication algorithm
for ECPoint
s.
Multiplies the ECPoint p
by k
, i.e.
p
is added k
times to itself.
@param p The ECPoint
to be multiplied.
@param k The factor by which p
i multiplied.
@return p
multiplied by k
.
Class implementing the NAF (Non-Adjacent Form) multiplication algorithm.
D.3.2 pg 101
@see org.bouncycastle.math.ec.multiplier.ECMultiplier#multiply(org.bouncycastle.math.ec.ECPoint, java.math.BigInteger)
Interface for classes storing precomputation data for multiplication
algorithms. Used as a Memento (see GOF patterns) for
WNafMultiplier
.
Simple shift-and-add multiplication. Serves as reference implementation
to verify (possibly faster) implementations in
{@link org.bouncycastle.math.ec.ECPoint ECPoint}.
@param p The point to multiply.
@param k The factor by which to multiply.
@return The result of the point multiplication k * p
.
Class implementing the WNAF (Window Non-Adjacent Form) multiplication
algorithm.
Computes the Window NAF (non-adjacent Form) of an integer.
@param width The width w
of the Window NAF. The width is
defined as the minimal number w
, such that for any
w
consecutive digits in the resulting representation, at
most one is non-zero.
@param k The integer of which the Window NAF is computed.
@return The Window NAF of the given width, such that the following holds:
k = −i=0l-1 ki2i
, where the ki
denote the elements of the
returned sbyte[]
.
Multiplies this
by an integer k
using the
Window NAF method.
@param k The integer by which this
is multiplied.
@return A new ECPoint
which equals this
multiplied by k
.
Class holding precomputation data for the WNAF (Window Non-Adjacent Form)
algorithm.
Array holding the precomputed ECPoint
s used for the Window
NAF multiplication in
{@link org.bouncycastle.math.ec.multiplier.WNafMultiplier.multiply()
WNafMultiplier.multiply()}
.
Holds an ECPoint
representing twice(this). Used for the
Window NAF multiplication in
{@link org.bouncycastle.math.ec.multiplier.WNafMultiplier.multiply()
WNafMultiplier.multiply()}
.
Class implementing the WTNAF (Window
τ
-adic Non-Adjacent Form) algorithm.
Multiplies a {@link org.bouncycastle.math.ec.F2mPoint F2mPoint}
by k
using the reduced τ
-adic NAF (RTNAF)
method.
@param p The F2mPoint to multiply.
@param k The integer by which to multiply k
.
@return p
multiplied by k
.
Multiplies a {@link org.bouncycastle.math.ec.F2mPoint F2mPoint}
by an element λ
of Z[τ]
using
the τ
-adic NAF (TNAF) method.
@param p The F2mPoint to multiply.
@param lambda The element λ
of
Z[τ]
of which to compute the
[τ]
-adic NAF.
@return p
multiplied by λ
.
Multiplies a {@link org.bouncycastle.math.ec.F2mPoint F2mPoint}
by an element λ
of Z[τ]
using the window τ
-adic NAF (TNAF) method, given the
WTNAF of λ
.
@param p The F2mPoint to multiply.
@param u The the WTNAF of λ
..
@return λ * p
Class holding precomputation data for the WTNAF (Window
τ
-adic Non-Adjacent Form) algorithm.
Array holding the precomputed F2mPoint
s used for the
WTNAF multiplication in
{@link org.bouncycastle.math.ec.multiplier.WTauNafMultiplier.multiply()
WTauNafMultiplier.multiply()}
.
Constructor for WTauNafPreCompInfo
@param preComp Array holding the precomputed F2mPoint
s
used for the WTNAF multiplication in
{@link org.bouncycastle.math.ec.multiplier.WTauNafMultiplier.multiply()
WTauNafMultiplier.multiply()}
.
@return the array holding the precomputed F2mPoint
s
used for the WTNAF multiplication in
{@link org.bouncycastle.math.ec.multiplier.WTauNafMultiplier.multiply()
WTauNafMultiplier.multiply()}
.
BasicOcspResponse ::= SEQUENCE {
tbsResponseData ResponseData,
signatureAlgorithm AlgorithmIdentifier,
signature BIT STRING,
certs [0] EXPLICIT SEQUENCE OF Certificate OPTIONAL
}
Get all critical extension values, by oid
IDictionary with string (OID) keys and Asn1OctetString values
Get all non-critical extension values, by oid
IDictionary with string (OID) keys and Asn1OctetString values
Get non critical extensions.
A set of non critical extension oids.
Get any critical extensions.
A sorted list of critical entension.
Get the value of a given extension.
The object ID of the extension.
An Asn1OctetString object if that extension is found or null if not.
The DER encoding of the tbsResponseData field.
In the event of an encoding error.
The certificates, if any, associated with the response.
In the event of an encoding error.
Verify the signature against the tbsResponseData object we contain.
The ASN.1 encoded representation of this object.
Generator for basic OCSP response objects.
basic constructor
construct with the responderID to be the SHA-1 keyHash of the passed in public key.
Add a response for a particular Certificate ID.
@param certID certificate ID details
@param certStatus status of the certificate - null if okay
Add a response for a particular Certificate ID.
@param certID certificate ID details
@param certStatus status of the certificate - null if okay
@param singleExtensions optional extensions
Add a response for a particular Certificate ID.
@param certID certificate ID details
@param nextUpdate date when next update should be requested
@param certStatus status of the certificate - null if okay
@param singleExtensions optional extensions
Add a response for a particular Certificate ID.
@param certID certificate ID details
@param thisUpdate date this response was valid on
@param nextUpdate date when next update should be requested
@param certStatus status of the certificate - null if okay
@param singleExtensions optional extensions
Set the extensions for the response.
@param responseExtensions the extension object to carry.
Return an IEnumerable of the signature names supported by the generator.
@return an IEnumerable containing recognised names.
create from an issuer certificate and the serial number of the
certificate it signed.
@exception OcspException if any problems occur creating the id fields.
Create a new CertificateID for a new serial number derived from a previous one
calculated for the same CA certificate.
@param original the previously calculated CertificateID for the CA.
@param newSerialNumber the serial number for the new certificate of interest.
@return a new CertificateID for newSerialNumber
return the serial number for the certificate associated
with this request.
OcspRequest ::= SEQUENCE {
tbsRequest TBSRequest,
optionalSignature [0] EXPLICIT Signature OPTIONAL }
TBSRequest ::= SEQUENCE {
version [0] EXPLICIT Version DEFAULT v1,
requestorName [1] EXPLICIT GeneralName OPTIONAL,
requestList SEQUENCE OF Request,
requestExtensions [2] EXPLICIT Extensions OPTIONAL }
Signature ::= SEQUENCE {
signatureAlgorithm AlgorithmIdentifier,
signature BIT STRING,
certs [0] EXPLICIT SEQUENCE OF Certificate OPTIONAL}
Version ::= INTEGER { v1(0) }
Request ::= SEQUENCE {
reqCert CertID,
singleRequestExtensions [0] EXPLICIT Extensions OPTIONAL }
CertID ::= SEQUENCE {
hashAlgorithm AlgorithmIdentifier,
issuerNameHash OCTET STRING, -- Hash of Issuer's DN
issuerKeyHash OCTET STRING, -- Hash of Issuers public key
serialNumber CertificateSerialNumber }
Return the DER encoding of the tbsRequest field.
@return DER encoding of tbsRequest
@throws OcspException in the event of an encoding error.
If the request is signed return a possibly empty CertStore containing the certificates in the
request. If the request is not signed the method returns null.
@return null if not signed, a CertStore otherwise
@throws OcspException
Verify the signature against the TBSRequest object we contain.
return the ASN.1 encoded representation of this object.
return the object identifier representing the signature algorithm
Return whether or not this request is signed.
@return true if signed false otherwise.
Add a request for the given CertificateID.
@param certId certificate ID of interest
Add a request with extensions
@param certId certificate ID of interest
@param singleRequestExtensions the extensions to attach to the request
Set the requestor name to the passed in X509Principal
@param requestorName a X509Principal representing the requestor name.
Generate an unsigned request
@return the OcspReq
@throws OcspException
Return an IEnumerable of the signature names supported by the generator.
@return an IEnumerable containing recognised names.
return the ASN.1 encoded representation of this object.
base generator for an OCSP response - at the moment this only supports the
generation of responses containing BasicOCSP responses.
note 4 is not used.
Carrier for a ResponderID.
wrapper for the RevokedInfo object
return the revocation reason. Note: this field is optional, test for it
with hasRevocationReason() first.
@exception InvalidOperationException if a reason is asked for and none is avaliable
Return the status object for the response - null indicates good.
@return the status object for the response, null if it is good.
return the NextUpdate value - note: this is an optional field so may
be returned as null.
@return nextUpdate, or null if not present.
wrapper for the UnknownInfo object
Compressed data objects
Get the raw input stream contained in the object.
Return an uncompressed input stream which allows reading of the compressed data.
The algorithm used for compression
Class for producing compressed data packets.
Return an output stream which will save the data being written to
the compressed object.
The stream created can be closed off by either calling Close()
on the stream or Close() on the generator. Closing the returned
stream does not close off the Stream parameter outStr.
Stream to be used for output.
A Stream for output of the compressed data.
Return an output stream which will compress the data as it is written to it.
The stream will be written out in chunks according to the size of the passed in buffer.
The stream created can be closed off by either calling Close()
on the stream or Close() on the generator. Closing the returned
stream does not close off the Stream parameter outStr.
Note: if the buffer is not a power of 2 in length only the largest power of 2
bytes worth of the buffer will be used.
Note: using this may break compatibility with RFC 1991 compliant tools.
Only recent OpenPGP implementations are capable of accepting these streams.
Stream to be used for output.
The buffer to use.
A Stream for output of the compressed data.
Close the compressed object.summary>
An output stream that compresses into the BZip2 format (with the file
header chars) into another stream.
@author Keiron Liddle
TODO: Update to BZip2 1.0.1
NB: note this class has been modified to add a leading BZ to the
start of the BZIP2 stream to make it compatible with other PGP programs.
modified by Oliver Merkel, 010128
Thrown if the IV at the start of a data stream indicates the wrong key is being used.
Generic exception class for PGP encoding/decoding problems.
Return the raw input stream for the data stream.
Return true if the message is integrity protected.
True, if there is a modification detection code namespace associated
with this stream.
Note: This can only be called after the message has been read.
True, if the message verifies, false otherwise
Generator for encrypted objects.
Existing SecureRandom constructor.
The symmetric algorithm to use.
Source of randomness.
Creates a cipher stream which will have an integrity packet associated with it.
Base constructor.
The symmetric algorithm to use.
Source of randomness.
PGP 2.6.x compatibility required.
Add a PBE encryption method to the encrypted object using the default algorithm (S2K_SHA1).
Add a PBE encryption method to the encrypted object.
Add a public key encrypted session key to the encrypted object.
If buffer is non null stream assumed to be partial, otherwise the length will be used
to output a fixed length packet.
The stream created can be closed off by either calling Close()
on the stream or Close() on the generator. Closing the returned
stream does not close off the Stream parameter outStr.
Return an output stream which will encrypt the data as it is written to it.
The stream created can be closed off by either calling Close()
on the stream or Close() on the generator. Closing the returned
stream does not close off the Stream parameter outStr.
Return an output stream which will encrypt the data as it is written to it.
The stream will be written out in chunks according to the size of the passed in buffer.
The stream created can be closed off by either calling Close()
on the stream or Close() on the generator. Closing the returned
stream does not close off the Stream parameter outStr.
Note: if the buffer is not a power of 2 in length only the largest power of 2
bytes worth of the buffer will be used.
Close off the encrypted object - this is equivalent to calling Close() on the stream
returned by the Open() method.
Note: This does not close the underlying output stream, only the stream on top of
it created by the Open() method.
A holder for a list of PGP encryption method packets.
Key flag values for the KeyFlags subpacket.
General class to handle JCA key pairs and convert them into OpenPGP ones.
A word for the unwary, the KeyId for an OpenPGP public key is calculated from
a hash that includes the time of creation, if you pass a different date to the
constructor below with the same public private key pair the KeyIs will not be the
same as for previous generations of the key, so ideally you only want to do
this once.
Create a key pair from a PgpPrivateKey and a PgpPublicKey.
The public key.
The private key.
The keyId associated with this key pair.
Generator for a PGP master and subkey ring.
This class will generate both the secret and public key rings
Create a new key ring generator using old style checksumming. It is recommended to use
SHA1 checksumming where possible.
The certification level for keys on this ring.
The master key pair.
The id to be associated with the ring.
The algorithm to be used to protect secret keys.
The passPhrase to be used to protect secret keys.
Packets to be included in the certification hash.
Packets to be attached unhashed to the certification.
input secured random.
Create a new key ring generator.
The certification level for keys on this ring.
The master key pair.
The id to be associated with the ring.
The algorithm to be used to protect secret keys.
The passPhrase to be used to protect secret keys.
Checksum the secret keys with SHA1 rather than the older 16 bit checksum.
Packets to be included in the certification hash.
Packets to be attached unhashed to the certification.
input secured random.
Add a subkey to the key ring to be generated with default certification.
Add a subkey with specific hashed and unhashed packets associated with it and
default certification.
Public/private key pair.
Hashed packet values to be included in certification.
Unhashed packets values to be included in certification.
Return the secret key ring.
Return the public key ring that corresponds to the secret key ring.
Thrown if the key checksum is invalid.
Class for processing literal data objects.
The special name indicating a "for your eyes only" packet.
Return the file name as an unintrepreted byte array.
The raw input stream for the data stream.
The input stream representing the data stream.
The format of the data stream - Binary or Text
The file name that's associated with the data stream.
The modification time for the file.
Class for producing literal data packets.
The special name indicating a "for your eyes only" packet.
Generates literal data objects in the old format.
This is important if you need compatibility with PGP 2.6.x.
If true, uses old format.
Open a literal data packet, returning a stream to store the data inside the packet.
The stream created can be closed off by either calling Close()
on the stream or Close() on the generator. Closing the returned
stream does not close off the Stream parameter outStr.
The stream we want the packet in.
The format we are using.
The name of the 'file'.
The length of the data we will write.
The time of last modification we want stored.
Open a literal data packet, returning a stream to store the data inside the packet,
as an indefinite length stream. The stream is written out as a series of partial
packets with a chunk size determined by the size of the passed in buffer.
The stream created can be closed off by either calling Close()
on the stream or Close() on the generator. Closing the returned
stream does not close off the Stream parameter outStr.
Note: if the buffer is not a power of 2 in length only the largest power of 2
bytes worth of the buffer will be used.
The stream we want the packet in.
The format we are using.
The name of the 'file'.
The time of last modification we want stored.
The buffer to use for collecting data to put into chunks.
Open a literal data packet for the passed in FileInfo object, returning
an output stream for saving the file contents.
The stream created can be closed off by either calling Close()
on the stream or Close() on the generator. Closing the returned
stream does not close off the Stream parameter outStr.
The stream we want the packet in.
The format we are using.
The FileInfo object containg the packet details.
Close the literal data packet - this is equivalent to calling Close()
on the stream returned by the Open() method.
A PGP marker packet - in general these should be ignored other than where
the idea is to preserve the original input stream.
General class for reading a PGP object stream.
Note: if this class finds a PgpPublicKey or a PgpSecretKey it
will create a PgpPublicKeyRing, or a PgpSecretKeyRing for each
key found. If all you are trying to do is read a key ring file use
either PgpPublicKeyRingBundle or PgpSecretKeyRingBundle.
Return the next object in the stream, or null if the end is reached.
On a parse error
Return all available objects in a list.
An IList containing all objects from this factory, in order.
A one pass signature object.
Initialise the signature object for verification.
Verify the calculated signature against the passed in PgpSignature.
Holder for a list of PgpOnePassSignature objects.
A password based encryption object.
Return the raw input stream for the data stream.
Return the decrypted input stream, using the passed in passphrase.
General class to contain a private key for use with other OpenPGP objects.
Create a PgpPrivateKey from a regular private key and the ID of its
associated public key.
Private key to use.
ID of the corresponding public key.
The keyId associated with the contained private key.
The contained private key.
General class to handle a PGP public key object.
Create a PgpPublicKey from the passed in lightweight one.
Note: the time passed in affects the value of the key's keyId, so you probably only want
to do this once for a lightweight key, or make sure you keep track of the time you used.
Asymmetric algorithm type representing the public key.
Actual public key to associate.
Date of creation.
If pubKey is not public.
On key creation problem.
Constructor for a sub-key.
Copy constructor.
The public key to copy.
Return the trust data associated with the public key, if present.
A byte array with trust data, null otherwise.
The number of valid seconds from creation time - zero means no expiry.
The fingerprint of the key
The public key contained in the object.
A lightweight public key.
If the key algorithm is not recognised.
Allows enumeration of any user IDs associated with the key.
An IEnumerable of string objects.
Allows enumeration of any user attribute vectors associated with the key.
An IEnumerable of PgpUserAttributeSubpacketVector objects.
Allows enumeration of any signatures associated with the passed in id.
The ID to be matched.
An IEnumerable of PgpSignature objects.
Allows enumeration of signatures associated with the passed in user attributes.
The vector of user attributes to be matched.
An IEnumerable of PgpSignature objects.
Allows enumeration of signatures of the passed in type that are on this key.
The type of the signature to be returned.
An IEnumerable of PgpSignature objects.
Allows enumeration of all signatures/certifications associated with this key.
An IEnumerable with all signatures/certifications.
Check whether this (sub)key has a revocation signature on it.
True, if this (sub)key has been revoked.
Add a certification for an id to the given public key.
The key the certification is to be added to.
The ID the certification is associated with.
The new certification.
The re-certified key.
Add a certification for the given UserAttributeSubpackets to the given public key.
The key the certification is to be added to.
The attributes the certification is associated with.
The new certification.
The re-certified key.
Remove any certifications associated with a user attribute subpacket on a key.
The key the certifications are to be removed from.
The attributes to be removed.
The re-certified key, or null if the user attribute subpacket was not found on the key.
Remove any certifications associated with a given ID on a key.
The key the certifications are to be removed from.
The ID that is to be removed.
The re-certified key, or null if the ID was not found on the key.
Remove a certification associated with a given ID on a key.
The key the certifications are to be removed from.
The ID that the certfication is to be removed from.
The certfication to be removed.
The re-certified key, or null if the certification was not found.
Remove a certification associated with a given user attributes on a key.
The key the certifications are to be removed from.
The user attributes that the certfication is to be removed from.
The certification to be removed.
The re-certified key, or null if the certification was not found.
Add a revocation or some other key certification to a key.
The key the revocation is to be added to.
The key signature to be added.
The new changed public key object.
Remove a certification from the key.
The key the certifications are to be removed from.
The certfication to be removed.
The modified key, null if the certification was not found.
The version of this key.
The creation time of this key.
The number of valid days from creation time - zero means no expiry.
The keyId associated with the public key.
Check if this key has an algorithm type that makes it suitable to use for encryption.
Note: with version 4 keys KeyFlags subpackets should also be considered when present for
determining the preferred use of the key.
true if this key algorithm is suitable for encryption.
True, if this is a master key.
The algorithm code associated with the public key.
The strength of the key in bits.
A public key encrypted data object.
Return the algorithm code for the symmetric algorithm used to encrypt the data.
Return the decrypted data stream for the packet.
The key ID for the key used to encrypt the data.
Class to hold a single master public key and its subkeys.
Often PGP keyring files consist of multiple master keys, if you are trying to process
or construct one of these you should use the PgpPublicKeyRingBundle class.
Return the first public key in the ring.
Return the public key referred to by the passed in key ID if it is present.
Allows enumeration of all the public keys.
An IEnumerable of PgpPublicKey objects.
Returns a new key ring with the public key passed in either added or
replacing an existing one.
The public key ring to be modified.
The public key to be inserted.
A new PgpPublicKeyRing
Returns a new key ring with the public key passed in removed from the key ring.
The public key ring to be modified.
The public key to be removed.
A new PgpPublicKeyRing, or null if pubKey is not found.
Often a PGP key ring file is made up of a succession of master/sub-key key rings.
If you want to read an entire public key file in one hit this is the class for you.
Build a PgpPublicKeyRingBundle from the passed in input stream.
Input stream containing data.
If a problem parsing the stream occurs.
If an object is encountered which isn't a PgpPublicKeyRing.
Allow enumeration of the public key rings making up this collection.
Allow enumeration of the key rings associated with the passed in userId.
The user ID to be matched.
An IEnumerable of key rings which matched (possibly none).
Allow enumeration of the key rings associated with the passed in userId.
The user ID to be matched.
If true, userId need only be a substring of an actual ID string to match.
An IEnumerable of key rings which matched (possibly none).
Allow enumeration of the key rings associated with the passed in userId.
The user ID to be matched.
If true, userId need only be a substring of an actual ID string to match.
If true, case is ignored in user ID comparisons.
An IEnumerable of key rings which matched (possibly none).
Return the PGP public key associated with the given key id.
The ID of the public key to return.
Return the public key ring which contains the key referred to by keyId
key ID to match against
Return true if a key matching the passed in key ID is present, false otherwise.
key ID to look for.
Return a new bundle containing the contents of the passed in bundle and
the passed in public key ring.
The PgpPublicKeyRingBundle the key ring is to be added to.
The key ring to be added.
A new PgpPublicKeyRingBundle merging the current one with the passed in key ring.
If the keyId for the passed in key ring is already present.
Return a new bundle containing the contents of the passed in bundle with
the passed in public key ring removed.
The PgpPublicKeyRingBundle the key ring is to be removed from.
The key ring to be removed.
A new PgpPublicKeyRingBundle not containing the passed in key ring.
If the keyId for the passed in key ring is not present.
Return the number of key rings in this collection.
General class to handle a PGP secret key object.
Extract a PgpPrivateKey from this secret key's encrypted contents.
Return a copy of the passed in secret key, encrypted using a new password
and the passed in algorithm.
The PgpSecretKey to be copied.
The current password for the key.
The new password for the key.
The algorithm to be used for the encryption.
Source of randomness.
Replace the passed the public key on the passed in secret key.
Secret key to change.
New public key.
A new secret key.
If KeyId's do not match.
Check if this key has an algorithm type that makes it suitable to use for signing.
Note: with version 4 keys KeyFlags subpackets should also be considered when present for
determining the preferred use of the key.
true if this key algorithm is suitable for use with signing.
True, if this is a master key.
The algorithm the key is encrypted with.
The key ID of the public key associated with this key.
The public key associated with this key.
Allows enumeration of any user IDs associated with the key.
An IEnumerable of string objects.
Allows enumeration of any user attribute vectors associated with the key.
An IEnumerable of string objects.
Class to hold a single master secret key and its subkeys.
Often PGP keyring files consist of multiple master keys, if you are trying to process
or construct one of these you should use the PgpSecretKeyRingBundle class.
Return the public key for the master key.
Return the master private key.
Allows enumeration of the secret keys.
An IEnumerable of PgpSecretKey objects.
Return an iterator of the public keys in the secret key ring that
have no matching private key. At the moment only personal certificate data
appears in this fashion.
An IEnumerable of unattached, or extra, public keys.
Replace the public key set on the secret ring with the corresponding key off the public ring.
Secret ring to be changed.
Public ring containing the new public key set.
Return a copy of the passed in secret key ring, with the master key and sub keys encrypted
using a new password and the passed in algorithm.
The PgpSecretKeyRing to be copied.
The current password for key.
The new password for the key.
The algorithm to be used for the encryption.
Source of randomness.
Returns a new key ring with the secret key passed in either added or
replacing an existing one with the same key ID.
The secret key ring to be modified.
The secret key to be inserted.
A new PgpSecretKeyRing
Returns a new key ring with the secret key passed in removed from the key ring.
The secret key ring to be modified.
The secret key to be removed.
A new PgpSecretKeyRing, or null if secKey is not found.
Often a PGP key ring file is made up of a succession of master/sub-key key rings.
If you want to read an entire secret key file in one hit this is the class for you.
Build a PgpSecretKeyRingBundle from the passed in input stream.
Input stream containing data.
If a problem parsing the stream occurs.
If an object is encountered which isn't a PgpSecretKeyRing.
Allow enumeration of the secret key rings making up this collection.
Allow enumeration of the key rings associated with the passed in userId.
The user ID to be matched.
An IEnumerable of key rings which matched (possibly none).
Allow enumeration of the key rings associated with the passed in userId.
The user ID to be matched.
If true, userId need only be a substring of an actual ID string to match.
An IEnumerable of key rings which matched (possibly none).
Allow enumeration of the key rings associated with the passed in userId.
The user ID to be matched.
If true, userId need only be a substring of an actual ID string to match.
If true, case is ignored in user ID comparisons.
An IEnumerable of key rings which matched (possibly none).
Return the PGP secret key associated with the given key id.
The ID of the secret key to return.
Return the secret key ring which contains the key referred to by keyId
The ID of the secret key
Return true if a key matching the passed in key ID is present, false otherwise.
key ID to look for.
Return a new bundle containing the contents of the passed in bundle and
the passed in secret key ring.
The PgpSecretKeyRingBundle the key ring is to be added to.
The key ring to be added.
A new PgpSecretKeyRingBundle merging the current one with the passed in key ring.
If the keyId for the passed in key ring is already present.
Return a new bundle containing the contents of the passed in bundle with
the passed in secret key ring removed.
The PgpSecretKeyRingBundle the key ring is to be removed from.
The key ring to be removed.
A new PgpSecretKeyRingBundle not containing the passed in key ring.
If the keyId for the passed in key ring is not present.
Return the number of rings in this collection.
A PGP signature object.
Verify the signature as certifying the passed in public key as associated
with the passed in user attributes.
User attributes the key was stored under.
The key to be verified.
True, if the signature matches, false otherwise.
Verify the signature as certifying the passed in public key as associated
with the passed in ID.
ID the key was stored under.
The key to be verified.
True, if the signature matches, false otherwise.
Verify a certification for the passed in key against the passed in master key.
The key we are verifying against.
The key we are verifying.
True, if the certification is valid, false otherwise.
Verify a key certification, such as revocation, for the passed in key.
The key we are checking.
True, if the certification is valid, false otherwise.
The OpenPGP version number for this signature.
The key algorithm associated with this signature.
The hash algorithm associated with this signature.
The ID of the key that created the signature.
The creation time of this signature.
Return true if the signature has either hashed or unhashed subpackets.
Generator for PGP signatures.
Create a generator for the passed in keyAlgorithm and hashAlgorithm codes.
Initialise the generator for signing.
Initialise the generator for signing.
Return the one pass header associated with the current signature.
Return a signature object containing the current signature state.
Generate a certification for the passed in ID and key.
The ID we are certifying against the public key.
The key we are certifying against the ID.
The certification.
Generate a certification for the passed in userAttributes.
The ID we are certifying against the public key.
The key we are certifying against the ID.
The certification.
Generate a certification for the passed in key against the passed in master key.
The key we are certifying against.
The key we are certifying.
The certification.
Generate a certification, such as a revocation, for the passed in key.
The key we are certifying.
The certification.
A list of PGP signatures - normally in the signature block after literal data.
Generator for signature subpackets.
Add a TrustSignature packet to the signature. The values for depth and trust are largely
installation dependent but there are some guidelines in RFC 4880 - 5.2.3.13.
true if the packet is critical.
depth level.
trust amount.
Set the number of seconds a key is valid for after the time of its creation.
A value of zero means the key never expires.
True, if should be treated as critical, false otherwise.
The number of seconds the key is valid, or zero if no expiry.
Set the number of seconds a signature is valid for after the time of its creation.
A value of zero means the signature never expires.
True, if should be treated as critical, false otherwise.
The number of seconds the signature is valid, or zero if no expiry.
Set the creation time for the signature.
Note: this overrides the generation of a creation time when the signature
is generated.
Sets revocation reason sub packet
Sets revocation key sub packet
Sets issuer key sub packet
Container for a list of signature subpackets.
Return true if a particular subpacket type exists.
@param type type to look for.
@return true if present, false otherwise.
Return all signature subpackets of the passed in type.
@param type subpacket type code
@return an array of zero or more matching subpackets.
Return the number of seconds a signature is valid for after its creation date.
A value of zero means the signature never expires.
Seconds a signature is valid for.
Return the number of seconds a key is valid for after its creation date.
A value of zero means the key never expires.
Seconds a signature is valid for.
Return the number of packets this vector contains.
Container for a list of user attribute subpackets.
Basic utility class.
Write out the passed in file as a literal data packet.
Write out the passed in file as a literal data packet in partial packet format.
Return either an ArmoredInputStream or a BcpgInputStream based on whether
the initial characters of the stream are binary PGP encodings or not.
Generator for old style PGP V3 Signatures.
Create a generator for the passed in keyAlgorithm and hashAlgorithm codes.
Initialise the generator for signing.
Initialise the generator for signing.
Return the one pass header associated with the current signature.
Return a V3 signature object containing the current signature state.
Class for reading OpenSSL PEM encoded streams containing
X509 certificates, PKCS8 encoded keys and PKCS7 objects.
In the case of PKCS7 objects the reader will return a CMS ContentInfo object. Keys and
Certificates will be returned using the appropriate java.security type.
A
Create a new PemReader
@param reader the Reader
Create a new PemReader with a password finder
@param reader the Reader
@param pFinder the password finder
Reads in a X509Certificate.
@return the X509Certificate
@throws IOException if an I/O error occured
Reads in a X509CRL.
@return the X509Certificate
@throws IOException if an I/O error occured
Reads in a PKCS10 certification request.
@return the certificate request.
@throws IOException if an I/O error occured
Reads in a X509 Attribute Certificate.
@return the X509 Attribute Certificate
@throws IOException if an I/O error occured
Reads in a PKCS7 object. This returns a ContentInfo object suitable for use with the CMS
API.
@return the X509Certificate
@throws IOException if an I/O error occured
Read a Key Pair
General purpose writer for OpenSSL PEM objects.
A generic PEM writer, based on RFC 1421
Base constructor.
@param out output stream to use.
Return the number of bytes or characters required to contain the
passed in object if it is PEM encoded.
@param obj pem object to be output
@return an estimate of the number of bytes
The TextWriter object to write the output to.
A class for verifying and creating Pkcs10 Certification requests.
CertificationRequest ::= Sequence {
certificationRequestInfo CertificationRequestInfo,
signatureAlgorithm AlgorithmIdentifier{{ SignatureAlgorithms }},
signature BIT STRING
}
CertificationRequestInfo ::= Sequence {
version Integer { v1(0) } (v1,...),
subject Name,
subjectPKInfo SubjectPublicKeyInfo{{ PKInfoAlgorithms }},
attributes [0] Attributes{{ CRIAttributes }}
}
Attributes { ATTRIBUTE:IOSet } ::= Set OF Attr{{ IOSet }}
Attr { ATTRIBUTE:IOSet } ::= Sequence {
type ATTRIBUTE.&id({IOSet}),
values Set SIZE(1..MAX) OF ATTRIBUTE.&Type({IOSet}{\@type})
}
see
Instantiate a Pkcs10CertificationRequest object with the necessary credentials.
Name of Sig Alg.
X509Name of subject eg OU="My unit." O="My Organisatioin" C="au"
Public Key to be included in cert reqest.
ASN1Set of Attributes.
Matching Private key for nominated (above) public key to be used to sign the request.
Get the public key.
The public key.
Verify Pkcs10 Cert Request is valid.
true = valid.
A class for creating and verifying Pkcs10 Certification requests (this is an extension on ).
The requests are made using delay signing. This is useful for situations where
the private key is in another environment and not directly accessible (e.g. HSM)
So the first step creates the request, then the signing is done outside this
object and the signature is then used to complete the request.
CertificationRequest ::= Sequence {
certificationRequestInfo CertificationRequestInfo,
signatureAlgorithm AlgorithmIdentifier{{ SignatureAlgorithms }},
signature BIT STRING
}
CertificationRequestInfo ::= Sequence {
version Integer { v1(0) } (v1,...),
subject Name,
subjectPKInfo SubjectPublicKeyInfo{{ PKInfoAlgorithms }},
attributes [0] Attributes{{ CRIAttributes }}
}
Attributes { ATTRIBUTE:IOSet } ::= Set OF Attr{{ IOSet }}
Attr { ATTRIBUTE:IOSet } ::= Sequence {
type ATTRIBUTE.&id({IOSet}),
values Set SIZE(1..MAX) OF ATTRIBUTE.&Type({IOSet}{\@type})
}
see
Instantiate a Pkcs10CertificationRequest object with the necessary credentials.
Name of Sig Alg.
X509Name of subject eg OU="My unit." O="My Organisatioin" C="au"
Public Key to be included in cert reqest.
ASN1Set of Attributes.
After the object is constructed use the and finally the
SignRequest methods to finalize the request.
simply return the cert entry for the private key
Utility class for reencoding PKCS#12 files to definite length.
Just re-encode the outer layer of the PKCS#12 file to definite length encoding.
@param berPKCS12File - original PKCS#12 file
@return a byte array representing the DER encoding of the PFX structure
@throws IOException
Re-encode the PKCS#12 structure to definite length encoding at the inner layer
as well, recomputing the MAC accordingly.
@param berPKCS12File - original PKCS12 file.
@param provider - provider to use for MAC calculation.
@return a byte array representing the DER encoding of the PFX structure.
@throws IOException on parsing, encoding errors.
Returns the revocationDate.
Returns the certStatus.
Returns an immutable Set
of X.509 attribute certificate
extensions that this PkixAttrCertChecker
supports or
null
if no extensions are supported.
Each element of the set is a String
representing the
Object Identifier (OID) of the X.509 extension that is supported.
All X.509 attribute certificate extensions that a
PkixAttrCertChecker
might possibly be able to process
should be included in the set.
@return an immutable Set
of X.509 extension OIDs (in
String
format) supported by this
PkixAttrCertChecker
, or null
if no
extensions are supported
Performs checks on the specified attribute certificate. Every handled
extension is rmeoved from the unresolvedCritExts
collection.
@param attrCert The attribute certificate to be checked.
@param certPath The certificate path which belongs to the attribute
certificate issuer public key certificate.
@param holderCertPath The certificate path which belongs to the holder
certificate.
@param unresolvedCritExts a Collection
of OID strings
representing the current set of unresolved critical extensions
@throws CertPathValidatorException if the specified attribute certificate
does not pass the check.
Returns a clone of this object.
@return a copy of this PkixAttrCertChecker
Build and validate a CertPath using the given parameter.
@param params PKIXBuilderParameters object containing all information to
build the CertPath
CertPathValidatorSpi implementation for X.509 Attribute Certificates la RFC 3281.
@see org.bouncycastle.x509.ExtendedPkixParameters
Validates an attribute certificate with the given certificate path.
params
must be an instance of
ExtendedPkixParameters
.
The target constraints in the params
must be an
X509AttrCertStoreSelector
with at least the attribute
certificate criterion set. Obey that also target informations may be
necessary to correctly validate this attribute certificate.
The attribute certificate issuer must be added to the trusted attribute
issuers with {@link ExtendedPkixParameters#setTrustedACIssuers(Set)}.
@param certPath The certificate path which belongs to the attribute
certificate issuer public key certificate.
@param params The PKIX parameters.
@return A PKIXCertPathValidatorResult
of the result of
validating the certPath
.
@throws InvalidAlgorithmParameterException if params
is
inappropriate for this validator.
@throws CertPathValidatorException if the verification fails.
Summary description for PkixBuilderParameters.
Summary description for PkixParameters.
This is the default PKIX validity model. Actually there are two variants
of this: The PKIX model and the modified PKIX model. The PKIX model
verifies that all involved certificates must have been valid at the
current time. The modified PKIX model verifies that all involved
certificates were valid at the signing time. Both are indirectly choosen
with the {@link PKIXParameters#setDate(java.util.Date)} method, so this
methods sets the Date when all certificates must have been
valid.
This model uses the following validity model. Each certificate must have
been valid at the moment where is was used. That means the end
certificate must have been valid at the time the signature was done. The
CA certificate which signed the end certificate must have been valid,
when the end certificate was signed. The CA (or Root CA) certificate must
have been valid, when the CA certificate was signed and so on. So the
{@link PKIXParameters#setDate(java.util.Date)} method sets the time, when
the end certificate must have been valid. It is used e.g.
in the German signature law.
Creates an instance of PKIXParameters with the specified Set of
most-trusted CAs. Each element of the set is a TrustAnchor.
Note that the Set is copied to protect against subsequent modifications.
@param trustAnchors
a Set of TrustAnchors
@exception InvalidAlgorithmParameterException
if the specified Set is empty
(trustAnchors.isEmpty() == true)
@exception NullPointerException
if the specified Set is null
@exception ClassCastException
if any of the elements in the Set are not of type
java.security.cert.TrustAnchor
Returns the required constraints on the target certificate. The
constraints are returned as an instance of CertSelector. If
null
, no constraints are defined.
Note that the CertSelector returned is cloned to protect against
subsequent modifications.
@return a CertSelector specifying the constraints on the target
certificate (or null
)
@see #setTargetCertConstraints(CertSelector)
Sets the required constraints on the target certificate. The constraints
are specified as an instance of CertSelector. If null, no constraints are
defined.
Note that the CertSelector specified is cloned to protect against
subsequent modifications.
@param selector
a CertSelector specifying the constraints on the target
certificate (or null
)
@see #getTargetCertConstraints()
Returns an immutable Set of initial policy identifiers (OID strings),
indicating that any one of these policies would be acceptable to the
certificate user for the purposes of certification path processing. The
default return value is an empty Set
, which is
interpreted as meaning that any policy would be acceptable.
@return an immutable Set
of initial policy OIDs in String
format, or an empty Set
(implying any policy is
acceptable). Never returns null
.
@see #setInitialPolicies(java.util.Set)
Sets the Set
of initial policy identifiers (OID strings),
indicating that any one of these policies would be acceptable to the
certificate user for the purposes of certification path processing. By
default, any policy is acceptable (i.e. all policies), so a user that
wants to allow any policy as acceptable does not need to call this
method, or can call it with an empty Set
(or
null
).
Note that the Set is copied to protect against subsequent modifications.
@param initialPolicies
a Set of initial policy OIDs in String format (or
null
)
@exception ClassCastException
if any of the elements in the set are not of type String
@see #getInitialPolicies()
Sets a List
of additional certification path checkers. If
the specified List contains an object that is not a PKIXCertPathChecker,
it is ignored.
Each PKIXCertPathChecker
specified implements additional
checks on a certificate. Typically, these are checks to process and
verify private extensions contained in certificates. Each
PKIXCertPathChecker
should be instantiated with any
initialization parameters needed to execute the check.
This method allows sophisticated applications to extend a PKIX
CertPathValidator
or CertPathBuilder
. Each
of the specified PKIXCertPathCheckers will be called, in turn, by a PKIX
CertPathValidator
or CertPathBuilder
for
each certificate processed or validated.
Regardless of whether these additional PKIXCertPathCheckers are set, a
PKIX CertPathValidator
or CertPathBuilder
must perform all of the required PKIX checks on each certificate. The one
exception to this rule is if the RevocationEnabled flag is set to false
(see the {@link #setRevocationEnabled(boolean) setRevocationEnabled}
method).
Note that the List supplied here is copied and each PKIXCertPathChecker
in the list is cloned to protect against subsequent modifications.
@param checkers
a List of PKIXCertPathCheckers. May be null, in which case no
additional checkers will be used.
@exception ClassCastException
if any of the elements in the list are not of type
java.security.cert.PKIXCertPathChecker
@see #getCertPathCheckers()
Returns the List of certification path checkers. Each PKIXCertPathChecker
in the returned IList is cloned to protect against subsequent modifications.
@return an immutable List of PKIXCertPathCheckers (may be empty, but not
null
)
@see #setCertPathCheckers(java.util.List)
Adds a PKIXCertPathChecker
to the list of certification
path checkers. See the {@link #setCertPathCheckers setCertPathCheckers}
method for more details.
Note that the PKIXCertPathChecker
is cloned to protect
against subsequent modifications.
@param checker a PKIXCertPathChecker
to add to the list of
checks. If null
, the checker is ignored (not added to list).
Method to support Clone()
under J2ME.
super.Clone()
does not exist and fields are not copied.
@param params Parameters to set. If this are
ExtendedPkixParameters
they are copied to.
Sets the Bouncy Castle Stores for finding CRLs, certificates, attribute
certificates or cross certificates.
The IList
is cloned.
@param stores A list of stores to use.
@see #getStores
@throws ClassCastException if an element of stores
is not
a {@link Store}.
Adds a Bouncy Castle {@link Store} to find CRLs, certificates, attribute
certificates or cross certificates.
This method should be used to add local stores, like collection based
X.509 stores, if available. Local stores should be considered first,
before trying to use additional (remote) locations, because they do not
need possible additional network traffic.
If store
is null
it is ignored.
@param store The store to add.
@see #getStores
Adds an additional Bouncy Castle {@link Store} to find CRLs, certificates,
attribute certificates or cross certificates.
You should not use this method. This method is used for adding additional
X.509 stores, which are used to add (remote) locations, e.g. LDAP, found
during X.509 object processing, e.g. in certificates or CRLs. This method
is used in PKIX certification path processing.
If store
is null
it is ignored.
@param store The store to add.
@see #getStores()
Returns an IList
of additional Bouncy Castle
Store
s used for finding CRLs, certificates, attribute
certificates or cross certificates.
@return an immutable IList
of additional Bouncy Castle
Store
s. Never null
.
@see #addAddionalStore(Store)
Returns an IList
of Bouncy Castle
Store
s used for finding CRLs, certificates, attribute
certificates or cross certificates.
@return an immutable IList
of Bouncy Castle
Store
s. Never null
.
@see #setStores(IList)
Sets if additional {@link X509Store}s for locations like LDAP found in
certificates or CRLs should be used.
@param enabled true
if additional stores are used.
Returns the required constraints on the target certificate or attribute
certificate. The constraints are returned as an instance of
IX509Selector
. If null
, no constraints are
defined.
The target certificate in a PKIX path may be a certificate or an
attribute certificate.
Note that the IX509Selector
returned is cloned to protect
against subsequent modifications.
@return a IX509Selector
specifying the constraints on the
target certificate or attribute certificate (or null
)
@see #setTargetConstraints
@see X509CertStoreSelector
@see X509AttributeCertStoreSelector
Sets the required constraints on the target certificate or attribute
certificate. The constraints are specified as an instance of
IX509Selector
. If null
, no constraints are
defined.
The target certificate in a PKIX path may be a certificate or an
attribute certificate.
Note that the IX509Selector
specified is cloned to protect
against subsequent modifications.
@param selector a IX509Selector
specifying the constraints on
the target certificate or attribute certificate (or
null
)
@see #getTargetConstraints
@see X509CertStoreSelector
@see X509AttributeCertStoreSelector
Returns the trusted attribute certificate issuers. If attribute
certificates is verified the trusted AC issuers must be set.
The returned ISet
consists of TrustAnchor
s.
The returned ISet
is immutable. Never null
@return Returns an immutable set of the trusted AC issuers.
Sets the trusted attribute certificate issuers. If attribute certificates
is verified the trusted AC issuers must be set.
The trustedACIssuers
must be a ISet
of
TrustAnchor
The given set is cloned.
@param trustedACIssuers The trusted AC issuers to set. Is never
null
.
@throws ClassCastException if an element of stores
is not
a TrustAnchor
.
Returns the neccessary attributes which must be contained in an attribute
certificate.
The returned ISet
is immutable and contains
String
s with the OIDs.
@return Returns the necessary AC attributes.
Sets the neccessary which must be contained in an attribute certificate.
The ISet
must contain String
s with the
OIDs.
The set is cloned.
@param necessaryACAttributes The necessary AC attributes to set.
@throws ClassCastException if an element of
necessaryACAttributes
is not a
String
.
Returns the attribute certificates which are not allowed.
The returned ISet
is immutable and contains
String
s with the OIDs.
@return Returns the prohibited AC attributes. Is never null
.
Sets the attribute certificates which are not allowed.
The ISet
must contain String
s with the
OIDs.
The set is cloned.
@param prohibitedACAttributes The prohibited AC attributes to set.
@throws ClassCastException if an element of
prohibitedACAttributes
is not a
String
.
Returns the attribute certificate checker. The returned set contains
{@link PKIXAttrCertChecker}s and is immutable.
@return Returns the attribute certificate checker. Is never
null
.
Sets the attribute certificate checkers.
All elements in the ISet
must a {@link PKIXAttrCertChecker}.
The given set is cloned.
@param attrCertCheckers The attribute certificate checkers to set. Is
never null
.
@throws ClassCastException if an element of attrCertCheckers
is not a PKIXAttrCertChecker
.
Whether delta CRLs should be used for checking the revocation status.
Defaults to false
.
The validity model.
@see #CHAIN_VALIDITY_MODEL
@see #PKIX_VALIDITY_MODEL
Returns if additional {@link X509Store}s for locations like LDAP found
in certificates or CRLs should be used.
@return Returns true
if additional stores are used.
Returns an instance of PkixBuilderParameters
.
This method can be used to get a copy from other
PKIXBuilderParameters
, PKIXParameters
,
and ExtendedPKIXParameters
instances.
@param pkixParams The PKIX parameters to create a copy of.
@return An PkixBuilderParameters
instance.
Excluded certificates are not used for building a certification path.
the excluded certificates.
Sets the excluded certificates which are not used for building a
certification path. If the ISet
is null
an
empty set is assumed.
The given set is cloned to protect it against subsequent modifications.
The excluded certificates to set.
Can alse handle ExtendedPKIXBuilderParameters
and
PKIXBuilderParameters
.
@param params Parameters to set.
@see org.bouncycastle.x509.ExtendedPKIXParameters#setParams(java.security.cert.PKIXParameters)
Makes a copy of this PKIXParameters
object. Changes to the
copy will not affect the original and vice versa.
@return a copy of this PKIXParameters
object
An immutable sequence of certificates (a certification path).
This is an abstract class that defines the methods common to all CertPaths.
Subclasses can handle different kinds of certificates (X.509, PGP, etc.).
All CertPath objects have a type, a list of Certificates, and one or more
supported encodings. Because the CertPath class is immutable, a CertPath
cannot change in any externally visible way after being constructed. This
stipulation applies to all public fields and methods of this class and any
added or overridden by subclasses.
The type is a string that identifies the type of Certificates in the
certification path. For each certificate cert in a certification path
certPath, cert.getType().equals(certPath.getType()) must be true.
The list of Certificates is an ordered List of zero or more Certificates.
This List and all of the Certificates contained in it must be immutable.
Each CertPath object must support one or more encodings so that the object
can be translated into a byte array for storage or transmission to other
parties. Preferably, these encodings should be well-documented standards
(such as PKCS#7). One of the encodings supported by a CertPath is considered
the default encoding. This encoding is used if no encoding is explicitly
requested (for the {@link #getEncoded()} method, for instance).
All CertPath objects are also Serializable. CertPath objects are resolved
into an alternate {@link CertPathRep} object during serialization. This
allows a CertPath object to be serialized into an equivalent representation
regardless of its underlying implementation.
CertPath objects can be created with a CertificateFactory or they can be
returned by other classes, such as a CertPathBuilder.
By convention, X.509 CertPaths (consisting of X509Certificates), are ordered
starting with the target certificate and ending with a certificate issued by
the trust anchor. That is, the issuer of one certificate is the subject of
the following one. The certificate representing the
{@link TrustAnchor TrustAnchor} should not be included in the certification
path. Unvalidated X.509 CertPaths may not follow these conventions. PKIX
CertPathValidators will detect any departure from these conventions that
cause the certification path to be invalid and throw a
CertPathValidatorException.
Concurrent Access
All CertPath objects must be thread-safe. That is, multiple threads may
concurrently invoke the methods defined in this class on a single CertPath
object (or more than one) with no ill effects. This is also true for the List
returned by CertPath.getCertificates.
Requiring CertPath objects to be immutable and thread-safe allows them to be
passed around to various pieces of code without worrying about coordinating
access. Providing this thread-safety is generally not difficult, since the
CertPath and List objects in question are immutable.
@see CertificateFactory
@see CertPathBuilder
CertPath implementation for X.509 certificates.
@param certs
Creates a CertPath of the specified type.
This constructor is protected because most users should use
a CertificateFactory to create CertPaths.
@param type the standard name of the type of Certificatesin this path
Creates a CertPath of the specified type.
This constructor is protected because most users should use
a CertificateFactory to create CertPaths.
@param type the standard name of the type of Certificatesin this path
Compares this certification path for equality with the specified object.
Two CertPaths are equal if and only if their types are equal and their
certificate Lists (and by implication the Certificates in those Lists)
are equal. A CertPath is never equal to an object that is not a CertPath.
This algorithm is implemented by this method. If it is overridden, the
behavior specified here must be maintained.
@param other
the object to test for equality with this certification path
@return true if the specified object is equal to this certification path,
false otherwise
@see Object#hashCode() Object.hashCode()
Returns the encoded form of this certification path, using
the default encoding.
@return the encoded bytes
@exception CertificateEncodingException if an encoding error occurs
Returns the encoded form of this certification path, using
the specified encoding.
@param encoding the name of the encoding to use
@return the encoded bytes
@exception CertificateEncodingException if an encoding error
occurs or the encoding requested is not supported
Return a DERObject containing the encoded certificate.
@param cert the X509Certificate object to be encoded
@return the DERObject
Returns an iteration of the encodings supported by this
certification path, with the default encoding
first. Attempts to modify the returned Iterator via its
remove method result in an UnsupportedOperationException.
@return an Iterator over the names of the supported encodings (as Strings)
Returns the list of certificates in this certification
path.
Implements the PKIX CertPathBuilding algorithm for BouncyCastle.
@see CertPathBuilderSpi
Build and validate a CertPath using the given parameter.
@param params PKIXBuilderParameters object containing all information to
build the CertPath
Summary description for PkixCertPathBuilderException.
Summary description for PkixCertPathBuilderResult.
Summary description for PkixCertPathValidatorResult.
* Initializes the internal state of this PKIXCertPathChecker
.
*
* The forward
flag specifies the order that certificates
* will be passed to the {@link #check check} method (forward or reverse). A
* PKIXCertPathChecker
must support reverse checking
* and may support forward checking.
*
*
* @param forward
* the order that certificates are presented to the
* check
method. If true
,
* certificates are presented from target to most-trusted CA
* (forward); if false
, from most-trusted CA to
* target (reverse).
* @exception CertPathValidatorException
* if this PKIXCertPathChecker
is unable to
* check certificates in the specified order; it should never
* be thrown if the forward flag is false since reverse
* checking must be supported
Indicates if forward checking is supported. Forward checking refers to
the ability of the PKIXCertPathChecker
to perform its
checks when certificates are presented to the check
method
in the forward direction (from target to most-trusted CA).
@return true
if forward checking is supported,
false
otherwise
* Returns an immutable Set
of X.509 certificate extensions
* that this PKIXCertPathChecker
supports (i.e. recognizes,
* is able to process), or null
if no extensions are
* supported.
*
* Each element of the set is a String
representing the
* Object Identifier (OID) of the X.509 extension that is supported. The OID
* is represented by a set of nonnegative integers separated by periods.
*
* All X.509 certificate extensions that a PKIXCertPathChecker
* might possibly be able to process should be included in the set.
*
*
* @return an immutable Set
of X.509 extension OIDs (in
* String
format) supported by this
* PKIXCertPathChecker
, or null
if no
* extensions are supported
Performs the check(s) on the specified certificate using its internal
state and removes any critical extensions that it processes from the
specified collection of OID strings that represent the unresolved
critical extensions. The certificates are presented in the order
specified by the init
method.
@param cert
the Certificate
to be checked
@param unresolvedCritExts
a Collection
of OID strings representing the
current set of unresolved critical extensions
@exception CertPathValidatorException
if the specified certificate does not pass the check
Returns a clone of this object. Calls the Object.clone()
method. All subclasses which maintain state must support and override
this method, if necessary.
@return a copy of this PKIXCertPathChecker
The Service Provider Interface (SPI)
for the {@link CertPathValidator CertPathValidator} class. All
CertPathValidator
implementations must include a class (the
SPI class) that extends this class (CertPathValidatorSpi
)
and implements all of its methods. In general, instances of this class
should only be accessed through the CertPathValidator
class.
For details, see the Java Cryptography Architecture.
Concurrent Access
Instances of this class need not be protected against concurrent
access from multiple threads. Threads that need to access a single
CertPathValidatorSpi
instance concurrently should synchronize
amongst themselves and provide the necessary locking before calling the
wrapping CertPathValidator
object.
However, implementations of CertPathValidatorSpi
may still
encounter concurrency issues, since multiple threads each
manipulating a different CertPathValidatorSpi
instance need not
synchronize.
CertPathValidatorSpi implementation for X.509 Certificate validation a la RFC
3280.
An exception indicating one of a variety of problems encountered when
validating a certification path.
A CertPathValidatorException
provides support for wrapping
exceptions. The {@link #getCause getCause} method returns the throwable,
if any, that caused this exception to be thrown.
A CertPathValidatorException
may also include the
certification path that was being validated when the exception was thrown
and the index of the certificate in the certification path that caused the
exception to be thrown. Use the {@link #getCertPath getCertPath} and
{@link #getIndex getIndex} methods to retrieve this information.
Concurrent Access
Unless otherwise specified, the methods defined in this class are not
thread-safe. Multiple threads that need to access a single
object concurrently should synchronize amongst themselves and
provide the necessary locking. Multiple threads each manipulating
separate objects need not synchronize.
@see CertPathValidator
Creates a PkixCertPathValidatorException
with the given detail
message. A detail message is a String
that describes this
particular exception.
the detail message
Creates a PkixCertPathValidatorException
with the specified
detail message and cause.
the detail message
the cause (which is saved for later retrieval by the
{@link #getCause getCause()} method). (A null
value is permitted, and indicates that the cause is
nonexistent or unknown.)
Creates a PkixCertPathValidatorException
with the specified
detail message, cause, certification path, and index.
the detail message (or null
if none)
the cause (or null
if none)
the certification path that was in the process of being
validated when the error was encountered
the index of the certificate in the certification path that *
Returns the detail message for this CertPathValidatorException
.
the detail message, or null
if neither the message nor cause were specified
Returns the certification path that was being validated when the
exception was thrown.
@return the CertPath
that was being validated when the
exception was thrown (or null
if not specified)
Returns the index of the certificate in the certification path that
caused the exception to be thrown. Note that the list of certificates in
a CertPath
is zero based. If no index has been set, -1 is
returned.
@return the index that has been set, or -1 if none has been set
Summary description for PkixCertPathValidatorUtilities.
key usage bits
Search the given Set of TrustAnchor's for one that is the
issuer of the given X509 certificate.
the X509 certificate
a Set of TrustAnchor's
the TrustAnchor
object if found or
null
if not.
@exception
Returns the issuer of an attribute certificate or certificate.
The attribute certificate or certificate.
The issuer as X500Principal
.
Return the next working key inheriting DSA parameters if necessary.
This methods inherits DSA parameters from the indexed certificate or
previous certificates in the certificate chain to the returned
PublicKey
. The list is searched upwards, meaning the end
certificate is at position 0 and previous certificates are following.
If the indexed certificate does not contain a DSA key this method simply
returns the public key. If the DSA key already contains DSA parameters
the key is also only returned.
@param certs The certification path.
@param index The index of the certificate which contains the public key
which should be extended with DSA parameters.
@return The public key of the certificate in list position
index
extended with DSA parameters if applicable.
@throws Exception if DSA parameters cannot be inherited.
Return a Collection of all certificates or attribute certificates found
in the X509Store's that are matching the certSelect criteriums.
a {@link Selector} object that will be used to select
the certificates
a List containing only X509Store objects. These
are used to search for certificates.
a Collection of all found or
org.bouncycastle.x509.X509AttributeCertificate objects.
May be empty but never null
.
Add the CRL issuers from the cRLIssuer field of the distribution point or
from the certificate if not given to the issuer criterion of the
selector
.
The issuerPrincipals
are a collection with a single
X500Principal
for X509Certificate
s. For
{@link X509AttributeCertificate}s the issuer may contain more than one
X500Principal
.
@param dp The distribution point.
@param issuerPrincipals The issuers of the certificate or attribute
certificate which contains the distribution point.
@param selector The CRL selector.
@param pkixParams The PKIX parameters containing the cert stores.
@throws Exception if an exception occurs while processing.
@throws ClassCastException if issuerPrincipals
does not
contain only X500Principal
s.
Fetches complete CRLs according to RFC 3280.
@param dp The distribution point for which the complete CRL
@param cert The X509Certificate
or
{@link org.bouncycastle.x509.X509AttributeCertificate} for
which the CRL should be searched.
@param currentDate The date for which the delta CRLs must be valid.
@param paramsPKIX The extended PKIX parameters.
@return A Set
of X509CRL
s with complete
CRLs.
@throws Exception if an exception occurs while picking the CRLs
or no CRLs are found.
Fetches delta CRLs according to RFC 3280 section 5.2.4.
@param currentDate The date for which the delta CRLs must be valid.
@param paramsPKIX The extended PKIX parameters.
@param completeCRL The complete CRL the delta CRL is for.
@return A Set
of X509CRL
s with delta CRLs.
@throws Exception if an exception occurs while picking the delta
CRLs.
Find the issuer certificates of a given certificate.
@param cert
The certificate for which an issuer should be found.
@param pkixParams
@return A Collection
object containing the issuer
X509Certificate
s. Never null
.
@exception Exception
if an error occurs.
Extract the value of the given extension, if it exists.
The extension object.
The object identifier to obtain.
Asn1Object
if the extension cannot be read.
Returns the intersection of the permitted IP ranges in
permitted
with ip
.
@param permitted A Set
of permitted IP addresses with
their subnet mask as byte arrays.
@param ips The IP address with its subnet mask.
@return The Set
of permitted IP ranges intersected with
ip
.
Returns the union of the excluded IP ranges in excluded
with ip
.
@param excluded A Set
of excluded IP addresses with their
subnet mask as byte arrays.
@param ip The IP address with its subnet mask.
@return The Set
of excluded IP ranges unified with
ip
as byte arrays.
Calculates the union if two IP ranges.
@param ipWithSubmask1 The first IP address with its subnet mask.
@param ipWithSubmask2 The second IP address with its subnet mask.
@return A Set
with the union of both addresses.
Calculates the interesction if two IP ranges.
@param ipWithSubmask1 The first IP address with its subnet mask.
@param ipWithSubmask2 The second IP address with its subnet mask.
@return A Set
with the single IP address with its subnet
mask as a byte array or an empty Set
.
Concatenates the IP address with its subnet mask.
@param ip The IP address.
@param subnetMask Its subnet mask.
@return The concatenated IP address with its subnet mask.
Splits the IP addresses and their subnet mask.
@param ipWithSubmask1 The first IP address with the subnet mask.
@param ipWithSubmask2 The second IP address with the subnet mask.
@return An array with two elements. Each element contains the IP address
and the subnet mask in this order.
Based on the two IP addresses and their subnet masks the IP range is
computed for each IP address - subnet mask pair and returned as the
minimum IP address and the maximum address of the range.
@param ip1 The first IP address.
@param subnetmask1 The subnet mask of the first IP address.
@param ip2 The second IP address.
@param subnetmask2 The subnet mask of the second IP address.
@return A array with two elements. The first/second element contains the
min and max IP address of the first/second IP address and its
subnet mask.
Checks if the IP ip
is included in the permitted ISet
permitted
.
@param permitted A Set
of permitted IP addresses with
their subnet mask as byte arrays.
@param ip The IP address.
@throws PkixNameConstraintValidatorException
if the IP is not permitted.
Checks if the IP ip
is included in the excluded ISet
excluded
.
@param excluded A Set
of excluded IP addresses with their
subnet mask as byte arrays.
@param ip The IP address.
@throws PkixNameConstraintValidatorException
if the IP is excluded.
Checks if the IP address ip
is constrained by
constraint
.
@param ip The IP address.
@param constraint The constraint. This is an IP address concatenated with
its subnetmask.
@return true
if constrained, false
otherwise.
The common part of email1
and email2
is
added to the union union
. If email1
and
email2
have nothing in common they are added both.
@param email1 Email address constraint 1.
@param email2 Email address constraint 2.
@param union The union.
The most restricting part from email1
and
email2
is added to the intersection intersect
.
@param email1 Email address constraint 1.
@param email2 Email address constraint 2.
@param intersect The intersection.
Checks if the given GeneralName is in the permitted ISet.
@param name The GeneralName
@throws PkixNameConstraintValidatorException
If the name
Check if the given GeneralName is contained in the excluded ISet.
@param name The GeneralName.
@throws PkixNameConstraintValidatorException
If the name
is
excluded.
Updates the permitted ISet of these name constraints with the intersection
with the given subtree.
@param permitted The permitted subtrees
Adds a subtree to the excluded ISet of these name constraints.
@param subtree A subtree with an excluded GeneralName.
Returns the maximum IP address.
@param ip1 The first IP address.
@param ip2 The second IP address.
@return The maximum IP address.
Returns the minimum IP address.
@param ip1 The first IP address.
@param ip2 The second IP address.
@return The minimum IP address.
Compares IP address ip1
with ip2
. If ip1
is equal to ip2 0 is returned. If ip1 is bigger 1 is returned, -1
otherwise.
@param ip1 The first IP address.
@param ip2 The second IP address.
@return 0 if ip1 is equal to ip2, 1 if ip1 is bigger, -1 otherwise.
Returns the logical OR of the IP addresses ip1
and
ip2
.
@param ip1 The first IP address.
@param ip2 The second IP address.
@return The OR of ip1
and ip2
.
Stringifies an IPv4 or v6 address with subnet mask.
@param ip The IP with subnet mask.
@return The stringified IP address.
Summary description for PkixPolicyNode.
Constructors
This class helps to handle CRL revocation reasons mask. Each CRL handles a
certain set of revocation reasons.
Constructs are reason mask with the reasons.
The reasons.
A reason mask with no reason.
A mask with all revocation reasons.
Adds all reasons from the reasons mask to this mask.
@param mask The reasons mask to add.
Intersects this mask with the given reasons mask.
mask The mask to intersect with.
The intersection of this and teh given mask.
Returns true if the passed reasons mask has new reasons.
The reasons mask which should be tested for new reasons.
true if the passed reasons mask has new reasons.
Returns true
if this reasons mask contains all possible
reasons.
true if this reasons mask contains all possible reasons.
Returns the reasons in this mask.
If the complete CRL includes an issuing distribution point (IDP) CRL
extension check the following:
(i) If the distribution point name is present in the IDP CRL extension
and the distribution field is present in the DP, then verify that one of
the names in the IDP matches one of the names in the DP. If the
distribution point name is present in the IDP CRL extension and the
distribution field is omitted from the DP, then verify that one of the
names in the IDP matches one of the names in the cRLIssuer field of the
DP.
(ii) If the onlyContainsUserCerts boolean is asserted in the IDP CRL
extension, verify that the certificate does not include the basic
constraints extension with the cA boolean asserted.
(iii) If the onlyContainsCACerts boolean is asserted in the IDP CRL
extension, verify that the certificate includes the basic constraints
extension with the cA boolean asserted.
(iv) Verify that the onlyContainsAttributeCerts boolean is not asserted.
@param dp The distribution point.
@param cert The certificate.
@param crl The CRL.
@throws AnnotatedException if one of the conditions is not met or an error occurs.
If the DP includes cRLIssuer, then verify that the issuer field in the
complete CRL matches cRLIssuer in the DP and that the complete CRL
contains an
g distribution point extension with the indirectCRL
boolean asserted. Otherwise, verify that the CRL issuer matches the
certificate issuer.
@param dp The distribution point.
@param cert The certificate ot attribute certificate.
@param crl The CRL for cert
.
@throws AnnotatedException if one of the above conditions does not apply or an error
occurs.
Obtain and validate the certification path for the complete CRL issuer.
If a key usage extension is present in the CRL issuer's certificate,
verify that the cRLSign bit is set.
@param crl CRL which contains revocation information for the certificate
cert
.
@param cert The attribute certificate or certificate to check if it is
revoked.
@param defaultCRLSignCert The issuer certificate of the certificate cert
.
@param defaultCRLSignKey The public key of the issuer certificate
defaultCRLSignCert
.
@param paramsPKIX paramsPKIX PKIX parameters.
@param certPathCerts The certificates on the certification path.
@return A Set
with all keys of possible CRL issuer
certificates.
@throws AnnotatedException if the CRL is not valid or the status cannot be checked or
some error occurs.
Checks a distribution point for revocation information for the
certificate cert
.
@param dp The distribution point to consider.
@param paramsPKIX PKIX parameters.
@param cert Certificate to check if it is revoked.
@param validDate The date when the certificate revocation status should be
checked.
@param defaultCRLSignCert The issuer certificate of the certificate cert
.
@param defaultCRLSignKey The public key of the issuer certificate
defaultCRLSignCert
.
@param certStatus The current certificate revocation status.
@param reasonMask The reasons mask which is already checked.
@param certPathCerts The certificates of the certification path.
@throws AnnotatedException if the certificate is revoked or the status cannot be checked
or some error occurs.
Checks a certificate if it is revoked.
@param paramsPKIX PKIX parameters.
@param cert Certificate to check if it is revoked.
@param validDate The date when the certificate revocation status should be
checked.
@param sign The issuer certificate of the certificate cert
.
@param workingPublicKey The public key of the issuer certificate sign
.
@param certPathCerts The certificates of the certification path.
@throws AnnotatedException if the certificate is revoked or the status cannot be checked
or some error occurs.
If use-deltas is set, verify the issuer and scope of the delta CRL.
@param deltaCRL The delta CRL.
@param completeCRL The complete CRL.
@param pkixParams The PKIX paramaters.
@throws AnnotatedException if an exception occurs.
Checks if an attribute certificate is revoked.
@param attrCert Attribute certificate to check if it is revoked.
@param paramsPKIX PKIX parameters.
@param issuerCert The issuer certificate of the attribute certificate
attrCert
.
@param validDate The date when the certificate revocation status should
be checked.
@param certPathCerts The certificates of the certification path to be
checked.
@throws CertPathValidatorException if the certificate is revoked or the
status cannot be checked or some error occurs.
Searches for a holder public key certificate and verifies its
certification path.
@param attrCert the attribute certificate.
@param pkixParams The PKIX parameters.
@return The certificate path of the holder certificate.
@throws Exception if
- no public key certificate can be found although holder
information is given by an entity name or a base certificate
ID
- support classes cannot be created
- no certification path for the public key certificate can
be built
Checks a distribution point for revocation information for the
certificate attrCert
.
@param dp The distribution point to consider.
@param attrCert The attribute certificate which should be checked.
@param paramsPKIX PKIX parameters.
@param validDate The date when the certificate revocation status should
be checked.
@param issuerCert Certificate to check if it is revoked.
@param reasonMask The reasons mask which is already checked.
@param certPathCerts The certificates of the certification path to be
checked.
@throws Exception if the certificate is revoked or the status
cannot be checked or some error occurs.
A trust anchor or most-trusted Certification Authority (CA).
This class represents a "most-trusted CA", which is used as a trust anchor
for validating X.509 certification paths. A most-trusted CA includes the
public key of the CA, the CA's name, and any constraints upon the set of
paths which may be validated using this key. These parameters can be
specified in the form of a trusted X509Certificate or as individual
parameters.
Creates an instance of TrustAnchor with the specified X509Certificate and
optional name constraints, which are intended to be used as additional
constraints when validating an X.509 certification path.
The name constraints are specified as a byte array. This byte array
should contain the DER encoded form of the name constraints, as they
would appear in the NameConstraints structure defined in RFC 2459 and
X.509. The ASN.1 definition of this structure appears below.
NameConstraints ::= SEQUENCE {
permittedSubtrees [0] GeneralSubtrees OPTIONAL,
excludedSubtrees [1] GeneralSubtrees OPTIONAL }
GeneralSubtrees ::= SEQUENCE SIZE (1..MAX) OF GeneralSubtree
GeneralSubtree ::= SEQUENCE {
base GeneralName,
minimum [0] BaseDistance DEFAULT 0,
maximum [1] BaseDistance OPTIONAL }
BaseDistance ::= INTEGER (0..MAX)
GeneralName ::= CHOICE {
otherName [0] OtherName,
rfc822Name [1] IA5String,
dNSName [2] IA5String,
x400Address [3] ORAddress,
directoryName [4] Name,
ediPartyName [5] EDIPartyName,
uniformResourceIdentifier [6] IA5String,
iPAddress [7] OCTET STRING,
registeredID [8] OBJECT IDENTIFIER}
Note that the name constraints byte array supplied is cloned to protect
against subsequent modifications.
a trusted X509Certificate
a byte array containing the ASN.1 DER encoding of a
NameConstraints extension to be used for checking name
constraints. Only the value of the extension is included, not
the OID or criticality flag. Specify null to omit the
parameter.
if the specified X509Certificate is null
Creates an instance of TrustAnchor where the
most-trusted CA is specified as an X500Principal and public key.
Name constraints are an optional parameter, and are intended to be used
as additional constraints when validating an X.509 certification path.
The name constraints are specified as a byte array. This byte array
contains the DER encoded form of the name constraints, as they
would appear in the NameConstraints structure defined in RFC 2459
and X.509. The ASN.1 notation for this structure is supplied in the
documentation for the other constructors.
Note that the name constraints byte array supplied here is cloned to
protect against subsequent modifications.
the name of the most-trusted CA as X509Name
the public key of the most-trusted CA
a byte array containing the ASN.1 DER encoding of a NameConstraints extension to
be used for checking name constraints. Only the value of the extension is included,
not the OID or criticality flag. Specify null to omit the parameter.
if caPrincipal or pubKey is null
Creates an instance of TrustAnchor
where the most-trusted
CA is specified as a distinguished name and public key. Name constraints
are an optional parameter, and are intended to be used as additional
constraints when validating an X.509 certification path.
The name constraints are specified as a byte array. This byte array
contains the DER encoded form of the name constraints, as they would
appear in the NameConstraints structure defined in RFC 2459 and X.509.
the X.500 distinguished name of the most-trusted CA in RFC
2253 string format
the public key of the most-trusted CA
a byte array containing the ASN.1 DER encoding of a
NameConstraints extension to be used for checking name
constraints. Only the value of the extension is included, not
the OID or criticality flag. Specify null to omit the
parameter.
throws NullPointerException, IllegalArgumentException
Decode the name constraints and clone them if not null.
Returns a formatted string describing the TrustAnchor
.
a formatted string describing the TrustAnchor
Returns the most-trusted CA certificate.
Returns the name of the most-trusted CA as an X509Name.
Returns the name of the most-trusted CA in RFC 2253 string format.
Returns the public key of the most-trusted CA.
Utility class for creating IBasicAgreement objects from their names/Oids
Cipher Utility class contains methods that can not be specifically grouped into other classes.
Returns a ObjectIdentifier for a give encoding.
A string representation of the encoding.
A DerObjectIdentifier, null if the Oid is not available.
Utility class for creating IDigest objects from their names/Oids
Returns a ObjectIdentifier for a given digest mechanism.
A string representation of the digest meanism.
A DerObjectIdentifier, null if the Oid is not available.
A class containing methods to interface the BouncyCastle world to the .NET Crypto world.
Create an System.Security.Cryptography.X509Certificate from an X509Certificate Structure.
A System.Security.Cryptography.X509Certificate.
Utility class for creating HMac object from their names/Oids
Returns a ObjectIdentifier for a give encoding.
A string representation of the encoding.
A DerObjectIdentifier, null if the Oid is not available.
Use the specified instance of IRandomGenerator as random source.
This constructor performs no seeding of either the IRandomGenerator or the
constructed SecureRandom. It is the responsibility of the client to provide
proper seed material as necessary/appropriate for the given IRandomGenerator
implementation.
The source to generate all random bytes from.
base constructor.
create a SecurityUtilityException with the given message.
@param message the message to be carried with the exception.
Signer Utility class contains methods that can not be specifically grouped into other classes.
Returns a ObjectIdentifier for a give encoding.
A string representation of the encoding.
A DerObjectIdentifier, null if the Oid is not available.
Utility class for creating IWrapper objects from their names/Oids
Base class for an RFC 3161 Time Stamp Request.
Create a TimeStampRequest from the past in byte array.
@param req byte array containing the request.
@throws IOException if the request is malformed.
Create a TimeStampRequest from the past in input stream.
@param in input stream containing the request.
@throws IOException if the request is malformed.
Validate the timestamp request, checking the digest to see if it is of an
accepted type and whether it is of the correct length for the algorithm specified.
@param algorithms a set of string OIDS giving accepted algorithms.
@param policies if non-null a set of policies we are willing to sign under.
@param extensions if non-null a set of extensions we are willing to accept.
@throws TspException if the request is invalid, or processing fails.
return the ASN.1 encoded representation of this object.
Generator for RFC 3161 Time Stamp Request objects.
add a given extension field for the standard extensions tag (tag 3)
@throws IOException
add a given extension field for the standard extensions tag
The value parameter becomes the contents of the octet string associated
with the extension.
add a given extension field for the standard extensions tag (tag 3)
@throws IOException
add a given extension field for the standard extensions tag
The value parameter becomes the contents of the octet string associated
with the extension.
Base class for an RFC 3161 Time Stamp Response object.
Create a TimeStampResponse from a byte array containing an ASN.1 encoding.
@param resp the byte array containing the encoded response.
@throws TspException if the response is malformed.
@throws IOException if the byte array doesn't represent an ASN.1 encoding.
Create a TimeStampResponse from an input stream containing an ASN.1 encoding.
@param input the input stream containing the encoded response.
@throws TspException if the response is malformed.
@throws IOException if the stream doesn't represent an ASN.1 encoding.
Check this response against to see if it a well formed response for
the passed in request. Validation will include checking the time stamp
token if the response status is GRANTED or GRANTED_WITH_MODS.
@param request the request to be checked against
@throws TspException if the request can not match this response.
return the ASN.1 encoded representation of this object.
Generator for RFC 3161 Time Stamp Responses.
Return an appropriate TimeStampResponse.
If genTime is null a timeNotAvailable error response will be returned.
@param request the request this response is for.
@param serialNumber serial number for the response token.
@param genTime generation time for the response token.
@param provider provider to use for signature calculation.
@return
@throws NoSuchAlgorithmException
@throws NoSuchProviderException
@throws TSPException
Generate a TimeStampResponse with chosen status and FailInfoField.
@param status the PKIStatus to set.
@param failInfoField the FailInfoField to set.
@param statusString an optional string describing the failure.
@return a TimeStampResponse with a failInfoField and optional statusString
@throws TSPException in case the response could not be created
Validate the time stamp token.
To be valid the token must be signed by the passed in certificate and
the certificate must be the one referred to by the SigningCertificate
attribute included in the hashed attributes of the token. The
certificate must also have the ExtendedKeyUsageExtension with only
KeyPurposeID.IdKPTimeStamping and have been valid at the time the
timestamp was created.
A successful call to validate means all the above are true.
Return the underlying CmsSignedData object.
@return the underlying CMS structure.
Return a ASN.1 encoded byte stream representing the encoded object.
@throws IOException if encoding fails.
basic creation - only the default attributes will be included here.
create with a signer with extra signed/unsigned attributes.
@return the nonce value, null if there isn't one.
Recognised hash algorithms for the time stamp protocol.
Fetches the signature time-stamp attributes from a SignerInformation object.
Checks that the MessageImprint for each time-stamp matches the signature field.
(see RFC 3161 Appendix A).
@param signerInfo a SignerInformation to search for time-stamps
@return a collection of TimeStampToken objects
@throws TSPValidationException
Validate the passed in certificate as being of the correct type to be used
for time stamping. To be valid it must have an ExtendedKeyUsage extension
which has a key purpose identifier of id-kp-timeStamping.
@param cert the certificate of interest.
@throws TspValidationException if the certicate fails on one of the check points.
Return the digest algorithm using one of the standard JCA string
representations rather than the algorithm identifier (if possible).
Exception thrown if a TSP request or response fails to validate.
If a failure code is associated with the exception it can be retrieved using
the getFailureCode() method.
Return the failure code associated with this exception - if one is set.
@return the failure code if set, -1 otherwise.
General array utilities.
Are two arrays equal.
Left side.
Right side.
True if equal.
A constant time equals comparison - does not terminate early if
test will fail.
first array
second array
true if arrays equal, false otherwise.
BigInteger utilities.
Return the passed in value as an unsigned byte array.
@param value value to be converted.
@return a byte array without a leading zero byte if present in the signed encoding.
Return the passed in value as an unsigned byte array of specified length, zero-extended as necessary.
@param length desired length of result array.
@param n value to be converted.
@return a byte array of specified length, with leading zeroes as necessary given the size of n.
Return a random BigInteger not less than 'min' and not greater than 'max'
@param min the least value that may be generated
@param max the greatest value that may be generated
@param random the source of randomness
@return a random BigInteger value in the range [min,max]
Base class for both the compress and decompress classes.
Holds common arrays, and static data.
@author Keiron Liddle
An input stream that decompresses from the BZip2 format (with the file
header chars) to be read as any other stream.
@author Keiron Liddle
NB: note this class has been modified to read the leading BZ from the
start of the BZIP2 stream to make it compatible with other PGP programs.
A simple class the hold and calculate the CRC for sanity checking
of the data.
@author Keiron Liddle
Return the number of milliseconds since the Unix epoch (1 Jan., 1970 UTC) for a given DateTime value.
A UTC DateTime value not before epoch.
Number of whole milliseconds after epoch.
'dateTime' is before epoch.
Create a DateTime value from the number of milliseconds since the Unix epoch (1 Jan., 1970 UTC).
Number of milliseconds since the epoch.
A UTC DateTime value
Return the current number of milliseconds since the Unix epoch (1 Jan., 1970 UTC).
encode the input data producing a base 64 encoded byte array.
@return a byte array containing the base 64 encoded data.
encode the input data producing a base 64 encoded byte array.
@return a byte array containing the base 64 encoded data.
Encode the byte data to base 64 writing it to the given output stream.
@return the number of bytes produced.
Encode the byte data to base 64 writing it to the given output stream.
@return the number of bytes produced.
decode the base 64 encoded input data. It is assumed the input data is valid.
@return a byte array representing the decoded data.
decode the base 64 encoded string data - whitespace will be ignored.
@return a byte array representing the decoded data.
decode the base 64 encoded string data writing it to the given output stream,
whitespace characters will be ignored.
@return the number of bytes produced.
Encode and decode byte arrays (typically from binary to 7-bit ASCII
encodings).
encode the input data producing a base 64 output stream.
@return the number of bytes produced.
decode the base 64 encoded byte data writing it to the given output stream,
whitespace characters will be ignored.
@return the number of bytes produced.
decode the base 64 encoded string data writing it to the given output stream,
whitespace characters will be ignored.
@return the number of bytes produced.
A buffering class to allow translation from one format to another to
be done in discrete chunks.
Create a buffered Decoder.
The translater to use.
The size of the buffer.
Process one byte of data.
Data in.
Byte array for the output.
The offset in the output byte array to start writing from.
The amount of output bytes.
Process data from a byte array.
The input data.
Start position within input data array.
Amount of data to process from input data array.
Array to store output.
Position in output array to start writing from.
The amount of output bytes.
A class that allows encoding of data using a specific encoder to be processed in chunks.
Create.
The translator to use.
Size of the chunks.
Process one byte of data.
The byte.
An array to store output in.
Offset within output array to start writing from.
Process data from a byte array.
Input data Byte array containing data to be processed.
Start position within input data array.
Amount of input data to be processed.
Output data array.
Offset within output data array to start writing to.
The amount of data written.
Class to decode and encode Hex.
encode the input data producing a Hex encoded byte array.
@return a byte array containing the Hex encoded data.
encode the input data producing a Hex encoded byte array.
@return a byte array containing the Hex encoded data.
Hex encode the byte data writing it to the given output stream.
@return the number of bytes produced.
Hex encode the byte data writing it to the given output stream.
@return the number of bytes produced.
decode the Hex encoded input data. It is assumed the input data is valid.
@return a byte array representing the decoded data.
decode the Hex encoded string data - whitespace will be ignored.
@return a byte array representing the decoded data.
decode the Hex encoded string data writing it to the given output stream,
whitespace characters will be ignored.
@return the number of bytes produced.
encode the input data producing a Hex output stream.
@return the number of bytes produced.
decode the Hex encoded byte data writing it to the given output stream,
whitespace characters will be ignored.
@return the number of bytes produced.
decode the Hex encoded string data writing it to the given output stream,
whitespace characters will be ignored.
@return the number of bytes produced.
A hex translator.
Translator interface.
Return encoded block size.
2
Encode some data.
Input data array.
Start position within input data array.
The amount of data to process.
The output data array.
The offset within the output data array to start writing from.
Amount of data encoded.
Returns the decoded block size.
1
Decode data from a byte array.
The input data array.
Start position within input data array.
The amounty of data to process.
The output data array.
The position within the output data array to start writing from.
The amount of data written.
Convert binary data to and from UrlBase64 encoding. This is identical to
Base64 encoding, except that the padding character is "." and the other
non-alphanumeric characters are "-" and "_" instead of "+" and "/".
The purpose of UrlBase64 encoding is to provide a compact encoding of binary
data that is safe for use as an URL parameter. Base64 encoding does not
produce encoded values that are safe for use in URLs, since "/" can be
interpreted as a path delimiter; "+" is the encoded form of a space; and
"=" is used to separate a name from the corresponding value in an URL
parameter.
Encode the input data producing a URL safe base 64 encoded byte array.
@return a byte array containing the URL safe base 64 encoded data.
Encode the byte data writing it to the given output stream.
@return the number of bytes produced.
Decode the URL safe base 64 encoded input data - white space will be ignored.
@return a byte array representing the decoded data.
decode the URL safe base 64 encoded byte data writing it to the given output stream,
whitespace characters will be ignored.
@return the number of bytes produced.
decode the URL safe base 64 encoded string data - whitespace will be ignored.
@return a byte array representing the decoded data.
Decode the URL safe base 64 encoded string data writing it to the given output stream,
whitespace characters will be ignored.
@return the number of bytes produced.
Convert binary data to and from UrlBase64 encoding. This is identical to
Base64 encoding, except that the padding character is "." and the other
non-alphanumeric characters are "-" and "_" instead of "+" and "/".
The purpose of UrlBase64 encoding is to provide a compact encoding of binary
data that is safe for use as an URL parameter. Base64 encoding does not
produce encoded values that are safe for use in URLs, since "/" can be
interpreted as a path delimiter; "+" is the encoded form of a space; and
"=" is used to separate a name from the corresponding value in an URL
parameter.
Pipe all bytes from inStr to outStr, throwing StreamFlowException if greater
than limit bytes in inStr.
A
A
A
The number of bytes actually transferred, if not greater than limit
Validate the given IPv4 or IPv6 address.
@param address the IP address as a string.
@return true if a valid address, false otherwise
Validate the given IPv4 or IPv6 address and netmask.
@param address the IP address as a string.
@return true if a valid address with netmask, false otherwise
Validate the given IPv4 address.
@param address the IP address as a string.
@return true if a valid IPv4 address, false otherwise
Validate the given IPv6 address.
@param address the IP address as a string.
@return true if a valid IPv4 address, false otherwise
General string utilities.
Summary description for DeflaterOutputStream.
Summary description for DeflaterOutputStream.
The Holder object.
Holder ::= SEQUENCE {
baseCertificateID [0] IssuerSerial OPTIONAL,
-- the issuer and serial number of
-- the holder's Public Key Certificate
entityName [1] GeneralNames OPTIONAL,
-- the name of the claimant or role
objectDigestInfo [2] ObjectDigestInfo OPTIONAL
-- used to directly authenticate the holder,
-- for example, an executable
}
Constructs a holder for v2 attribute certificates with a hash value for
some type of object.
digestedObjectType
can be one of the following:
- 0 - publicKey - A hash of the public key of the holder must be
passed.
- 1 - publicKeyCert - A hash of the public key certificate of the
holder must be passed.
- 2 - otherObjectDigest - A hash of some other object type must be
passed.
otherObjectTypeID
must not be empty.
This cannot be used if a v1 attribute certificate is used.
@param digestedObjectType The digest object type.
@param digestAlgorithm The algorithm identifier for the hash.
@param otherObjectTypeID The object type ID if
digestedObjectType
is
otherObjectDigest
.
@param objectDigest The hash value.
Returns the hash if an object digest info is used.
@return The hash or null
if no object digest info is set.
Return any principal objects inside the attribute certificate holder entity names field.
@return an array of IPrincipal objects (usually X509Name), null if no entity names field is set.
Return the principals associated with the issuer attached to this holder
@return an array of principals, null if no BaseCertificateID is set.
Returns the digest object type if an object digest info is used.
- 0 - publicKey - A hash of the public key of the holder must be
passed.
- 1 - publicKeyCert - A hash of the public key certificate of the
holder must be passed.
- 2 - otherObjectDigest - A hash of some other object type must be
passed.
otherObjectTypeID
must not be empty.
@return The digest object type or -1 if no object digest info is set.
Returns the other object type ID if an object digest info is used.
@return The other object type ID or null
if no object
digest info is set.
Returns the digest algorithm ID if an object digest info is used.
@return The digest algorithm ID or null
if no object
digest info is set.
Return the serial number associated with the issuer attached to this holder.
@return the certificate serial number, null if no BaseCertificateID is set.
Carrying class for an attribute certificate issuer.
Set the issuer directly with the ASN.1 structure.
@param issuer The issuer
Return any principal objects inside the attribute certificate issuer object.
An array of IPrincipal objects (usually X509Principal).
A high level authority key identifier.
Constructor which will take the byte[] returned from getExtensionValue()
@param encodedValue a DER octet encoded string with the extension structure in it.
@throws IOException on parsing errors.
Create an AuthorityKeyIdentifier using the passed in certificate's public
key, issuer and serial number.
@param certificate the certificate providing the information.
@throws CertificateParsingException if there is a problem processing the certificate
Create an AuthorityKeyIdentifier using just the hash of the
public key.
@param pubKey the key to generate the hash from.
@throws InvalidKeyException if there is a problem using the key.
A high level subject key identifier.
Constructor which will take the byte[] returned from getExtensionValue()
@param encodedValue a DER octet encoded string with the extension structure in it.
@throws IOException on parsing errors.
Interface for an X.509 Attribute Certificate.
Return the attributes contained in the attribute block in the certificate.
An array of attributes.
Return the attributes with the same type as the passed in oid.
The object identifier we wish to match.
An array of matched attributes, null if there is no match.
Return an ASN.1 encoded byte array representing the attribute certificate.
An ASN.1 encoded byte array.
If the certificate cannot be encoded.
The version number for the certificate.
The serial number for the certificate.
The UTC DateTime before which the certificate is not valid.
The UTC DateTime after which the certificate is not valid.
The holder of the certificate.
The issuer details for the certificate.
A utility class that will extract X509Principal objects from X.509 certificates.
Use this in preference to trying to recreate a principal from a string, not all
DNs are what they should be, so it's best to leave them encoded where they
can be.
Return the issuer of the given cert as an X509Principal.
Return the subject of the given cert as an X509Principal.
Return the issuer of the given CRL as an X509Principal.
This class is an Selector
like implementation to select
attribute certificates from a given set of criteria.
@see org.bouncycastle.x509.X509AttributeCertificate
@see org.bouncycastle.x509.X509Store
Decides if the given attribute certificate should be selected.
The attribute certificate to be checked.
true
if the object matches this selector.
Adds a target name criterion for the attribute certificate to the target
information extension criteria. The X509AttributeCertificate
must contain at least one of the specified target names.
Each attribute certificate may contain a target information extension
limiting the servers where this attribute certificate can be used. If
this extension is not present, the attribute certificate is not targeted
and may be accepted by any server.
@param name The name as a GeneralName (not null
)
Adds a target name criterion for the attribute certificate to the target
information extension criteria. The X509AttributeCertificate
must contain at least one of the specified target names.
Each attribute certificate may contain a target information extension
limiting the servers where this attribute certificate can be used. If
this extension is not present, the attribute certificate is not targeted
and may be accepted by any server.
@param name a byte array containing the name in ASN.1 DER encoded form of a GeneralName
@throws IOException if a parsing error occurs.
Adds a collection with target names criteria. If null
is
given any will do.
The collection consists of either GeneralName objects or byte[] arrays representing
DER encoded GeneralName structures.
@param names A collection of target names.
@throws IOException if a parsing error occurs.
@see #AddTargetName(byte[])
@see #AddTargetName(GeneralName)
Gets the target names. The collection consists of List
s
made up of an Integer
in the first entry and a DER encoded
byte array or a String
in the second entry.
The returned collection is immutable.
@return The collection of target names
@see #setTargetNames(Collection)
Adds a target group criterion for the attribute certificate to the target
information extension criteria. The X509AttributeCertificate
must contain at least one of the specified target groups.
Each attribute certificate may contain a target information extension
limiting the servers where this attribute certificate can be used. If
this extension is not present, the attribute certificate is not targeted
and may be accepted by any server.
@param group The group as GeneralName form (not null
)
Adds a target group criterion for the attribute certificate to the target
information extension criteria. The X509AttributeCertificate
must contain at least one of the specified target groups.
Each attribute certificate may contain a target information extension
limiting the servers where this attribute certificate can be used. If
this extension is not present, the attribute certificate is not targeted
and may be accepted by any server.
@param name a byte array containing the group in ASN.1 DER encoded form of a GeneralName
@throws IOException if a parsing error occurs.
Adds a collection with target groups criteria. If null
is
given any will do.
The collection consists of GeneralName
objects or byte[]
representing DER encoded GeneralNames.
@param names A collection of target groups.
@throws IOException if a parsing error occurs.
@see #AddTargetGroup(byte[])
@see #AddTargetGroup(GeneralName)
Gets the target groups. The collection consists of List
s
made up of an Integer
in the first entry and a DER encoded
byte array or a String
in the second entry.
The returned collection is immutable.
@return The collection of target groups.
@see #setTargetGroups(Collection)
The attribute certificate which must be matched.
If null is given, any will do.
The criteria for validity
If null is given any will do.
The holder.
If null is given any will do.
The issuer.
If null is given any will do.
The serial number.
If null is given any will do.
This class is an IX509Selector
implementation to select
certificate pairs, which are e.g. used for cross certificates. The set of
criteria is given from two X509CertStoreSelector
objects,
each of which, if present, must match the respective component of a pair.
Decides if the given certificate pair should be selected. If
obj is not a X509CertificatePair
, this method
returns false
.
The X509CertificatePair
to be tested.
true
if the object matches this selector.
The certificate pair which is used for testing on equality.
The certificate selector for the forward part.
The certificate selector for the reverse part.
A simple collection backed store.
Basic constructor.
@param collection - initial contents for the store, this is copied.
Return the matches in the collection for the passed in selector.
@param selector the selector to match against.
@return a possibly empty collection of matching objects.
This class contains a collection for collection based X509Store
s.
Constructor.
The collection is copied.
The collection containing X.509 object types.
If collection is null.
Returns a copy of the ICollection
.
Returns a formatted string describing the parameters.
An ICollection
of X509Name
objects
The attribute certificate being checked. This is not a criterion.
Rather, it is optional information that may help a {@link X509Store} find
CRLs that would be relevant when checking revocation for the specified
attribute certificate. If null
is specified, then no such
optional information is provided.
@param attrCert the IX509AttributeCertificate
being checked (or
null
)
@see #getAttrCertificateChecking()
If true
only complete CRLs are returned. Defaults to
false
.
@return true
if only complete CRLs are returned.
Returns if this selector must match CRLs with the delta CRL indicator
extension set. Defaults to false
.
@return Returns true
if only CRLs with the delta CRL
indicator extension are selected.
The issuing distribution point.
The issuing distribution point extension is a CRL extension which
identifies the scope and the distribution point of a CRL. The scope
contains among others information about revocation reasons contained in
the CRL. Delta CRLs and complete CRLs must have matching issuing
distribution points.
The byte array is cloned to protect against subsequent modifications.
You must also enable or disable this criteria with
{@link #setIssuingDistributionPointEnabled(bool)}.
@param issuingDistributionPoint The issuing distribution point to set.
This is the DER encoded OCTET STRING extension value.
@see #getIssuingDistributionPoint()
Whether the issuing distribution point criteria should be applied.
Defaults to false
.
You may also set the issuing distribution point criteria if not a missing
issuing distribution point should be assumed.
@return Returns if the issuing distribution point check is enabled.
The maximum base CRL number. Defaults to null
.
@return Returns the maximum base CRL number.
@see #setMaxBaseCRLNumber(BigInteger)
A factory to produce Public Key Info Objects.
Create a Subject Public Key Info object for a given public key.
One of ElGammalPublicKeyParameters, DSAPublicKeyParameter, DHPublicKeyParameters, RsaKeyParameters or ECPublicKeyParameters
A subject public key info object.
Throw exception if object provided is not one of the above.
Create loading data from byte array.
Create loading data from byte array.
Generates a certificate object and initializes it with the data
read from the input stream inStream.
Returns a (possibly empty) collection view of the certificates
read from the given input stream inStream.
Class for carrying the values in an X.509 Attribute.
@param at an object representing an attribute.
Create an X.509 Attribute with the type given by the passed in oid and
the value represented by an ASN.1 Set containing value.
@param oid type of the attribute
@param value value object to go into the atribute's value set.
Create an X.59 Attribute with the type given by the passed in oid and the
value represented by an ASN.1 Set containing the objects in value.
@param oid type of the attribute
@param value vector of values to go in the attribute's value set.
An Object representing an X509 Certificate.
Has static methods for loading Certificates encoded in many forms that return X509Certificate Objects.
Return true if the nominated time is within the start and end times nominated on the certificate.
The time to test validity against.
True if certificate is valid for nominated time.
Checks if the current date is within certificate's validity period.
Checks if the given date is within certificate's validity period.
if the certificate is expired by given date
if the certificate is not yet valid on given date
Return the Der encoded TbsCertificate data.
This is the certificate component less the signature.
To Get the whole certificate call the GetEncoded() member.
A byte array containing the Der encoded Certificate component.
The signature.
A byte array containg the signature of the certificate.
Get the signature algorithms parameters. (EG DSA Parameters)
A byte array containing the Der encoded version of the parameters or null if there are none.
Get a key usage guidlines.
Get the public key of the subject of the certificate.
The public key parameters.
Return a Der encoded version of this certificate.
A byte array.
Verify the certificate's signature using the nominated public key.
An appropriate public key parameter object, RsaPublicKeyParameters, DsaPublicKeyParameters or ECDsaPublicKeyParameters
True if the signature is valid.
If key submitted is not of the above nominated types.
Return true if the current time is within the start and end times nominated on the certificate.
true id certificate is valid for the current time.
Return the certificate's version.
An integer whose value Equals the version of the cerficate.
Return a BigInteger containing the serial number.
The Serial number.
Get the Issuer Distinguished Name. (Who signed the certificate.)
And X509Object containing name and value pairs.
Get the subject of this certificate.
An X509Name object containing name and value pairs.
The time that this certificate is valid from.
A DateTime object representing that time in the local time zone.
The time that this certificate is valid up to.
A DateTime object representing that time in the local time zone.
A meaningful version of the Signature Algorithm. (EG SHA1WITHRSA)
A sting representing the signature algorithm.
Get the Signature Algorithms Object ID.
A string containg a '.' separated object id.
Get the issuers UID.
A DerBitString.
Get the subjects UID.
A DerBitString.
This class contains a cross certificate pair. Cross certificates pairs may
contain two cross signed certificates from two CAs. A certificate from the
other CA to this CA is contained in the forward certificate, the certificate
from this CA to the other CA is contained in the reverse certificate.
Constructor
Certificate from the other CA to this CA.
Certificate from this CA to the other CA.
Constructor from a ASN.1 CertificatePair structure.
The CertificatePair ASN.1 object.
Returns the certificate from the other CA to this CA.
Returns the certificate from this CA to the other CA.
class for dealing with X509 certificates.
At the moment this will deal with "-----BEGIN CERTIFICATE-----" to "-----END CERTIFICATE-----"
base 64 encoded certs, as well as the BER binaries of certificates and some classes of PKCS#7
objects.
Create loading data from byte array.
Create loading data from byte array.
Generates a certificate object and initializes it with the data
read from the input stream inStream.
Returns a (possibly empty) collection view of the certificates
read from the given input stream inStream.
Create loading data from byte array.
Create loading data from byte array.
The following extensions are listed in RFC 2459 as relevant to CRLs
Authority Key Identifier
Issuer Alternative Name
CRL Number
Delta CRL Indicator (critical)
Issuing Distribution Point (critical)
Returns a string representation of this CRL.
@return a string representation of this CRL.
Checks whether the given certificate is on this CRL.
@param cert the certificate to check for.
@return true if the given certificate is on this CRL,
false otherwise.
The following extensions are listed in RFC 2459 as relevant to CRL Entries
ReasonCode Hode Instruction Code Invalidity Date Certificate Issuer
(critical)
Constructor for CRLEntries of indirect CRLs. If isIndirect
is false
{@link #getCertificateIssuer()} will always
return null
, previousCertificateIssuer
is
ignored. If this isIndirect
is specified and this CrlEntry
has no certificate issuer CRL entry extension
previousCertificateIssuer
is returned by
{@link #getCertificateIssuer()}.
@param c
TbsCertificateList.CrlEntry object.
@param isIndirect
true
if the corresponding CRL is a indirect
CRL.
@param previousCertificateIssuer
Certificate issuer of the previous CrlEntry.
Create loading data from byte array.
Create loading data from byte array.
Generates a certificate revocation list (CRL) object and initializes
it with the data read from the input stream inStream.
Returns a (possibly empty) collection view of the CRLs read from
the given input stream inStream.
The inStream may contain a sequence of DER-encoded CRLs, or
a PKCS#7 CRL set. This is a PKCS#7 SignedData object, with the
only significant field being crls. In particular the signature
and the contents are ignored.
A holding class for constructing an X509 Key Usage extension.
id-ce-keyUsage OBJECT IDENTIFIER ::= { id-ce 15 }
KeyUsage ::= BIT STRING {
digitalSignature (0),
nonRepudiation (1),
keyEncipherment (2),
dataEncipherment (3),
keyAgreement (4),
keyCertSign (5),
cRLSign (6),
encipherOnly (7),
decipherOnly (8) }
Basic constructor.
@param usage - the bitwise OR of the Key Usage flags giving the
allowed uses for the key.
e.g. (X509KeyUsage.keyEncipherment | X509KeyUsage.dataEncipherment)
Return the digest algorithm using one of the standard JCA string
representations rather than the algorithm identifier (if possible).
Class to Generate X509V1 Certificates.
Default Constructor.
Reset the generator.
Set the certificate's serial number.
Make serial numbers long, if you have no serial number policy make sure the number is at least 16 bytes of secure random data.
You will be surprised how ugly a serial number collision can get.
The serial number.
Set the issuer distinguished name.
The issuer is the entity whose private key is used to sign the certificate.
The issuers DN.
Set the date that this certificate is to be valid from.
Set the date after which this certificate will no longer be valid.
Set the subject distinguished name.
The subject describes the entity associated with the public key.
Set the public key that this certificate identifies.
Set the signature algorithm that will be used to sign this certificate.
This can be either a name or an OID, names are treated as case insensitive.
string representation of the algorithm name
Generate a new X509Certificate.
The private key of the issuer used to sign this certificate.
An X509Certificate.
Generate a new X509Certificate specifying a SecureRandom instance that you would like to use.
The private key of the issuer used to sign this certificate.
The Secure Random you want to use.
An X509Certificate.
Allows enumeration of the signature names supported by the generator.
An implementation of a version 2 X.509 Attribute Certificate.
Class to produce an X.509 Version 2 AttributeCertificate.
Reset the generator
Set the Holder of this Attribute Certificate.
Set the issuer.
Set the serial number for the certificate.
Set the signature algorithm. This can be either a name or an OID, names
are treated as case insensitive.
The algorithm name.
Add an attribute.
Add a given extension field for the standard extensions tag.
Add a given extension field for the standard extensions tag.
The value parameter becomes the contents of the octet string associated
with the extension.
Generate an X509 certificate, based on the current issuer and subject.
Generate an X509 certificate, based on the current issuer and subject,
using the supplied source of randomness, if required.
Allows enumeration of the signature names supported by the generator.
class to produce an X.509 Version 2 CRL.
reset the generator
Set the issuer distinguished name - the issuer is the entity whose private key is used to sign the
certificate.
Reason being as indicated by CrlReason, i.e. CrlReason.KeyCompromise
or 0 if CrlReason is not to be used
Add a CRL entry with an Invalidity Date extension as well as a CrlReason extension.
Reason being as indicated by CrlReason, i.e. CrlReason.KeyCompromise
or 0 if CrlReason is not to be used
Add a CRL entry with extensions.
Add the CRLEntry objects contained in a previous CRL.
@param other the X509Crl to source the other entries from.
Set the signature algorithm. This can be either a name or an oid, names
are treated as case insensitive.
@param signatureAlgorithm string representation of the algorithm name.
add a given extension field for the standard extensions tag (tag 0)
add a given extension field for the standard extensions tag (tag 0)
add a given extension field for the standard extensions tag (tag 0)
add a given extension field for the standard extensions tag (tag 0)
Generate an X509 CRL, based on the current issuer and subject.
The key used for signing.
Generate an X509 CRL, based on the current issuer and subject.
The key used for signing.
A user-defined source of randomness.
Allows enumeration of the signature names supported by the generator.
A class to Generate Version 3 X509Certificates.
Reset the Generator.
Set the certificate's serial number.
Make serial numbers long, if you have no serial number policy make sure the number is at least 16 bytes of secure random data.
You will be surprised how ugly a serial number collision can Get.
The serial number.
Set the distinguished name of the issuer.
The issuer is the entity which is signing the certificate.
The issuer's DN.
Set the date that this certificate is to be valid from.
Set the date after which this certificate will no longer be valid.
Set the DN of the entity that this certificate is about.
Set the public key that this certificate identifies.
Set the signature algorithm that will be used to sign this certificate.
Set the subject unique ID - note: it is very rare that it is correct to do this.
Set the issuer unique ID - note: it is very rare that it is correct to do this.
Add a given extension field for the standard extensions tag (tag 3).
string containing a dotted decimal Object Identifier.
Is it critical.
The value.
Add an extension to this certificate.
Its Object Identifier.
Is it critical.
The value.
Add an extension using a string with a dotted decimal OID.
string containing a dotted decimal Object Identifier.
Is it critical.
byte[] containing the value of this extension.
Add an extension to this certificate.
Its Object Identifier.
Is it critical.
byte[] containing the value of this extension.
Add a given extension field for the standard extensions tag (tag 3),
copying the extension value from another certificate.
add a given extension field for the standard extensions tag (tag 3)
copying the extension value from another certificate.
@throws CertificateParsingException if the extension cannot be extracted.
Generate an X509Certificate.
The private key of the issuer that is signing this certificate.
An X509Certificate.
Generate an X509Certificate using your own SecureRandom.
The private key of the issuer that is signing this certificate.
You Secure Random instance.
An X509Certificate.
Allows enumeration of the signature names supported by the generator.
Add
args: ByVal key As IComparable, ByVal data As Object
key is object that implements IComparable interface
performance tip: change to use use int type (such as the hashcode)
RestoreAfterInsert
Additions to red-black trees usually destroy the red-black
properties. Examine the tree and restore. Rotations are normally
required to restore it
RotateLeft
Rebalance the tree by rotating the nodes to the left
RotateRight
Rebalance the tree by rotating the nodes to the right
RestoreAfterDelete
Deletions from red-black trees may destroy the red-black
properties. Examine the tree and restore. Rotations are normally
required to restore it
Determine order, walk the tree and push the nodes onto the stack
HasMoreElements
NextElement
MoveNext
For .NET compatibility
Key
Data
Key
Data
Color
Left
Right
Summary description for ListIterator.
Summary description for Util.
Summary description for DeflaterOutputStream.
Summary description for DeflaterOutputStream.
@author itextpdf.com
Receive a writer and the document to do certain operations on them.
@param writer the PdfWriter
@param doc the document
@throws DocumentException
A class that contains some utilities to parse HTML attributes and content.
@since 5.0.6 (some of these methods used to be in the Markup class)
@deprecated since 5.5.2
a default value for font-size
@since 2.1.3
Parses a length.
@param str
a length in the form of an optional + or -, followed by a
number and a unit.
@return a float
New method contributed by: Lubos Strapko
@since 2.1.3
Converts a BaseColor
into a HTML representation of this
BaseColor
.
@param s
the BaseColor
that has to be converted.
@return the HTML representation of this BaseColor
This method parses a String with attributes and returns a Properties
object.
@param str
a String of this form: 'key1="value1"; key2="value2";...
keyN="valueN" '
@return a Properties object
Removes the comments sections of a String.
@param str
the original String
@param startComment
the String that marks the start of a Comment section
@param endComment
the String that marks the end of a Comment section.
@return the String stripped of its comment section
Helper class that reduces the white space in a String
@param content content containing whitespace
@return the content without all unnecessary whitespace
A series of predefined font sizes.
@since 5.0.6 (renamed)
Picks a font size from a series of predefined font sizes.
@param value the new value of a font, expressed as an index
@param previous the previous value of the font size
@return a new font size.
Translates a String value to an alignment value.
(written by Norman Richards, integrated into iText by Bruno)
@param alignment a String (one of the ALIGN_ constants of this class)
@return an alignment value (one of the ALIGN_ constants of the Element interface)
We use a CellWrapper because we need some extra info
that isn't available in PdfPCell.
@author psoares
@since 5.0.6 (renamed)
@deprecated since 5.5.2
The cell that is wrapped in this stub.
The width of the cell.
@since iText 5.0.6
Indicates if the width is a percentage.
@since iText 5.0.6
Creates a new instance of IncCell.
@param tag the cell that is wrapped in this object.
@param chain properties such as width
@since 5.0.6
Creates a PdfPCell element based on a tag and its properties.
@param tag a cell tag
@param chain the hierarchy chain
@see com.lowagie.text.Element#isContent()
@since iText 2.0.8
@see com.lowagie.text.Element#isNestable()
@since iText 2.0.8
Factory that produces iText Element objects,
based on tags and their properties.
@author blowagie
@author psoares
@since 5.0.6 (renamed)
@deprecated since 5.5.2
The font provider that will be used to fetch fonts.
@since iText 5.0 This used to be a FontFactoryImp
Creates a new instance of FactoryProperties.
Creates a Font object based on a chain of properties.
@param chain chain of properties
@return an iText Font object
Creates an iText Chunk
@param content the content of the Chunk
@param chain the hierarchy chain
@return a Chunk
Creates an iText Paragraph object using the properties
of the different tags and properties in the hierarchy chain.
@param chain the hierarchy chain
@return a Paragraph without any content
Creates an iText Paragraph object using the properties
of the different tags and properties in the hierarchy chain.
@param chain the hierarchy chain
@return a ListItem without any content
Method that does the actual Element creating for
the createParagraph and createListItem method.
@param paragraph
@param chain
Sets the leading of a Paragraph object.
@param paragraph the Paragraph for which we set the leading
@param leading the String value of the leading
Gets a HyphenationEvent based on the hyphenation entry in
the hierarchy chain.
@param chain the hierarchy chain
@return a HyphenationEvent
@since 2.1.2
Creates a LineSeparator.
@since 5.0.6
Setter for the font provider
@param provider
@since 5.0.6 renamed from setFontImp
This class maps tags such as div and span to their corresponding
TagProcessor classes.
@deprecated since 5.5.2
Creates a Map containing supported tags.
Object that processes the following tags:
i, em, b, strong, s, strike, u, sup, sub
Object that processes the a tag.
Object that processes the br tag.
Interface that needs to be implemented by every tag that is supported by HTMLWorker.
@deprecated since 5.5.2
Implement this class to tell the HTMLWorker what to do
when an open tag is encountered.
@param worker the HTMLWorker
@param tag the tag that was encountered
@param attrs the current attributes of the tag
@throws DocumentException
@throws IOException
Implement this class to tell the HTMLWorker what to do
when an close tag is encountered.
@param worker the HTMLWorker
@param tag the tag that was encountered
@throws DocumentException
@see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#startElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String)
@see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#endElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String)
Maps em to i, strong to b, and strike to s.
This is a convention: the style parser expects i, b and s.
@param tag the original tag
@return the mapped tag
@see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#startElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String)
@see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#endElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String)
@see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#startElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String, java.util.Map)
@see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#endElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String)
@see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#startElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String, java.util.Map)
@see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#endElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String)
@see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#startElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String, java.util.Map)
@see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#endElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String)
@see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#startElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String, java.util.Map)
@see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#endElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String)
@see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#startElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String, java.util.Map)
@see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#endElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String)
@see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#startElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String, java.util.Map)
@see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#endElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String)
@see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#startElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String, java.util.Map)
@see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#endElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String)
@throws DocumentException
@see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#startElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String, java.util.Map)
@see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#endElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String)
@throws DocumentException
@see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#startElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String, java.util.Map)
@see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#endElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String)
@throws DocumentException
@see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#startElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String, java.util.Map)
@see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#endElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String)
@see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#startElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String, java.util.Map)
@see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#endElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String)
Implement this interface to process images and
to indicate if the image needs to be added or
skipped.
@since 5.0.6 (renamed)
@deprecated since 5.5.2
Allows you to (pre)process the image before (or instead of)
adding it to the DocListener with HTMLWorker.
@param img the Image object
@param attrs attributes of the image
@param chain hierarchy of attributes
@param doc the DocListener to which the Image needs to be added
@return false if you still want HTMLWorker to add the Image
Allows you to do additional processing on a Paragraph that contains a link.
@author psoares
@since 5.0.6 (renamed)
@deprecated since 5.5.2
Does additional processing on a link paragraph
@param current the Paragraph that has the link
@param attrs the attributes
@return false if the Paragraph no longer needs processing
@since 5.0.6
@deprecated since 5.5.2
We use a TableWrapper because PdfPTable is rather complex
to put on the HTMLWorker stack.
@author psoares
@since 5.0.6 (renamed)
@deprecated since 5.5.2
The styles that need to be applied to the table
@since 5.0.6 renamed from props
Nested list containing the PdfPCell elements that are part of this table.
Array containing the widths of the columns.
@since iText 5.0.6
Creates a new instance of IncTable.
@param attrs a Map containing attributes
Adds a new row to the table.
@param row a list of PdfPCell elements
Creates a new PdfPTable based on the info assembled
in the table stub.
@return a PdfPTable
Setter for the column widths
@since iText 5.0.6
Logger interface
{@link LoggerFactory#setLogger(Logger)}.
@author redlab_b
@param klass
@return the logger for the given klass
@param level
@return true if there should be logged for the given level
Log a warning message.
@param message
Log a trace message.
@param message
Log a debug message.
@param message
Log an info message.
@param message
Log an error message.
@param message
Log an error message and exception.
@param message
@param e
The different log levels.
@author redlab_b
LoggerFactory can be used to set a logger. The logger should be created by
implementing {@link Logger}. In the implementation users can choose how they
log received messages. Added for developers. For some cases it can be handy
to receive logging statements while developing applications with iText
@author redlab_b
Returns the logger set in this LoggerFactory. Defaults to {@link NoOpLogger}
@param klass
@return the logger.
Returns the logger set in this LoggerFactory. Defaults to {@link NoOpLogger}
@param name
@return the logger.
Returns the LoggerFactory
@return singleton instance of this LoggerFactory
Set the global logger to process logging statements with.
@param logger the logger
Get the logger.
@return the logger
The no-operation logger, it does nothing with the received logging
statements. And returns false by default for {@link NoOpLogger#isLogging(Level)}
@author redlab_b
A Simple System.out logger.
@author redlab_be
Defaults packageReduce to 1.
Amount of characters each package name should be reduced with.
@param packageReduce
@param klass
@param shorten
@param name2
@return
Modified from original LZWCompressor to change interface to passing a
buffer of data to be compressed.
base underlying code size of data being compressed 8 for TIFF, 1 to 8 for GIF *
reserved clear code based on code size *
reserved end of data code based on code size *
current number bits output for each code *
limit at which current number of bits code size has to be increased *
the prefix code which represents the predecessor string to current input point *
output destination for bit codes *
general purpose LZW string table *
modify the limits of the code values in LZW encoding due to TIFF bug / feature *
@param outp destination for compressed data
@param codeSize the initial code size for the LZW compressor
@param TIFF flag indicating that TIFF lzw fudge needs to be applied
@exception IOException if underlying output stream error
@param buf data to be compressed to output stream
@exception IOException if underlying output stream error
Indicate to compressor that no more data to go so write outp
any remaining buffered data.
@exception IOException if underlying output stream error
General purpose LZW String Table.
Extracted from GIFEncoder by Adam Doppelt
Comments added by Robin Luiten
expandCode
added by Robin Luiten
The strLen_ table to give quick access to the lenght of an expanded
code for use by the expandCode
method added by Robin.
codesize + Reserved Codes
each entry corresponds to a code and contains the length of data
that the code expands to when decoded.
Constructor allocate memory for string store data
@param index value of -1 indicates no predecessor [used in initialisation]
@param b the byte [character] to add to the string store which follows
the predecessor string specified the index.
@return 0xFFFF if no space in table left for addition of predecesor
index and byte b. Else return the code allocated for combination index + b.
@param index index to prefix string
@param b the character that follws the index prefix
@return b if param index is HASH_FREE. Else return the code
for this prefix and byte successor
@param codesize the size of code to be preallocated for the
string store.
If expanded data doesnt fit into array only what will fit is written
to buf and the return value indicates how much of the expanded code has
been written to the buf. The next call to ExpandCode() should be with
the same code and have the skip parameter set the negated value of the
previous return. Succesive negative return values should be negated and
added together for next skip parameter value with same code.
@param buf buffer to place expanded data into
@param offset offset to place expanded data
@param code the code to expand to the byte array it represents.
PRECONDITION This code must allready be in the LZSS
@param skipHead is the number of bytes at the start of the expanded code to
be skipped before data is written to buf. It is possible that skipHead is
equal to codeLen.
@return the length of data expanded into buf. If the expanded code is longer
than space left in buf then the value returned is a negative number which when
negated is equal to the number of bytes that were used of the code being expanded.
This negative value also indicates the buffer is full.
Sets the maximum errors count which will be returned as the result of the comparison.
@param compareByContentMaxErrorCount the errors count.
@return Returns this.
Sets the absolute error parameter which will be used in floating point numbers comparison.
@param error the epsilon new value.
@return Returns this.
Sets the relative error parameter which will be used in floating point numbers comparison.
@param error the epsilon new value.
@return Returns this.
@author psoares
@author psoares
@author psoares
@author psoares
@param seq
@return the cid code or -1 for end
@author psoares
@author psoares
@author psoares
This class represents a CMap file.
@author Ben Litchfield (ben@benlitchfield.com)
@since 2.1.4
Creates a new instance of CMap.
This will tell if this cmap has any one byte mappings.
@return true If there are any one byte mappings, false otherwise.
This will tell if this cmap has any two byte mappings.
@return true If there are any two byte mappings, false otherwise.
This will perform a lookup into the map.
@param code The code used to lookup.
@param offset The offset into the byte array.
@param length The length of the data we are getting.
@return The string that matches the lookup.
@author psoares
A key for an aspect that can be checked for PDF ISO Conformance.
A key for an aspect that can be checked for PDF ISO Conformance.
A key for an aspect that can be checked for PDF ISO Conformance.
A key for an aspect that can be checked for PDF ISO Conformance.
A key for an aspect that can be checked for PDF ISO Conformance.
A key for an aspect that can be checked for PDF ISO Conformance.
A key for an aspect that can be checked for PDF ISO Conformance.
A key for an aspect that can be checked for PDF ISO Conformance.
A key for an aspect that can be checked for PDF ISO Conformance.
A key for an aspect that can be checked for PDF ISO Conformance.
A key for an aspect that can be checked for PDF ISO Conformance.
A key for an aspect that can be checked for PDF ISO Conformance.
A key for an aspect that can be checked for PDF ISO Conformance.
A key for an aspect that can be checked for PDF ISO Conformance.
A key for an aspect that can be checked for PDF ISO Conformance.
A key for an aspect that can be checked for PDF ISO Conformance.
A key for an aspect that can be checked for PDF ISO Conformance.
A key for an aspect that can be checked for PDF ISO Conformance.
A key for an aspect that can be checked for PDF ISO Conformance.
A key for an aspect that can be checked for PDF ISO Conformance.
A Hashtable that uses ints as the keys.
The hash table data.
The total number of entries in the hash table.
Rehashes the table when count exceeds this threshold.
The load factor for the hashtable.
Constructs a new, empty hashtable with the specified initial
Constructs a new, empty hashtable with the specified initial
Constructs a new, empty hashtable. A default capacity and load factor
Returns true if the hashtable contains no elements.
Returns true if the specified object is an element of the hashtable.
Returns true if the collection contains an element for the key.
Rehashes the content of the table into a bigger table.
Removes the element corresponding to the key. Does nothing if the
Clears the hash table so that it has no more elements in it.
Returns the number of elements contained in the hashtable.
Gets the object associated with the specified key in the
Creates an AES Cipher with CBC and padding PKCS5/7.
@author Paulo Soares
Creates a new instance of AESCipher
Represents an inline image from a PDF
@since 5.1.4
@return the image dictionary associated with this inline image
@return the raw samples associated with this inline image
Utility methods to help with processing of inline images
@since 5.0.4
Map between key abbreviations allowed in dictionary of inline images and their
equivalent image dictionary keys
Map between value abbreviations allowed in dictionary of inline images for COLORSPACE
Map between value abbreviations allowed in dictionary of inline images for FILTER
Parses an inline image from the provided content parser. The parser must be positioned immediately following the BI operator in the content stream.
The parser will be left with current position immediately following the EI operator that terminates the inline image
@param ps the content parser to use for reading the image.
@return the parsed image
@throws IOException if anything goes wring with the parsing
@throws InlineImageParseException if parsing of the inline image failed due to issues specific to inline image processing
Parses the next inline image dictionary from the parser. The parser must be positioned immediately following the EI operator.
The parser will be left with position immediately following the whitespace character that follows the ID operator that ends the inline image dictionary.
@param ps the parser to extract the embedded image information from
@return the dictionary for the inline image, with any abbreviations converted to regular image dictionary keys and values
@throws IOException if the parse fails
Transforms value abbreviations into their corresponding real value
@param key the key that the value is for
@param value the value that might be an abbreviation
@return if value is an allowed abbreviation for the key, the expanded value for that abbreviation. Otherwise, value is returned without modification
@param colorSpaceName the name of the color space. If null, a bi-tonal (black and white) color space is assumed.
@return the components per pixel for the specified color space
Computes the number of unfiltered bytes that each row of the image will contain.
If the number of bytes results in a partial terminating byte, this number is rounded up
per the PDF specification
@param imageDictionary the dictionary of the inline image
@return the number of bytes per row of the image
Parses the samples of the image from the underlying content parser, ignoring all filters.
The parser must be positioned immediately after the ID operator that ends the inline image's dictionary.
The parser will be left positioned immediately following the EI operator.
This is primarily useful if no filters have been applied.
@param imageDictionary the dictionary of the inline image
@param ps the content parser
@return the samples of the image
@throws IOException if anything bad happens during parsing
Parses the samples of the image from the underlying content parser, accounting for filters
The parser must be positioned immediately after the ID operator that ends the inline image's dictionary.
The parser will be left positioned immediately following the EI operator.
Note:This implementation does not actually apply the filters at this time
@param imageDictionary the dictionary of the inline image
@param ps the content parser
@return the samples of the image
@throws IOException if anything bad happens during parsing
Simple class in case users need to differentiate an exception from processing
inline images vs other exceptions
@since 5.0.4
Wrapper class for PdfCopy and PdfSmartCopy.
Allows you to concatenate existing PDF documents with much less code.
The Document object for PdfCopy.
The actual PdfWriter
Creates an instance of the concatenation class.
@param os the Stream for the PDF document
Creates an instance of the concatenation class.
@param os the Stream for the PDF document
@param smart do we want PdfCopy to detect redundant content?
Adds the pages from an existing PDF document.
@param reader the reader for the existing PDF document
@return the number of pages that were added
@throws DocumentException
@throws IOException
Opens the document (if it isn't open already).
Opening the document is done implicitly.
We've finished writing the concatenated document.
Gets the PdfCopy instance so that you can add bookmarks or change preferences before you close PdfConcatenate.
The spacing before the table.
The spacing after the table.
Defines if the div should be kept on one page if possible
IMPROTANT NOTE: be careful with this method because it would return correct result
only in case if {@link PdfDiv#layout(PdfContentByte, boolean, boolean, float, float, float, float)}
was already called.
@return the actual height the div would require to layout it's content
IMPROTANT NOTE: be careful with this method because it would return correct result
only in case if {@link PdfDiv#layout(PdfContentByte, boolean, boolean, float, float, float, float)}
was already called.
@return the actual width the div would require to layout it's content
Image will be scaled to fit in the div occupied area.
@see com.itextpdf.text.Element#isContent()
@since iText 2.0.8
@see com.itextpdf.text.Element#isNestable()
@since iText 2.0.8
Processes the element by adding it (or the different parts) to an
ElementListener
.
@param listener an ElementListener
@return true
if the element was processed successfully
Gets all the chunks in this element.
@return an ArrayList
Gets the type of the text element.
@return a type
A signature field lock dictionary.
Creates a signature lock valid for all fields in the document.
Creates a signature lock for all fields in the document,
setting specific permissions.
Creates a signature lock for specific fields in the document.
Creates a signature lock for specific fields in the document.
Enumerates the different actions of a signature lock.
Indicates the set of fields that should be locked:
all the fields in the document,
all the fields specified in the /Fields array
all the fields except those specified in the /Fields array
Enumerates the different levels of permissions.
Add kid to structureTreeRoot from structTreeRoot
Class containing static methods that allow you to get information from
an X509 Certificate: the issuer and the subject.
Get the issuer fields from an X509 Certificate
@param cert an X509Certificate
@return an X509Name
Get the "issuer" from the TBSCertificate bytes that are passed in
@param enc a TBSCertificate in a byte array
@return a DERObject
Get the subject fields from an X509 Certificate
@param cert an X509Certificate
@return an X509Name
Get the "subject" from the TBSCertificate bytes that are passed in
@param enc A TBSCertificate in a byte array
@return a DERObject
a class that holds an X509 name
country code - StringType(SIZE(2))
organization - StringType(SIZE(1..64))
organizational unit name - StringType(SIZE(1..64))
Title
common name - StringType(SIZE(1..64))
device serial number name - StringType(SIZE(1..64))
locality name - StringType(SIZE(1..64))
state, or province name - StringType(SIZE(1..64))
Naming attribute of type X520name
Naming attribute of type X520name
Naming attribute of type X520name
Naming attribute of type X520name
Naming attribute of type X520name
email address in Verisign certificates
object identifier
LDAP User id.
A Hashtable with default symbols
A Hashtable with values
Constructs an X509 name
@param seq an Asn1 Sequence
Constructs an X509 name
@param dirName a directory name
gets a field array from the values Hashmap
@param name
@return an ArrayList
getter for values
@return a Hashtable with the fields of the X509 name
@see java.lang.Object#toString()
class for breaking up an X500 Name into it's component tokens, ala
java.util.StringTokenizer. We need this class as some of the
lightweight Java environment don't support classes like
StringTokenizer.
This class contains a series of static methods that
allow you to retrieve information from a Certificate.
Gets the URL of the Certificate Revocation List for a Certificate
@param certificate the Certificate
@return the String where you can check if the certificate was revoked
@throws CertificateParsingException
@throws IOException
Retrieves the OCSP URL from the given certificate.
@param certificate the certificate
@return the URL or null
@throws IOException
Gets the URL of the TSA if it's available on the certificate
@param certificate a certificate
@return a TSA URL
@throws IOException
@param certificate the certificate from which we need the ExtensionValue
@param oid the Object Identifier value for the extension.
@return the extension value as an ASN1Primitive object
@throws IOException
Gets a String from an ASN1Primitive
@param names the ASN1Primitive
@return a human-readable String
@throws IOException
This class consists of some methods that allow you to verify certificates.
Verifies a single certificate.
@param cert the certificate to verify
@param crls the certificate revocation list or null
@param calendar the date or null
for the current date
@return a String
with the error description or null
if no error
Verifies a certificate chain against a KeyStore.
@param certs the certificate chain
@param keystore the KeyStore
@param crls the certificate revocation list or null
@param calendar the date or null
for the current date
@return null
if the certificate chain could be validated or a
Object[]{cert,error}
where cert
is the
failed certificate and error
is the error message
Verifies a certificate chain against a KeyStore.
@param certs the certificate chain
@param keystore the KeyStore
@param calendar the date or null
for the current date
@return null
if the certificate chain could be validated or a
Object[]{cert,error}
where cert
is the
failed certificate and error
is the error message
Verifies an OCSP response against a KeyStore.
@param ocsp the OCSP response
@param keystore the KeyStore
@param provider the provider or null
to use the BouncyCastle provider
@return true
is a certificate was found
Verifies a time stamp against a KeyStore.
@param ts the time stamp
@param keystore the KeyStore
@param provider the provider or null
to use the BouncyCastle provider
@return true
is a certificate was found
The previous CertificateVerifier in the chain of verifiers.
Indicates if going online to verify a certificate is allowed.
Creates the CertificateVerifier in a chain of verifiers.
@param verifier the previous verifier in the chain
Checks the validity of the certificate, and calls the next
verifier in the chain, if any.
@param signCert the certificate that needs to be checked
@param issuerCert its issuer
@param signDate the date the certificate needs to be valid
@return a list of VerificationOK
objects.
The list will be empty if the certificate couldn't be verified.
@throws GeneralSecurityException
@throws IOException
Decide whether or not online checking is allowed.
@param onlineCheckingAllowed
An implementation of the CrlClient that handles offline
Certificate Revocation Lists.
@author Paulo Soares
Interface that needs to be implemented if you want to embed
Certificate Revocation Lists into your PDF.
@author Paulo Soares
Gets a collection of byte array each representing a crl.
@param checkCert the certificate from which a CRL URL can be obtained
@param url a CRL url if you don't want to obtain it from the certificate
@return a collection of byte array each representing a crl. It may return null or an empty collection
The CRL as a byte array.
Creates an instance of a CrlClient in case you
have a local cache of the Certificate Revocation List.
@param crlEncoded the CRL bytes
Returns the CRL bytes (the parameters are ignored).
@see com.itextpdf.text.pdf.security.CrlClient#getEncoded(java.security.cert.X509Certificate, java.lang.String)
An implementation of the CrlClient that fetches the CRL bytes
from an URL.
@author Paulo Soares
The Logger instance.
The URLs of the CRLs.
Creates a CrlClientOnline instance that will try to find
a single CRL by walking through the certificate chain.
Creates a CrlClientOnline instance using one or more URLs.
Creates a CrlClientOnline instance using a certificate chain.
Adds an URL to the list of CRL URLs
@param url an URL in the form of a String
Fetches the CRL bytes from an URL.
If no url is passed as parameter, the url will be obtained from the certificate.
If you want to load a CRL from a local file, subclass this method and pass an
URL with the path to the local file to this method. An other option is to use
the CrlClientOffline class.
@see com.itextpdf.text.pdf.security.CrlClient#getEncoded(java.security.cert.X509Certificate, java.lang.String)
The Logger instance
A key store against which certificates can be verified.
Creates a RootStoreVerifier in a chain of verifiers.
@param verifier
the next verifier in the chain
Verifies a single certificate against a key store (if present).
@param signCert
the certificate to verify
@param issuerCert
the issuer certificate
@param signDate
the date the certificate needs to be valid
@return a list of VerificationOK
objects.
The list will be empty if the certificate couldn't be verified.
Sets the Key Store against which a certificate can be checked.
@param keyStore
a root store
The Logger instance
The list of CRLs to check for revocation date.
Creates a CRLVerifier instance.
@param verifier the next verifier in the chain
@param crls a list of CRLs
Verifies if a a valid CRL is found for the certificate.
If this method returns false, it doesn't mean the certificate isn't valid.
It means we couldn't verify it against any CRL that was available.
@param signCert the certificate that needs to be checked
@param issuerCert its issuer
@return a list of VerificationOK
objects.
The list will be empty if the certificate couldn't be verified.
@see com.itextpdf.text.pdf.security.RootStoreVerifier#verify(java.security.cert.X509Certificate, java.security.cert.X509Certificate, java.util.Date)
Verifies a certificate against a single CRL.
@param crl the Certificate Revocation List
@param signCert a certificate that needs to be verified
@param issuerCert its issuer
@param signDate the sign date
@return true if the verification succeeded
@throws GeneralSecurityException
Fetches a CRL for a specific certificate online (without further checking).
@param signCert the certificate
@param issuerCert its issuer
@return an X509CRL object
Checks if a CRL verifies against the issuer certificate or a trusted anchor.
@param crl the CRL
@param crlIssuer the trusted anchor
@return true if the CRL can be trusted
Class that contains a map with the different message digest algorithms.
Algorithm available for signatures since PDF 1.3
Algorithm available for signatures since PDF 1.6
Algorithm available for signatures since PDF 1.7
Algorithm available for signatures since PDF 1.7
Algorithm available for signatures since PDF 1.7
Maps the digest IDs with the human-readable name of the digest algorithm.
Maps the name of a digest algorithm with its ID.
Creates a MessageDigest object that can be used to create a hash.
@param hashAlgorithm the algorithm you want to use to create a hash
@param provider the provider you want to use to create the hash
@return a MessageDigest object
@throws NoSuchAlgorithmException
@throws NoSuchProviderException
@throws GeneralSecurityException
Creates a hash using a specific digest algorithm and a provider.
@param data the message of which you want to create a hash
@param hashAlgorithm the algorithm used to create the hash
@param provider the provider used to create the hash
@return the hash
@throws GeneralSecurityException
@throws IOException
Gets the digest name for a certain id
@param oid an id (for instance "1.2.840.113549.2.5")
@return a digest name (for instance "MD5")
Returns the id of a digest algorithms that is allowed in PDF,
or null if it isn't allowed.
@param name the name of the digest algorithm
@return an oid
Class that contains a map with the different encryption algorithms.
Maps IDs of encryption algorithms with its human-readable name.
Gets the algorithm name for a certain id.
@param oid an id (for instance "1.2.840.113549.1.1.1")
@return an algorithm name (for instance "RSA")
@since 2.1.6
Interface for the OCSP Client.
@since 2.1.6
* Gets an encoded byte array with OCSP validation. The method should not throw an exception.
* @param checkCert to certificate to check
* @param rootCert the parent certificate
* @param url the url to get the verification. It it's null it will be taken
* from the check cert or from other implementation specific source
* @return a byte array with the validation or null if the validation could not be obtained
Get the time stamp token size estimate.
Implementation must return value large enough to accomodate the entire token
returned by getTimeStampToken() _prior_ to actual getTimeStampToken() call.
@return an estimate of the token size
Gets the MessageDigest to digest the data imprint
@return the digest algorithm name
Get RFC 3161 timeStampToken.
Method may return null indicating that timestamp should be skipped.
@param imprint byte[] - data imprint to be time-stamped
@return byte[] - encoded, TSA signed data of the timeStampToken
@throws Exception - TSA request failed
PAdES-LTV Timestamp
@author Pulo Soares
Signs a document with a PAdES-LTV Timestamp. The document is closed at the end.
@param sap the signature appearance
@param tsa the timestamp generator
@param signatureName the signature name or null to have a name generated
automatically
@throws Exception
Add verification according to PAdES-LTV (part 4)
@author psoares
The verification constructor. This class should only be created with
PdfStamper.getLtvVerification() otherwise the information will not be
added to the Pdf.
@param stp the PdfStamper to apply the validation to
Add verification for a particular signature
@param signatureName the signature to validate (it may be a timestamp)
@param ocsp the interface to get the OCSP
@param crl the interface to get the CRL
@param certOption
@param level the validation options to include
@param certInclude
@return true if a validation was generated, false otherwise
@throws Exception
Returns the issuing certificate for a child certificate.
@param cert the certificate for which we search the parent
@param certs an array with certificates that contains the parent
@return the partent certificate
Alternative addVerification.
I assume that inputs are deduplicated.
@throws IOException
@throws GeneralSecurityException
Merges the validation with any validation already in the document or creates
a new one.
@throws IOException
What type of verification to include
Include only OCSP
Include only CRL
Include both OCSP and CRL
Include CRL only if OCSP can't be read
Options for how many certificates to include
Include verification just for the signing certificate
Include verification for the whole chain of certificates
Certificate inclusion in the DSS and VRI dictionaries in the CERT and CERTS
keys
Include certificates in the DSS and VRI dictionaries
Do not include certificates in the DSS and VRI dictionaries
The Logger instance
Do we need to check all certificate, or only the signing certificate?
Verify root.
A reader object for the revision that is being verified.
The fields in the revision that is being verified.
The date the revision was signed, or null
for the highest revision.
The signature that covers the revision.
The PdfPKCS7 object for the signature.
Indicates if we're working with the latest revision.
The document security store for the revision that is being verified
Creates a VerificationData object for a PdfReader
@param reader a reader for the document we want to verify.
@throws GeneralSecurityException
Checks if the signature covers the whole document
and throws an exception if the document was altered
@return a PdfPKCS7 object
@throws GeneralSecurityException
Verifies all the document-level timestamps and all the signatures in the document.
@throws IOException
@throws GeneralSecurityException
Verifies a document level timestamp.
@throws GeneralSecurityException
@throws IOException
Checks the certificates in a certificate chain:
are they valid on a specific date, and
do they chain up correctly?
@param chain
@throws GeneralSecurityException
Verifies certificates against a list of CRLs and OCSP responses.
@param signingCert
@param issuerCert
@return a list of VerificationOK
objects.
The list will be empty if the certificate couldn't be verified.
@throws GeneralSecurityException
@throws IOException
@see com.itextpdf.text.pdf.security.RootStoreVerifier#verify(java.security.cert.X509Certificate, java.security.cert.X509Certificate)
Switches to the previous revision.
@throws IOException
@throws GeneralSecurityException
Gets a list of X509CRL objects from a Document Security Store.
@return a list of CRLs
@throws GeneralSecurityException
@throws IOException
Gets OCSP responses from the Document Security Store.
@return a list of BasicOCSPResp objects
@throws IOException
@throws GeneralSecurityException
Sets an extra verifier.
@param verifier the verifier to set
Sets the certificate option.
@param option Either CertificateOption.SIGNING_CERTIFICATE (default) or CertificateOption.WHOLE_CHAIN
Set the verifyRootCertificate to false if you can't verify the root certificate.
Class that signs your PDF.
@author Paulo Soares
The Logger instance.
Signs the document using the detached mode, CMS or CAdES equivalent.
@param sap the PdfSignatureAppearance
@param externalSignature the interface providing the actual signing
@param chain the certificate chain
@param crlList the CRL list
@param ocspClient the OCSP client
@param tsaClient the Timestamp client
@param provider the provider or null
@param estimatedSize the reserved size for the signature. It will be estimated if 0
@param cades true to sign CAdES equivalent PAdES-BES, false to sign CMS
@throws DocumentException
@throws IOException
@throws GeneralSecurityException
@throws NoSuchAlgorithmException
@throws Exception
Signs the document using the detached mode, CMS or CAdES equivalent.
@param sap the PdfSignatureAppearance
@param externalSignature the interface providing the actual signing
@param chain the certificate chain
@param crlList the CRL list
@param ocspClient the OCSP client
@param tsaClient the Timestamp client
@param provider the provider or null
@param estimatedSize the reserved size for the signature. It will be estimated if 0
@param cades true to sign CAdES equivalent PAdES-BES, false to sign CMS
@param signaturePolicy the signature policy (for EPES signatures)
@throws DocumentException
@throws IOException
@throws GeneralSecurityException
@throws NoSuchAlgorithmException
@throws Exception
Signs the document using the detached mode, CMS or CAdES equivalent.
@param sap the PdfSignatureAppearance
@param externalSignature the interface providing the actual signing
@param chain the certificate chain
@param crlList the CRL list
@param ocspClient the OCSP client
@param tsaClient the Timestamp client
@param provider the provider or null
@param estimatedSize the reserved size for the signature. It will be estimated if 0
@param cades true to sign CAdES equivalent PAdES-BES, false to sign CMS
@param signaturePolicy the signature policy (for EPES signatures)
@throws DocumentException
@throws IOException
@throws GeneralSecurityException
@throws NoSuchAlgorithmException
@throws Exception
Processes a CRL list.
@param cert a Certificate if one of the CrlList implementations needs to retrieve the CRL URL from it.
@param crlList a list of CrlClient implementations
@return a collection of CRL bytes that can be embedded in a PDF.
Sign the document using an external container, usually a PKCS7. The signature is fully composed
externally, iText will just put the container inside the document.
@param sap the PdfSignatureAppearance
@param externalSignatureContainer the interface providing the actual signing
@param estimatedSize the reserved size for the signature
@throws GeneralSecurityException
@throws IOException
@throws DocumentException
Signs a PDF where space was already reserved.
@param reader the original PDF
@param fieldName the field to sign. It must be the last field
@param outs the output PDF
@param externalSignatureContainer the signature container doing the actual signing. Only the
method ExternalSignatureContainer.sign is used
@throws DocumentException
@throws IOException
@throws GeneralSecurityException
OcspClient implementation using BouncyCastle.
@author Paulo Soares
Create default implemention of {@code OcspClient}.
Note, if you use this constructor, OCSP response will not be verified.
Create {@code OcspClient}
@param verifier will be used for response verification. {@see OCSPVerifier}.
Gets OCSP response. If {@see OCSPVerifier} was set, the response will be checked.
Gets an encoded byte array with OCSP validation. The method should not throw an exception.
@param checkCert to certificate to check
@param rootCert the parent certificate
@param url to get the verification. It it's null it will be taken
from the check cert or from other implementation specific source
@return a byte array with the validation or null if the validation could not be obtained
Generates an OCSP request using BouncyCastle.
@param issuerCert certificate of the issues
@param serialNumber serial number
@return an OCSP request
@throws OCSPException
@throws IOException
The Logger instance
The list of OCSP responses.
Creates an OCSPVerifier instance.
@param verifier the next verifier in the chain
@param ocsps a list of OCSP responses
Verifies if a a valid OCSP response is found for the certificate.
If this method returns false, it doesn't mean the certificate isn't valid.
It means we couldn't verify it against any OCSP response that was available.
@param signCert the certificate that needs to be checked
@param issuerCert its issuer
@return a list of VerificationOK
objects.
The list will be empty if the certificate couldn't be verified.
@see com.itextpdf.text.pdf.security.RootStoreVerifier#verify(java.security.cert.X509Certificate, java.security.cert.X509Certificate, java.util.Date)
Verifies a certificate against a single OCSP response
@param ocspResp the OCSP response
@param signCert the certificate that needs to be checked
@param issuerCert the certificate of CA
@param signDate sign date
@return {@code true}, in case successful check, otherwise false.
@throws GeneralSecurityException
@throws IOException
Verifies if an OCSP response is genuine
If it doesn't verify against the issuer certificate and response's certificates, it may verify
using a trusted anchor or cert.
@param ocspResp the OCSP response
@param issuerCert the issuer certificate
@throws GeneralSecurityException
@throws IOException
Verifies if the response is valid.
If it doesn't verify against the issuer certificate and response's certificates, it may verify
using a trusted anchor or cert.
NOTE. Use {@code isValidResponse()} instead.
@param ocspResp the response object
@param issuerCert the issuer certificate
@return true if the response can be trusted
Checks if an OCSP response is genuine
@param ocspResp the OCSP response
@param responderCert the responder certificate
@return true if the OCSP response verifies against the responder certificate
Gets an OCSP response online and returns it if the status is GOOD
(without further checking).
@param signCert the signing certificate
@param issuerCert the issuer certificate
@return an OCSP response
This class does all the processing related to signing
and verifying a PKCS#7 signature.
Assembles all the elements needed to create a signature, except for the data.
@param privKey the private key
@param certChain the certificate chain
@param interfaceDigest the interface digest
@param hashAlgorithm the hash algorithm
@param provider the provider or null
for the default provider
@param hasRSAdata true
if the sub-filter is adbe.pkcs7.sha1
@throws InvalidKeyException on error
@throws NoSuchProviderException on error
@throws NoSuchAlgorithmException on error
Use this constructor if you want to verify a signature using the sub-filter adbe.x509.rsa_sha1.
@param contentsKey the /Contents key
@param certsKey the /Cert key
Use this constructor if you want to verify a signature.
@param contentsKey the /Contents key
@param filterSubtype the filtersubtype
@param provider the provider or null
for the default provider
Holds value of property signName.
Holds value of property reason.
Holds value of property location.
Holds value of property signDate.
Version of the PKCS#7 object
Version of the PKCS#7 "SignerInfo" object.
The ID of the digest algorithm, e.g. "2.16.840.1.101.3.4.2.1".
The object that will create the digest
The digest algorithms
The digest attributes
Returns the name of the digest algorithm, e.g. "SHA256".
@return the digest algorithm name, e.g. "SHA256"
The encryption algorithm.
Get the algorithm used to calculate the message digest, e.g. "SHA1withRSA".
@return the algorithm used to calculate the message digest
The signed digest if created outside this class
External RSA data
Sets the digest/signature to an external calculated value.
@param digest the digest. This is the actual signature
@param RSAdata the extra data that goes into the data tag in PKCS#7
@param digestEncryptionAlgorithm the encryption algorithm. It may must be null
if the digest
is also null
. If the digest
is not null
then it may be "RSA" or "DSA"
Class from the Java SDK that provides the functionality of a digital signature algorithm.
The signed digest as calculated by this class (or extracted from an existing PDF)
The RSA data
Update the digest with the specified bytes.
This method is used both for signing and verifying
@param buf the data buffer
@param off the offset in the data buffer
@param len the data length
@throws SignatureException on error
Gets the bytes for the PKCS#1 object.
@return a byte array
Gets the bytes for the PKCS7SignedData object.
@return the bytes for the PKCS7SignedData object
Gets the bytes for the PKCS7SignedData object. Optionally the authenticatedAttributes
in the signerInfo can also be set. If either of the parameters is null
, none will be used.
@param secondDigest the digest in the authenticatedAttributes
@return the bytes for the PKCS7SignedData object
Gets the bytes for the PKCS7SignedData object. Optionally the authenticatedAttributes
in the signerInfo can also be set, OR a time-stamp-authority client
may be provided.
@param secondDigest the digest in the authenticatedAttributes
@param tsaClient TSAClient - null or an optional time stamp authority client
@return byte[] the bytes for the PKCS7SignedData object
@since 2.1.6
Added by Aiken Sam, 2006-11-15, modifed by Martin Brunecky 07/12/2007
to start with the timeStampToken (signedData 1.2.840.113549.1.7.2).
Token is the TSA response without response status, which is usually
handled by the (vendor supplied) TSA request/response interface).
@param timeStampToken byte[] - time stamp token, DER encoded signedData
@return ASN1EncodableVector
@throws IOException
This method provides that encoding and the parameters must be
exactly the same as in {@link #getEncodedPKCS7(byte[],Calendar)}.
@param secondDigest the content digest
@return the byte array representation of the authenticatedAttributes ready to be signed
Signature attributes
Signature attributes (maybe not necessary, but we use it as fallback)
encrypted digest
Indicates if a signature has already been verified
The result of the verification
Verify the digest.
@throws SignatureException on error
@return true
if the signature checks out, false
otherwise
Checks if the timestamp refers to this document.
@throws java.security.NoSuchAlgorithmException on error
@return true if it checks false otherwise
@since 2.1.6
All the X.509 certificates in no particular order.
All the X.509 certificates used for the main signature.
The X.509 certificate that is used to sign the digest.
Helper method that creates the collection of certificates
used for the main signature based on the complete list
of certificates and the sign certificate.
Helper method that tries to construct the CRLs.
BouncyCastle BasicOCSPResp
Checks if OCSP revocation refers to the document signing certificate.
@return true if it checks, false otherwise
@since 2.1.6
Helper method that creates the BasicOCSPResp object.
@param seq
@throws IOException
True if there's a PAdES LTV time stamp.
BouncyCastle TimeStampToken.
Returns the filter subtype.
Returns the encryption algorithm
@return the name of an encryption algorithm
Getter/setter for property sigName.
@return Value of property sigName.
Getter for property reason.
@return Value of property reason.
Getter for property location.
@return Value of property location.
Getter for property signDate.
@return Value of property signDate.
Get the version of the PKCS#7 object.
@return the version of the PKCS#7 object.
Get the version of the PKCS#7 "SignerInfo" object.
@return the version of the PKCS#7 "SignerInfo" object.
Getter for the ID of the digest algorithm, e.g. "2.16.840.1.101.3.4.2.1"
Getter for the digest encryption algorithm
Get all the X.509 certificates associated with this PKCS#7 object in no particular order.
Other certificates, from OCSP for example, will also be included.
@return the X.509 certificates associated with this PKCS#7 object
Get the X.509 sign certificate chain associated with this PKCS#7 object.
Only the certificates used for the main signature will be returned, with
the signing certificate first.
@return the X.509 certificates associated with this PKCS#7 object
@since 2.1.6
Get the X.509 certificate actually used to sign the digest.
@return the X.509 certificate actually used to sign the digest
Get the X.509 certificate revocation lists associated with this PKCS#7 object
@return the X.509 certificate revocation lists associated with this PKCS#7 object
Gets the OCSP basic response if there is one.
@return the OCSP basic response or null
@since 2.1.6
Check if it's a PAdES-LTV time stamp.
@return true if it's a PAdES-LTV time stamp, false otherwise
Gets the timestamp token if there is one.
@return the timestamp token or null
@since 2.1.6
Gets the timestamp date
@return a date
@since 2.1.6
Implementation of the ExternalSignature interface that can be used
when you have a PrivateKey object.
@author Paulo Soares
The private key object.
The hash algorithm.
The encryption algorithm (obtained from the private key)
Creates an ExternalSignature instance
@param pk a PrivateKey object
@param hashAlgorithm the hash algorithm (e.g. "SHA-1", "SHA-256",...)
@param provider the security provider (e.g. "BC")
Creates a message digest using the hash algorithm
and signs it using the encryption algorithm.
@param message the message you want to be hashed and signed
@return a signed message digest
@see com.itextpdf.text.pdf.security.ExternalSignature#sign(byte[])
Returns the hash algorithm.
@return the hash algorithm (e.g. "SHA-1", "SHA-256,...")
@see com.itextpdf.text.pdf.security.ExternalSignature#getHashAlgorithm()
Returns the encryption algorithm used for signing.
@return the encryption algorithm ("RSA" or "DSA")
@see com.itextpdf.text.pdf.security.ExternalSignature#getEncryptionAlgorithm()
A list of IDs that are used by the security classes
Is the signature a cerification signature (true) or an approval signature (false)?
Is form filling allowed by this signature?
Is adding annotations allowed by this signature?
Does this signature lock specific fields?
Creates an object that can inform you about the type of signature
in a signature dictionary as well as some of the permissions
defined by the signature.
Getter to find out if the signature is a certification signature.
@return true if the signature is a certification signature, false for an approval signature.
Getter to find out if filling out fields is allowed after signing.
@return true if filling out fields is allowed
Getter to find out if adding annotations is allowed after signing.
@return true if adding annotations is allowed
Getter for the field lock actions, and fields that are impacted by the action
@return an Array with field names
Class that contains a field lock action and
an array of the fields that are involved.
Can be /All, /Exclude or /Include
An array of PdfString values with fieldnames
Creates a FieldLock instance
toString method
Getter for the field lock action.
Getter for the fields involved in the lock action.
Time Stamp Authority Client interface implementation using Bouncy Castle
org.bouncycastle.tsp package.
Created by Aiken Sam, 2006-11-15, refactored by Martin Brunecky, 07/15/2007
for ease of subclassing.
@since 2.1.6
The default value for the hash algorithm
The default value for the hash algorithm
The Logger instance.
URL of the Time Stamp Authority
TSA Username
TSA password
An interface that allows you to inspect the timestamp info.
Estimate of the received time stamp token
Hash algorithm
TSA request policy
Creates an instance of a TSAClient that will use BouncyCastle.
@param url String - Time Stamp Authority URL (i.e. "http://tsatest1.digistamp.com/TSA")
Creates an instance of a TSAClient that will use BouncyCastle.
@param url String - Time Stamp Authority URL (i.e. "http://tsatest1.digistamp.com/TSA")
@param username String - user(account) name
@param password String - password
Constructor.
Note the token size estimate is updated by each call, as the token
size is not likely to change (as long as we call the same TSA using
the same imprint length).
@param url String - Time Stamp Authority URL (i.e. "http://tsatest1.digistamp.com/TSA")
@param username String - user(account) name
@param password String - password
@param tokSzEstimate int - estimated size of received time stamp token (DER encoded)
@param tsaInfo the tsaInfo to set
Get the token size estimate.
Returned value reflects the result of the last succesfull call, padded
@return an estimate of the token size
Gets the MessageDigest to digest the data imprint
@return the digest algorithm name
Get RFC 3161 timeStampToken.
Method may return null indicating that timestamp should be skipped.
@param imprint data imprint to be time-stamped
@return encoded, TSA signed data of the timeStampToken
Get timestamp token - communications layer
@return - byte[] - TSA response, raw bytes (RFC 3161 encoded)
Interface you can implement and pass to TSAClientBouncyCastle in case
you want to do something with the information returned
When a timestamp is created using TSAClientBouncyCastle,
this method is triggered passing an object that contains
info about the timestamp and the time stamping authority.
@param info a TimeStampTokenInfo object
An exception that is thrown when something is wrong with a certificate.
Creates a VerificationException
The certificate that was verified successfully.
The CertificateVerifier that was used for verifying.
The reason why the certificate verified successfully.
Creates a VerificationOK object
@param certificate the certificate that was successfully verified
@param verifierClass the class that was used for verification
@param message the reason why the certificate could be verified
A single String explaining which certificate was verified, how and why.
@see java.lang.Object#toString()
Creates a signature using a X509Certificate2. It supports smartcards without
exportable private keys.
The certificate with the private key
The hash algorithm.
The encryption algorithm (obtained from the private key)
Creates a signature using a X509Certificate2. It supports smartcards without
exportable private keys.
The certificate with the private key
The hash algorithm for the signature. As the Windows CAPI is used
to do the signature the only hash guaranteed to exist is SHA-1
Returns the hash algorithm.
@return the hash algorithm (e.g. "SHA-1", "SHA-256,...")
@see com.itextpdf.text.pdf.security.ExternalSignature#getHashAlgorithm()
Returns the encryption algorithm used for signing.
@return the encryption algorithm ("RSA" or "DSA")
@see com.itextpdf.text.pdf.security.ExternalSignature#getEncryptionAlgorithm()
This class contains version information about iText.
DO NOT CHANGE THE VERSION INFORMATION WITHOUT PERMISSION OF THE COPYRIGHT HOLDERS OF ITEXT.
Changing the version makes it extremely difficult to debug an application.
Also, the nature of open source software is that you honor the copyright of the original creators of the software.
String that will indicate if the AGPL version is used.
The iText version instance.
This String contains the name of the product.
iText is a registered trademark by iText Group NV.
Please don't change this constant.
This String contains the version number of this iText release.
For debugging purposes, we request you NOT to change this constant.
This String contains the iText version as shown in the producer line.
iText is a product developed by iText Group NV.
iText Group requests that you retain the iText producer line
in every PDF that is created or manipulated using iText.
The license key.
Gets an instance of the iText version that is currently used.
Note that iText Group requests that you retain the iText producer line
in every PDF that is created or manipulated using iText.
* Gets the product name.
* iText Group requests that you retain the iText producer line
* in every PDF that is created or manipulated using iText.
* @return the product name
* Gets the release number.
* iText Group requests that you retain the iText producer line
* in every PDF that is created or manipulated using iText.
* @return the release number
* Returns the iText version as shown in the producer line.
* iText is a product developed by iText Group NV.
* iText Group requests that you retain the iText producer line
* in every PDF that is created or manipulated using iText.
* @return iText version
Returns a license key if one was provided, or null if not.
@return a license key.
Checks if the AGPL version is used.
@return returns true if the AGPL version is used.
An element that is not an element, it holds {@link Element#WRITABLE_DIRECT}
as Element type. It implements WriterOperation to do operations on the
{@link PdfWriter} and the {@link Document} that must be done at the time of
the writing. Much like a {@link VerticalPositionMark} but little different.
@author itextpdf.com
@return {@link Element#WRITABLE_DIRECT}
This {@link NewLineHandler} returns true on the tags p
,
blockqoute
and br
@author Balder
A NewLineHandler determines if an encountered tag should result in a new line
in a document.
@author Balder
@since 5.0.6
@param tag the tag to check if after this one a new line should be in a document
@return true in case a new line should be added.
@since 5.0.6
Default constructor
@since 5.0.6
Always returns false.
@author Balder
@since 5.0.6
@author psoares
Print writer.
Canonical output.
Processing XML 1.1 document.
Default constructor.
Sets whether output is canonical.
Sets the output stream for printing.
Sets the output writer.
Writes the specified node, recursively.
Returns a sorted list of attributes.
Normalizes and prints the given string.
Normalizes and print the given character.
This class converts XML into plain text stripping all tags.
Buffer that stores all content that is encountered.
Static method that parses an XML Stream.
@param is the XML input that needs to be parsed
@return a String obtained by removing all tags from the XML
Creates an instance of XML to TXT.
@return the String after parsing.
@see com.itextpdf.text.xml.simpleparser.SimpleXMLDocHandler#startElement(java.lang.String, java.util.Map)
@see com.itextpdf.text.xml.simpleparser.SimpleXMLDocHandler#endElement(java.lang.String)
@see com.itextpdf.text.xml.simpleparser.SimpleXMLDocHandler#startDocument()
@see com.itextpdf.text.xml.simpleparser.SimpleXMLDocHandler#endDocument()
@see com.itextpdf.text.xml.simpleparser.SimpleXMLDocHandler#text(java.lang.String)
Contains utility methods for XML.
@author Balder
@since 5.0.6
Escapes a string with the appropriated XML codes.
@param s the string to be escaped
@param onlyASCII codes above 127 will always be escaped with &#nn; if true
@return the escaped string
@since 5.0.6
Unescapes 'lt', 'gt', 'apos', 'quote' and 'amp' to the
corresponding character values.
@param s a string representing a character
@return a character value
Checks if a character value should be escaped/unescaped.
@param s the String representation of an integer
@return true if it's OK to escape or unescape this value
Checks if a character value should be escaped/unescaped.
@param c a character value
@return true if it's OK to escape or unescape this value
Looks for a character in a character array, starting from a certain position
@param needle the character you're looking for
@param haystack the character array
@param start the start position
@return the position where the character was found, or -1 if it wasn't found.
Returns the IANA encoding name that is auto-detected from
the bytes specified, with the endian-ness of that encoding where appropriate.
(method found in org.apache.xerces.impl.XMLEntityManager, originally published
by the Apache Software Foundation under the Apache Software License; now being
used in iText under the MPL)
@param b4 The first four bytes of the input.
@return an IANA-encoding string
@since 5.0.6
CAKeyUpdAnnContent ::= SEQUENCE {
oldWithNew CmpCertificate, -- old pub signed with new priv
newWithOld CmpCertificate, -- new pub signed with old priv
newWithNew CmpCertificate -- new pub signed with new priv
}
@return a basic ASN.1 object representation.
CertConfirmContent ::= SEQUENCE OF CertStatus
@return a basic ASN.1 object representation.
CertifiedKeyPair ::= SEQUENCE {
certOrEncCert CertOrEncCert,
privateKey [0] EncryptedValue OPTIONAL,
-- see [CRMF] for comment on encoding
publicationInfo [1] PKIPublicationInfo OPTIONAL
}
@return a basic ASN.1 object representation.
CertOrEncCert ::= CHOICE {
certificate [0] CMPCertificate,
encryptedCert [1] EncryptedValue
}
@return a basic ASN.1 object representation.
CertRepMessage ::= SEQUENCE {
caPubs [1] SEQUENCE SIZE (1..MAX) OF CMPCertificate
OPTIONAL,
response SEQUENCE OF CertResponse
}
@return a basic ASN.1 object representation.
CertResponse ::= SEQUENCE {
certReqId INTEGER,
-- to match this response with corresponding request (a value
-- of -1 is to be used if certReqId is not specified in the
-- corresponding request)
status PKIStatusInfo,
certifiedKeyPair CertifiedKeyPair OPTIONAL,
rspInfo OCTET STRING OPTIONAL
-- analogous to the id-regInfo-utf8Pairs string defined
-- for regInfo in CertReqMsg [CRMF]
}
@return a basic ASN.1 object representation.
CertStatus ::= SEQUENCE {
certHash OCTET STRING,
-- the hash of the certificate, using the same hash algorithm
-- as is used to create and verify the certificate signature
certReqId INTEGER,
-- to match this confirmation with the corresponding req/rep
statusInfo PKIStatusInfo OPTIONAL
}
@return a basic ASN.1 object representation.
Challenge ::= SEQUENCE {
owf AlgorithmIdentifier OPTIONAL,
-- MUST be present in the first Challenge; MAY be omitted in
-- any subsequent Challenge in POPODecKeyChallContent (if
-- omitted, then the owf used in the immediately preceding
-- Challenge is to be used).
witness OCTET STRING,
-- the result of applying the one-way function (owf) to a
-- randomly-generated INTEGER, A. [Note that a different
-- INTEGER MUST be used for each Challenge.]
challenge OCTET STRING
-- the encryption (under the public key for which the cert.
-- request is being made) of Rand, where Rand is specified as
-- Rand ::= SEQUENCE {
-- int INTEGER,
-- - the randomly-generated INTEGER A (above)
-- sender GeneralName
-- - the sender's name (as included in PKIHeader)
-- }
}
@return a basic ASN.1 object representation.
Note: the addition of attribute certificates is a BC extension.
CMPCertificate ::= CHOICE {
x509v3PKCert Certificate
x509v2AttrCert [1] AttributeCertificate
}
Note: the addition of attribute certificates is a BC extension.
@return a basic ASN.1 object representation.
CrlAnnContent ::= SEQUENCE OF CertificateList
@return a basic ASN.1 object representation.
ErrorMsgContent ::= SEQUENCE {
pKIStatusInfo PKIStatusInfo,
errorCode INTEGER OPTIONAL,
-- implementation-specific error codes
errorDetails PKIFreeText OPTIONAL
-- implementation-specific error details
}
@return a basic ASN.1 object representation.
GenMsgContent ::= SEQUENCE OF InfoTypeAndValue
@return a basic ASN.1 object representation.
GenRepContent ::= SEQUENCE OF InfoTypeAndValue
@return a basic ASN.1 object representation.
Example InfoTypeAndValue contents include, but are not limited
to, the following (un-comment in this ASN.1 module and use as
appropriate for a given environment):
id-it-caProtEncCert OBJECT IDENTIFIER ::= {id-it 1}
CAProtEncCertValue ::= CMPCertificate
id-it-signKeyPairTypes OBJECT IDENTIFIER ::= {id-it 2}
SignKeyPairTypesValue ::= SEQUENCE OF AlgorithmIdentifier
id-it-encKeyPairTypes OBJECT IDENTIFIER ::= {id-it 3}
EncKeyPairTypesValue ::= SEQUENCE OF AlgorithmIdentifier
id-it-preferredSymmAlg OBJECT IDENTIFIER ::= {id-it 4}
PreferredSymmAlgValue ::= AlgorithmIdentifier
id-it-caKeyUpdateInfo OBJECT IDENTIFIER ::= {id-it 5}
CAKeyUpdateInfoValue ::= CAKeyUpdAnnContent
id-it-currentCRL OBJECT IDENTIFIER ::= {id-it 6}
CurrentCRLValue ::= CertificateList
id-it-unsupportedOIDs OBJECT IDENTIFIER ::= {id-it 7}
UnsupportedOIDsValue ::= SEQUENCE OF OBJECT IDENTIFIER
id-it-keyPairParamReq OBJECT IDENTIFIER ::= {id-it 10}
KeyPairParamReqValue ::= OBJECT IDENTIFIER
id-it-keyPairParamRep OBJECT IDENTIFIER ::= {id-it 11}
KeyPairParamRepValue ::= AlgorithmIdentifer
id-it-revPassphrase OBJECT IDENTIFIER ::= {id-it 12}
RevPassphraseValue ::= EncryptedValue
id-it-implicitConfirm OBJECT IDENTIFIER ::= {id-it 13}
ImplicitConfirmValue ::= NULL
id-it-confirmWaitTime OBJECT IDENTIFIER ::= {id-it 14}
ConfirmWaitTimeValue ::= GeneralizedTime
id-it-origPKIMessage OBJECT IDENTIFIER ::= {id-it 15}
OrigPKIMessageValue ::= PKIMessages
id-it-suppLangTags OBJECT IDENTIFIER ::= {id-it 16}
SuppLangTagsValue ::= SEQUENCE OF UTF8String
where
id-pkix OBJECT IDENTIFIER ::= {
iso(1) identified-organization(3)
dod(6) internet(1) security(5) mechanisms(5) pkix(7)}
and
id-it OBJECT IDENTIFIER ::= {id-pkix 4}
InfoTypeAndValue ::= SEQUENCE {
infoType OBJECT IDENTIFIER,
infoValue ANY DEFINED BY infoType OPTIONAL
}
@return a basic ASN.1 object representation.
KeyRecRepContent ::= SEQUENCE {
status PKIStatusInfo,
newSigCert [0] CMPCertificate OPTIONAL,
caCerts [1] SEQUENCE SIZE (1..MAX) OF
CMPCertificate OPTIONAL,
keyPairHist [2] SEQUENCE SIZE (1..MAX) OF
CertifiedKeyPair OPTIONAL
}
@return a basic ASN.1 object representation.
OobCertHash ::= SEQUENCE {
hashAlg [0] AlgorithmIdentifier OPTIONAL,
certId [1] CertId OPTIONAL,
hashVal BIT STRING
-- hashVal is calculated over the Der encoding of the
-- self-signed certificate with the identifier certID.
}
@return a basic ASN.1 object representation.
PbmParameter ::= SEQUENCE {
salt OCTET STRING,
-- note: implementations MAY wish to limit acceptable sizes
-- of this string to values appropriate for their environment
-- in order to reduce the risk of denial-of-service attacks
owf AlgorithmIdentifier,
-- AlgId for a One-Way Function (SHA-1 recommended)
iterationCount INTEGER,
-- number of times the OWF is applied
-- note: implementations MAY wish to limit acceptable sizes
-- of this integer to values appropriate for their environment
-- in order to reduce the risk of denial-of-service attacks
mac AlgorithmIdentifier
-- the MAC AlgId (e.g., DES-MAC, Triple-DES-MAC [PKCS11],
} -- or HMAC [RFC2104, RFC2202])
@return a basic ASN.1 object representation.
Creates a new PkiBody.
@param type one of the TYPE_* constants
@param content message content
PkiBody ::= CHOICE { -- message-specific body elements
ir [0] CertReqMessages, --Initialization Request
ip [1] CertRepMessage, --Initialization Response
cr [2] CertReqMessages, --Certification Request
cp [3] CertRepMessage, --Certification Response
p10cr [4] CertificationRequest, --imported from [PKCS10]
popdecc [5] POPODecKeyChallContent, --pop Challenge
popdecr [6] POPODecKeyRespContent, --pop Response
kur [7] CertReqMessages, --Key Update Request
kup [8] CertRepMessage, --Key Update Response
krr [9] CertReqMessages, --Key Recovery Request
krp [10] KeyRecRepContent, --Key Recovery Response
rr [11] RevReqContent, --Revocation Request
rp [12] RevRepContent, --Revocation Response
ccr [13] CertReqMessages, --Cross-Cert. Request
ccp [14] CertRepMessage, --Cross-Cert. Response
ckuann [15] CAKeyUpdAnnContent, --CA Key Update Ann.
cann [16] CertAnnContent, --Certificate Ann.
rann [17] RevAnnContent, --Revocation Ann.
crlann [18] CRLAnnContent, --CRL Announcement
pkiconf [19] PKIConfirmContent, --Confirmation
nested [20] NestedMessageContent, --Nested Message
genm [21] GenMsgContent, --General Message
genp [22] GenRepContent, --General Response
error [23] ErrorMsgContent, --Error Message
certConf [24] CertConfirmContent, --Certificate confirm
pollReq [25] PollReqContent, --Polling request
pollRep [26] PollRepContent --Polling response
}
@return a basic ASN.1 object representation.
PkiConfirmContent ::= NULL
@return a basic ASN.1 object representation.
Value for a "null" recipient or sender.
PkiHeader ::= SEQUENCE {
pvno INTEGER { cmp1999(1), cmp2000(2) },
sender GeneralName,
-- identifies the sender
recipient GeneralName,
-- identifies the intended recipient
messageTime [0] GeneralizedTime OPTIONAL,
-- time of production of this message (used when sender
-- believes that the transport will be "suitable"; i.e.,
-- that the time will still be meaningful upon receipt)
protectionAlg [1] AlgorithmIdentifier OPTIONAL,
-- algorithm used for calculation of protection bits
senderKID [2] KeyIdentifier OPTIONAL,
recipKID [3] KeyIdentifier OPTIONAL,
-- to identify specific keys used for protection
transactionID [4] OCTET STRING OPTIONAL,
-- identifies the transaction; i.e., this will be the same in
-- corresponding request, response, certConf, and PKIConf
-- messages
senderNonce [5] OCTET STRING OPTIONAL,
recipNonce [6] OCTET STRING OPTIONAL,
-- nonces used to provide replay protection, senderNonce
-- is inserted by the creator of this message; recipNonce
-- is a nonce previously inserted in a related message by
-- the intended recipient of this message
freeText [7] PKIFreeText OPTIONAL,
-- this may be used to indicate context-specific instructions
-- (this field is intended for human consumption)
generalInfo [8] SEQUENCE SIZE (1..MAX) OF
InfoTypeAndValue OPTIONAL
-- this may be used to convey context-specific information
-- (this field not primarily intended for human consumption)
}
@return a basic ASN.1 object representation.
PKIHeader ::= SEQUENCE {
pvno INTEGER { cmp1999(1), cmp2000(2) },
sender GeneralName,
-- identifies the sender
recipient GeneralName,
-- identifies the intended recipient
messageTime [0] GeneralizedTime OPTIONAL,
-- time of production of this message (used when sender
-- believes that the transport will be "suitable"; i.e.,
-- that the time will still be meaningful upon receipt)
protectionAlg [1] AlgorithmIdentifier OPTIONAL,
-- algorithm used for calculation of protection bits
senderKID [2] KeyIdentifier OPTIONAL,
recipKID [3] KeyIdentifier OPTIONAL,
-- to identify specific keys used for protection
transactionID [4] OCTET STRING OPTIONAL,
-- identifies the transaction; i.e., this will be the same in
-- corresponding request, response, certConf, and PKIConf
-- messages
senderNonce [5] OCTET STRING OPTIONAL,
recipNonce [6] OCTET STRING OPTIONAL,
-- nonces used to provide replay protection, senderNonce
-- is inserted by the creator of this message; recipNonce
-- is a nonce previously inserted in a related message by
-- the intended recipient of this message
freeText [7] PKIFreeText OPTIONAL,
-- this may be used to indicate context-specific instructions
-- (this field is intended for human consumption)
generalInfo [8] SEQUENCE SIZE (1..MAX) OF
InfoTypeAndValue OPTIONAL
-- this may be used to convey context-specific information
-- (this field not primarily intended for human consumption)
}
@return a basic ASN.1 object representation.
Creates a new PkiMessage.
@param header message header
@param body message body
@param protection message protection (may be null)
@param extraCerts extra certificates (may be null)
PkiMessage ::= SEQUENCE {
header PKIHeader,
body PKIBody,
protection [0] PKIProtection OPTIONAL,
extraCerts [1] SEQUENCE SIZE (1..MAX) OF CMPCertificate
OPTIONAL
}
@return a basic ASN.1 object representation.
PkiMessages ::= SEQUENCE SIZE (1..MAX) OF PkiMessage
@return a basic ASN.1 object representation.
PollRepContent ::= SEQUENCE OF SEQUENCE {
certReqId INTEGER,
checkAfter INTEGER, -- time in seconds
reason PKIFreeText OPTIONAL
}
@return a basic ASN.1 object representation.
PollReqContent ::= SEQUENCE OF SEQUENCE {
certReqId INTEGER
}
@return a basic ASN.1 object representation.
PopoDecKeyChallContent ::= SEQUENCE OF Challenge
@return a basic ASN.1 object representation.
PopoDecKeyRespContent ::= SEQUENCE OF INTEGER
@return a basic ASN.1 object representation.
ProtectedPart ::= SEQUENCE {
header PKIHeader,
body PKIBody
}
@return a basic ASN.1 object representation.
RevAnnContent ::= SEQUENCE {
status PKIStatus,
certId CertId,
willBeRevokedAt GeneralizedTime,
badSinceDate GeneralizedTime,
crlDetails Extensions OPTIONAL
-- extra CRL details (e.g., crl number, reason, location, etc.)
}
@return a basic ASN.1 object representation.
RevDetails ::= SEQUENCE {
certDetails CertTemplate,
-- allows requester to specify as much as they can about
-- the cert. for which revocation is requested
-- (e.g., for cases in which serialNumber is not available)
crlEntryDetails Extensions OPTIONAL
-- requested crlEntryExtensions
}
@return a basic ASN.1 object representation.
RevRepContent ::= SEQUENCE {
status SEQUENCE SIZE (1..MAX) OF PKIStatusInfo,
-- in same order as was sent in RevReqContent
revCerts [0] SEQUENCE SIZE (1..MAX) OF CertId OPTIONAL,
-- IDs for which revocation was requested
-- (same order as status)
crls [1] SEQUENCE SIZE (1..MAX) OF CertificateList OPTIONAL
-- the resulting CRLs (there may be more than one)
}
@return a basic ASN.1 object representation.
RevReqContent ::= SEQUENCE OF RevDetails
@return a basic ASN.1 object representation.
Attributes ::=
SET SIZE(1..MAX) OF Attribute -- according to RFC 5652
@return
MetaData ::= SEQUENCE {
hashProtected BOOLEAN,
fileName UTF8String OPTIONAL,
mediaType IA5String OPTIONAL,
otherMetaData Attributes OPTIONAL
}
@return
TimeStampAndCRL ::= SEQUENCE {
timeStamp TimeStampToken, -- according to RFC 3161
crl CertificateList OPTIONAL -- according to RFC 5280
}
@return
TimeStampedData ::= SEQUENCE {
version INTEGER { v1(1) },
dataUri IA5String OPTIONAL,
metaData MetaData OPTIONAL,
content OCTET STRING OPTIONAL,
temporalEvidence Evidence
}
@return
TimeStampTokenEvidence ::=
SEQUENCE SIZE(1..MAX) OF TimeStampAndCrl
@return
AttributeTypeAndValue ::= SEQUENCE {
type OBJECT IDENTIFIER,
value ANY DEFINED BY type }
@return a basic ASN.1 object representation.
CertId ::= SEQUENCE {
issuer GeneralName,
serialNumber INTEGER }
@return a basic ASN.1 object representation.
CertReqMessages ::= SEQUENCE SIZE (1..MAX) OF CertReqMsg
@return a basic ASN.1 object representation.
Creates a new CertReqMsg.
@param certReq CertRequest
@param popo may be null
@param regInfo may be null
CertReqMsg ::= SEQUENCE {
certReq CertRequest,
pop ProofOfPossession OPTIONAL,
-- content depends upon key type
regInfo SEQUENCE SIZE(1..MAX) OF AttributeTypeAndValue OPTIONAL }
@return a basic ASN.1 object representation.
CertRequest ::= SEQUENCE {
certReqId INTEGER, -- ID for matching request and reply
certTemplate CertTemplate, -- Selected fields of cert to be issued
controls Controls OPTIONAL } -- Attributes affecting issuance
@return a basic ASN.1 object representation.
CertTemplate ::= SEQUENCE {
version [0] Version OPTIONAL,
serialNumber [1] INTEGER OPTIONAL,
signingAlg [2] AlgorithmIdentifier OPTIONAL,
issuer [3] Name OPTIONAL,
validity [4] OptionalValidity OPTIONAL,
subject [5] Name OPTIONAL,
publicKey [6] SubjectPublicKeyInfo OPTIONAL,
issuerUID [7] UniqueIdentifier OPTIONAL,
subjectUID [8] UniqueIdentifier OPTIONAL,
extensions [9] Extensions OPTIONAL }
@return a basic ASN.1 object representation.
Sets the X.509 version. Note: for X509v3, use 2 here.
Sets the issuer unique ID (deprecated in X.509v3)
Sets the subject unique ID (deprecated in X.509v3)
CertTemplate ::= SEQUENCE {
version [0] Version OPTIONAL,
serialNumber [1] INTEGER OPTIONAL,
signingAlg [2] AlgorithmIdentifier OPTIONAL,
issuer [3] Name OPTIONAL,
validity [4] OptionalValidity OPTIONAL,
subject [5] Name OPTIONAL,
publicKey [6] SubjectPublicKeyInfo OPTIONAL,
issuerUID [7] UniqueIdentifier OPTIONAL,
subjectUID [8] UniqueIdentifier OPTIONAL,
extensions [9] Extensions OPTIONAL }
@return a basic ASN.1 object representation.
Controls ::= SEQUENCE SIZE(1..MAX) OF AttributeTypeAndValue
@return a basic ASN.1 object representation.
EncKeyWithID ::= SEQUENCE {
privateKey PrivateKeyInfo,
identifier CHOICE {
string UTF8String,
generalName GeneralName
} OPTIONAL
}
@return
EncryptedKey ::= CHOICE {
encryptedValue EncryptedValue, -- deprecated
envelopedData [0] EnvelopedData }
-- The encrypted private key MUST be placed in the envelopedData
-- encryptedContentInfo encryptedContent OCTET STRING.
EncryptedValue ::= SEQUENCE {
intendedAlg [0] AlgorithmIdentifier OPTIONAL,
-- the intended algorithm for which the value will be used
symmAlg [1] AlgorithmIdentifier OPTIONAL,
-- the symmetric algorithm used to encrypt the value
encSymmKey [2] BIT STRING OPTIONAL,
-- the (encrypted) symmetric key used to encrypt the value
keyAlg [3] AlgorithmIdentifier OPTIONAL,
-- algorithm used to encrypt the symmetric key
valueHint [4] OCTET STRING OPTIONAL,
-- a brief description or identifier of the encValue content
-- (may be meaningful only to the sending entity, and used only
-- if EncryptedValue might be re-examined by the sending entity
-- in the future)
encValue BIT STRING }
-- the encrypted value itself
@return a basic ASN.1 object representation.
OptionalValidity ::= SEQUENCE {
notBefore [0] Time OPTIONAL,
notAfter [1] Time OPTIONAL } --at least one MUST be present
@return a basic ASN.1 object representation.
PkiArchiveOptions ::= CHOICE {
encryptedPrivKey [0] EncryptedKey,
-- the actual value of the private key
keyGenParameters [1] KeyGenParameters,
-- parameters which allow the private key to be re-generated
archiveRemGenPrivKey [2] BOOLEAN }
-- set to TRUE if sender wishes receiver to archive the private
-- key of a key pair that the receiver generates in response to
-- this request; set to FALSE if no archival is desired.
PkiPublicationInfo ::= SEQUENCE {
action INTEGER {
dontPublish (0),
pleasePublish (1) },
pubInfos SEQUENCE SIZE (1..MAX) OF SinglePubInfo OPTIONAL }
-- pubInfos MUST NOT be present if action is "dontPublish"
-- (if action is "pleasePublish" and pubInfos is omitted,
-- "dontCare" is assumed)
@return a basic ASN.1 object representation.
Password-based MAC value for use with POPOSigningKeyInput.
Creates a new PKMACValue.
@param params parameters for password-based MAC
@param value MAC of the DER-encoded SubjectPublicKeyInfo
Creates a new PKMACValue.
@param aid CMPObjectIdentifiers.passwordBasedMAC, with PBMParameter
@param value MAC of the DER-encoded SubjectPublicKeyInfo
PKMACValue ::= SEQUENCE {
algId AlgorithmIdentifier,
-- algorithm value shall be PasswordBasedMac 1.2.840.113533.7.66.13
-- parameter value is PBMParameter
value BIT STRING }
@return a basic ASN.1 object representation.
PopoPrivKey ::= CHOICE {
thisMessage [0] BIT STRING, -- Deprecated
-- possession is proven in this message (which contains the private
-- key itself (encrypted for the CA))
subsequentMessage [1] SubsequentMessage,
-- possession will be proven in a subsequent message
dhMAC [2] BIT STRING, -- Deprecated
agreeMAC [3] PKMACValue,
encryptedKey [4] EnvelopedData }
Creates a new Proof of Possession object for a signing key.
@param poposkIn the PopoSigningKeyInput structure, or null if the
CertTemplate includes both subject and publicKey values.
@param aid the AlgorithmIdentifier used to sign the proof of possession.
@param signature a signature over the DER-encoded value of poposkIn,
or the DER-encoded value of certReq if poposkIn is null.
PopoSigningKey ::= SEQUENCE {
poposkInput [0] PopoSigningKeyInput OPTIONAL,
algorithmIdentifier AlgorithmIdentifier,
signature BIT STRING }
-- The signature (using "algorithmIdentifier") is on the
-- DER-encoded value of poposkInput. NOTE: If the CertReqMsg
-- certReq CertTemplate contains the subject and publicKey values,
-- then poposkInput MUST be omitted and the signature MUST be
-- computed on the DER-encoded value of CertReqMsg certReq. If
-- the CertReqMsg certReq CertTemplate does not contain the public
-- key and subject values, then poposkInput MUST be present and
-- MUST be signed. This strategy ensures that the public key is
-- not present in both the poposkInput and CertReqMsg certReq
-- CertTemplate fields.
@return a basic ASN.1 object representation.
Creates a new PopoSigningKeyInput with sender name as authInfo.
Creates a new PopoSigningKeyInput using password-based MAC.
PopoSigningKeyInput ::= SEQUENCE {
authInfo CHOICE {
sender [0] GeneralName,
-- used only if an authenticated identity has been
-- established for the sender (e.g., a DN from a
-- previously-issued and currently-valid certificate
publicKeyMac PKMacValue },
-- used if no authenticated GeneralName currently exists for
-- the sender; publicKeyMac contains a password-based MAC
-- on the DER-encoded value of publicKey
publicKey SubjectPublicKeyInfo } -- from CertTemplate
@return a basic ASN.1 object representation.
Returns the sender field, or null if authInfo is publicKeyMac
Returns the publicKeyMac field, or null if authInfo is sender
Creates a ProofOfPossession with type raVerified.
Creates a ProofOfPossession for a signing key.
Creates a ProofOfPossession for key encipherment or agreement.
@param type one of TYPE_KEY_ENCIPHERMENT or TYPE_KEY_AGREEMENT
ProofOfPossession ::= CHOICE {
raVerified [0] NULL,
-- used if the RA has already verified that the requester is in
-- possession of the private key
signature [1] PopoSigningKey,
keyEncipherment [2] PopoPrivKey,
keyAgreement [3] PopoPrivKey }
@return a basic ASN.1 object representation.
SinglePubInfo ::= SEQUENCE {
pubMethod INTEGER {
dontCare (0),
x500 (1),
web (2),
ldap (3) },
pubLocation GeneralName OPTIONAL }
@return a basic ASN.1 object representation.
The CscaMasterList object. This object can be wrapped in a
CMSSignedData to be published in LDAP.
CscaMasterList ::= SEQUENCE {
version CscaMasterListVersion,
certList SET OF Certificate }
CscaMasterListVersion :: INTEGER {v0(0)}
LDSVersionInfo ::= SEQUENCE {
ldsVersion PRINTABLE STRING
unicodeVersion PRINTABLE STRING
}
@return
Represents revocation key OpenPGP signature sub packet.
Represents revocation reason OpenPGP signature sub packet.
Default authenticated attributes generator.
Initialise to use all defaults
Initialise with some extra attributes or overrides.
@param attributeTable initial attribute table to use.
Create a standard attribute table from the passed in parameters - this will
normally include contentType and messageDigest. If the constructor
using an AttributeTable was used, entries in it for contentType and
messageDigest will override the generated ones.
@param parameters source parameters for table generation.
@return a filled in IDictionary of attributes.
@param parameters source parameters
@return the populated attribute table
Return the certificates stored in the underlying OriginatorInfo object.
@return a Store of X509CertificateHolder objects.
Return the CRLs stored in the underlying OriginatorInfo object.
@return a Store of X509CRLHolder objects.
Return the underlying ASN.1 object defining this SignerInformation object.
@return a OriginatorInfo.
RFC 2246 7.2
RFC 2246 7.2
A of X509Name
RFC 2246 A.5
RFC 2246 7.4.4
RFC 2246 6.1
RFC 2246 6.2.1
RFC 4492 5.4
Indicates the elliptic curve domain parameters are conveyed verbosely, and the
underlying finite field is a prime field.
Indicates the elliptic curve domain parameters are conveyed verbosely, and the
underlying finite field is a characteristic-2 field.
Indicates that a named curve is used. This option SHOULD be used when applicable.
RFC 4492 5.1.2
RFC 4366 2.3
RFC 2246 7.4
A temporary class to wrap old CertificateVerifyer stuff for new TlsAuthentication.
Called by the protocol handler to report the server certificate.
This method is responsible for certificate verification and validation
The server received
Return client credentials in response to server's certificate request
A containing server certificate request details
A to be used for client authentication
(or null for no client authentication)
A temporary class to use LegacyTlsAuthentication
RFC 4492 5.1.1
The named curves defined here are those specified in SEC 2 [13]. Note that many of
these curves are also recommended in ANSI X9.62 [7] and FIPS 186-2 [11]. Values 0xFE00
through 0xFEFF are reserved for private use. Values 0xFF01 and 0xFF02 indicate that the
client supports arbitrary prime and characteristic-2 curves, respectively (the curve
parameters must be encoded explicitly in ECParameters).
HMAC implementation based on original internet draft for HMAC (RFC 2104)
The difference is that padding is concatentated versus XORed with the key
H(K + opad, H(K + ipad, text))
Base constructor for one of the standard digest algorithms that the byteLength of
the algorithm is know for. Behaviour is undefined for digests other than MD5 or SHA1.
@param digest the digest.
Reset the mac generator.
ECDHE key exchange (see RFC 4492)
ECDH key exchange (see RFC 4492)
PEM generator for the original set of PEM objects used in Open SSL.
A
Constructor for an unencrypted private key PEM object.
@param key private key to be encoded.
Constructor for an encrypted private key PEM object.
@param key private key to be encoded
@param algorithm encryption algorithm to use
@param provider provider to use
@throws NoSuchAlgorithmException if algorithm/mode cannot be found
crl checking
Return a Collection of all CRLs found in the X509Store's that are
matching the crlSelect criteriums.
a {@link X509CRLStoreSelector} object that will be used
to select the CRLs
a List containing only {@link org.bouncycastle.x509.X509Store
X509Store} objects. These are used to search for CRLs
a Collection of all found {@link X509CRL X509CRL} objects. May be
empty but never null
.
A
A
Provides the base class for a generic read-only dictionary.
The type of keys in the dictionary.
The type of values in the dictionary.
An instance of the ReadOnlyDictionary generic class is
always read-only. A dictionary that is read-only is simply a
dictionary with a wrapper that prevents modifying the
dictionary; therefore, if changes are made to the underlying
dictionary, the read-only dictionary reflects those changes.
See for a modifiable version of
this class.
Notes to Implementers This base class is provided to
make it easier for implementers to create a generic read-only
custom dictionary. Implementers are encouraged to extend this
base class instead of creating their own.
Initializes a new instance of the
class that wraps
the supplied .
The
that will be wrapped.
Thrown when the dictionary is null.
This method is not supported by the
.
The object to use as the key of the element to add.
The object to use as the value of the element to add.
Determines whether the
contains the specified key.
True if the contains
an element with the specified key; otherwise, false.
The key to locate in the
.
Thrown when the key is null.
This method is not supported by the .
The key of the element to remove.
True if the element is successfully removed; otherwise, false.
Gets the value associated with the specified key.
The key of the value to get.
When this method returns, contains the value
associated with the specified key, if the key is found;
otherwise, the default value for the type of the value parameter.
This parameter is passed uninitialized.
true if the contains
an element with the specified key; otherwise, false.
This method is not supported by the
.
The object to add to the .
This method is not supported by the
.
Determines whether the contains a
specific value.
The object to locate in the .
true if item is found in the ICollection;
otherwise, false.
Copies the elements of the ICollection to an Array, starting at a
particular Array index.
The one-dimensional Array that is the
destination of the elements copied from ICollection.
The Array must have zero-based indexing.
The zero-based index in array at which copying begins.
This method is not supported by the
.
The object to remove from the ICollection.
Will never return a value.
Returns an enumerator that iterates through the collection.
A IEnumerator that can be used to iterate through the collection.
Returns an enumerator that iterates through a collection.
An IEnumerator that can be used to iterate through the collection.
For a description of this member, see .
The one-dimensional Array that is the destination of the elements copied from
ICollection. The Array must have zero-based indexing.
The zero-based index in Array at which copying begins.
Gets the number of key/value pairs contained in the
.
The number of key/value pairs.
The number of key/value pairs contained in the
.
Gets a collection containing the keys in the
.
A
containing the keys.
A
containing the keys in the
.
Gets a collection containing the values of the
.
The collection of values.
Gets a value indicating whether the dictionary is read-only.
This value will always be true.
Gets a value indicating whether access to the dictionary
is synchronized (thread safe).
Gets an object that can be used to synchronize access to dictionary.
Gets or sets the value associated with the specified key.
The value associated with the specified key. If the specified key
is not found, a get operation throws a
,
and a set operation creates a new element with the specified key.
The key of the value to get or set.
Thrown when the key is null.
The property is retrieved and key does not exist in the collection.