Skip to content

Commit 6593bce

Browse files
committed
minor renaming relates to github #1232
1 parent 6ee22cd commit 6593bce

File tree

2 files changed

+41
-39
lines changed

2 files changed

+41
-39
lines changed

pg/src/main/java/org/bouncycastle/bcpg/OnePassSignaturePacket.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class OnePassSignaturePacket
1414
private int hashAlgorithm;
1515
private int keyAlgorithm;
1616
private long keyID;
17-
private int isEncapsulating;
17+
private int isBracketing;
1818

1919
OnePassSignaturePacket(
2020
BCPGInputStream in)
@@ -34,7 +34,7 @@ public class OnePassSignaturePacket
3434
keyID |= (long)in.read() << 8;
3535
keyID |= in.read();
3636

37-
isEncapsulating = in.read();
37+
isBracketing = in.read();
3838
}
3939

4040
public OnePassSignaturePacket(
@@ -49,7 +49,7 @@ public OnePassSignaturePacket(
4949
this.hashAlgorithm = hashAlgorithm;
5050
this.keyAlgorithm = keyAlgorithm;
5151
this.keyID = keyID;
52-
this.isEncapsulating = (isNested) ? 0 : 1;
52+
this.isBracketing = (isNested) ? 0 : 1;
5353
}
5454

5555
/**
@@ -86,14 +86,15 @@ public long getKeyID()
8686
}
8787

8888
/**
89-
* Return true, if the signature is encapsulating.
90-
* An encapsulating OPS is followed by additional OPS packets and is calculated over all the data between itself
89+
* Return true, if the signature is bracketing.
90+
* An bracketing OPS is followed by additional OPS packets and is calculated over all the data between itself
9191
* and its corresponding signature (it is an attestation for encapsulated signatures).
9292
*
9393
* @return true if encapsulating, false otherwise
9494
*/
95-
public boolean isEncapsulating() {
96-
return isEncapsulating == 1;
95+
public boolean isBracketing()
96+
{
97+
return isBracketing == 1;
9798
}
9899

99100
/**
@@ -120,7 +121,7 @@ public void encode(
120121
pOut.write((byte)(keyID >> 8));
121122
pOut.write((byte)(keyID));
122123

123-
pOut.write(isEncapsulating);
124+
pOut.write(isBracketing);
124125

125126
pOut.close();
126127

pg/src/main/java/org/bouncycastle/openpgp/PGPOnePassSignature.java

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
public 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

Comments
 (0)