summaryrefslogtreecommitdiffstats
path: root/bcpkix/src/main/java/org/bouncycastle/cms/CMSSignedData.java
diff options
context:
space:
mode:
Diffstat (limited to 'bcpkix/src/main/java/org/bouncycastle/cms/CMSSignedData.java')
-rw-r--r--bcpkix/src/main/java/org/bouncycastle/cms/CMSSignedData.java37
1 files changed, 32 insertions, 5 deletions
diff --git a/bcpkix/src/main/java/org/bouncycastle/cms/CMSSignedData.java b/bcpkix/src/main/java/org/bouncycastle/cms/CMSSignedData.java
index 7a8adeb..c976dfe 100644
--- a/bcpkix/src/main/java/org/bouncycastle/cms/CMSSignedData.java
+++ b/bcpkix/src/main/java/org/bouncycastle/cms/CMSSignedData.java
@@ -2,6 +2,7 @@ package org.bouncycastle.cms;
import java.io.IOException;
import java.io.InputStream;
+import java.io.OutputStream;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.Provider;
@@ -74,7 +75,7 @@ public class CMSSignedData
SignedData signedData;
ContentInfo contentInfo;
- CMSProcessable signedContent;
+ CMSTypedData signedContent;
SignerInformationStore signerInfoStore;
X509Store attributeStore;
X509Store certificateStore;
@@ -144,11 +145,36 @@ public class CMSSignedData
}
public CMSSignedData(
- CMSProcessable signedContent,
+ final CMSProcessable signedContent,
ContentInfo sigData)
throws CMSException
{
- this.signedContent = signedContent;
+ if (signedContent instanceof CMSTypedData)
+ {
+ this.signedContent = (CMSTypedData)signedContent;
+ }
+ else
+ {
+ this.signedContent = new CMSTypedData()
+ {
+ public ASN1ObjectIdentifier getContentType()
+ {
+ return signedData.getEncapContentInfo().getContentType();
+ }
+
+ public void write(OutputStream out)
+ throws IOException, CMSException
+ {
+ signedContent.write(out);
+ }
+
+ public Object getContent()
+ {
+ return signedContent.getContent();
+ }
+ };
+ }
+
this.contentInfo = sigData;
this.signedData = getSignedData();
}
@@ -176,7 +202,7 @@ public class CMSSignedData
//
if (signedData.getEncapContentInfo().getContent() != null)
{
- this.signedContent = new CMSProcessableByteArray(
+ this.signedContent = new CMSProcessableByteArray(signedData.getEncapContentInfo().getContentType(),
((ASN1OctetString)(signedData.getEncapContentInfo()
.getContent())).getOctets());
}
@@ -498,7 +524,7 @@ public class CMSSignedData
return signedData.getEncapContentInfo().getContentType().getId();
}
- public CMSProcessable getSignedContent()
+ public CMSTypedData getSignedContent()
{
return signedContent;
}
@@ -604,6 +630,7 @@ public class CMSSignedData
* @param certsAndCrls the new certificates and CRLs to be used.
* @return a new signed data object.
* @exception CMSException if there is an error processing the CertStore
+ * @deprecated use method taking Store arguments.
*/
public static CMSSignedData replaceCertificatesAndCRLs(
CMSSignedData signedData,