Skip to content

Commit 5539168

Browse files
committed
Refactor CMSAuthenticatedDataStreamGenerator
1 parent 1ed4d91 commit 5539168

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

pkix/src/main/java/org/bouncycastle/cms/CMSAuthenticatedDataStreamGenerator.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ public class CMSAuthenticatedDataStreamGenerator
4747
// private Object _unprotectedAttributes = null;
4848
private int bufferSize;
4949
private boolean berEncodeRecipientSet;
50-
private MacCalculator macCalculator;
5150

5251
/**
5352
* base constructor
@@ -133,8 +132,6 @@ public OutputStream open(
133132
DigestCalculator digestCalculator)
134133
throws CMSException
135134
{
136-
this.macCalculator = macCalculator;
137-
138135
try
139136
{
140137
ASN1EncodableVector recipientInfos = CMSUtils.getRecipentInfos(macCalculator.getKey(), recipientInfoGenerators);
@@ -254,7 +251,11 @@ public void close()
254251

255252
if (digestCalculator != null)
256253
{
257-
parameters = Collections.unmodifiableMap(getBaseParameters(contentType, digestCalculator.getAlgorithmIdentifier(), macCalculator.getAlgorithmIdentifier(), digestCalculator.getDigest()));
254+
AlgorithmIdentifier digestAlgID = digestCalculator.getAlgorithmIdentifier();
255+
AlgorithmIdentifier macAlgID = macCalculator.getAlgorithmIdentifier();
256+
257+
parameters = Collections.unmodifiableMap(
258+
getBaseParameters(contentType, digestAlgID, macAlgID, digestCalculator.getDigest()));
258259

259260
if (authGen == null)
260261
{

0 commit comments

Comments
 (0)