1818public class PGPOnePassSignature
1919{
2020 private OnePassSignaturePacket sigPack ;
21- private int signatureType ;
21+ private int signatureType ;
2222
2323 private PGPContentVerifier verifier ;
24- private byte lastb ;
25- private OutputStream sigOut ;
24+ private byte lastb ;
25+ private OutputStream sigOut ;
2626
2727 private static OnePassSignaturePacket cast (Packet packet )
2828 throws IOException
@@ -35,14 +35,14 @@ private static OnePassSignaturePacket cast(Packet packet)
3535 }
3636
3737 PGPOnePassSignature (
38- BCPGInputStream pIn )
38+ BCPGInputStream pIn )
3939 throws IOException , PGPException
4040 {
4141 this (cast (pIn .readPacket ()));
4242 }
43-
43+
4444 PGPOnePassSignature (
45- OnePassSignaturePacket sigPack )
45+ OnePassSignaturePacket sigPack )
4646 throws PGPException
4747 {
4848 this .sigPack = sigPack ;
@@ -52,8 +52,8 @@ private static OnePassSignaturePacket cast(Packet packet)
5252 /**
5353 * Initialise the signature object for verification.
5454 *
55- * @param verifierBuilderProvider provider for a content verifier builder for the signature type of interest.
56- * @param pubKey the public key to use for verification
55+ * @param verifierBuilderProvider provider for a content verifier builder for the signature type of interest.
56+ * @param pubKey the public key to use for verification
5757 * @throws PGPException if there's an issue with creating the verifier.
5858 */
5959 public void init (PGPContentVerifierBuilderProvider verifierBuilderProvider , PGPPublicKey pubKey )
@@ -68,7 +68,7 @@ public void init(PGPContentVerifierBuilderProvider verifierBuilderProvider, PGPP
6868 }
6969
7070 public void update (
71- byte b )
71+ byte b )
7272 {
7373 if (signatureType == PGPSignature .CANONICAL_TEXT_DOCUMENT )
7474 {
@@ -99,7 +99,7 @@ else if (b == '\n')
9999 }
100100
101101 public void update (
102- byte [] bytes )
102+ byte [] bytes )
103103 {
104104 if (signatureType == PGPSignature .CANONICAL_TEXT_DOCUMENT )
105105 {
@@ -113,16 +113,16 @@ public void update(
113113 blockUpdate (bytes , 0 , bytes .length );
114114 }
115115 }
116-
116+
117117 public void update (
118- byte [] bytes ,
119- int off ,
120- int length )
118+ byte [] bytes ,
119+ int off ,
120+ int length )
121121 {
122122 if (signatureType == PGPSignature .CANONICAL_TEXT_DOCUMENT )
123123 {
124124 int finish = off + length ;
125-
125+
126126 for (int i = off ; i != finish ; i ++)
127127 {
128128 this .update (bytes [i ]);
@@ -160,13 +160,13 @@ private void blockUpdate(byte[] block, int off, int len)
160160
161161 /**
162162 * Verify the calculated signature against the passed in PGPSignature.
163- *
163+ *
164164 * @param pgpSig
165165 * @return boolean
166166 * @throws PGPException
167167 */
168168 public boolean verify (
169- PGPSignature pgpSig )
169+ PGPSignature pgpSig )
170170 throws PGPException
171171 {
172172 try
@@ -182,12 +182,12 @@ public boolean verify(
182182
183183 return verifier .verify (pgpSig .getSignature ());
184184 }
185-
185+
186186 public long getKeyID ()
187187 {
188188 return sigPack .getKeyID ();
189189 }
190-
190+
191191 public int getSignatureType ()
192192 {
193193 return sigPack .getSignatureType ();
@@ -204,32 +204,33 @@ public int getKeyAlgorithm()
204204 }
205205
206206 /**
207- * Return true, if the signature is encapsulating .
208- * An encapsulating OPS is followed by additional OPS packets and is calculated over all the data between itself
209- * and its corresponding signature (it is an attestation for encapsulated signatures).
207+ * Return true, if the signature is bracketing .
208+ * An bracketing OPS is followed by additional OPS packets and is calculated over all the data between itself
209+ * and its corresponding signature (it is an attestation for contained signatures).
210210 *
211211 * @return true if encapsulating, false otherwise
212212 */
213- public boolean isEncapsulating () {
214- return sigPack .isEncapsulating ();
213+ public boolean isBracketing ()
214+ {
215+ return sigPack .isBracketing ();
215216 }
216217
217218 public byte [] getEncoded ()
218219 throws IOException
219220 {
220- ByteArrayOutputStream bOut = new ByteArrayOutputStream ();
221-
221+ ByteArrayOutputStream bOut = new ByteArrayOutputStream ();
222+
222223 this .encode (bOut );
223-
224+
224225 return bOut .toByteArray ();
225226 }
226-
227+
227228 public void encode (
228- OutputStream outStream )
229+ OutputStream outStream )
229230 throws IOException
230231 {
231- BCPGOutputStream out ;
232-
232+ BCPGOutputStream out ;
233+
233234 if (outStream instanceof BCPGOutputStream )
234235 {
235236 out = (BCPGOutputStream )outStream ;
0 commit comments