summary refs log tree commit diff
path: root/crypto/src/cmp
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2019-07-31 16:54:19 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2019-07-31 16:54:19 +0700
commited0df3da696f2734690542534ef98536c66e1efa (patch)
tree1fce205e8219da61afd41635a002673366991c48 /crypto/src/cmp
parentWork on EC parameters classes (diff)
downloadBouncyCastle.NET-ed25519-ed0df3da696f2734690542534ef98536c66e1efa.tar.xz
Fix CMP tests failing to set body
Diffstat (limited to 'crypto/src/cmp')
-rw-r--r--crypto/src/cmp/ProtectedPkiMessageBuilder.cs6
1 files changed, 6 insertions, 0 deletions
diff --git a/crypto/src/cmp/ProtectedPkiMessageBuilder.cs b/crypto/src/cmp/ProtectedPkiMessageBuilder.cs
index 8ce0d48dc..5939e92df 100644
--- a/crypto/src/cmp/ProtectedPkiMessageBuilder.cs
+++ b/crypto/src/cmp/ProtectedPkiMessageBuilder.cs
@@ -90,6 +90,9 @@ namespace Org.BouncyCastle.Cmp
 
         public ProtectedPkiMessage Build(ISignatureFactory signatureFactory)
         {
+            if (null == body)
+                throw new InvalidOperationException("body must be set before building");
+
             IStreamCalculator calculator = signatureFactory.CreateCalculator();
 
             if (!(signatureFactory.AlgorithmDetails is AlgorithmIdentifier))
@@ -105,6 +108,9 @@ namespace Org.BouncyCastle.Cmp
 
         public ProtectedPkiMessage Build(IMacFactory factory)
         {
+            if (null == body)
+                throw new InvalidOperationException("body must be set before building");
+
             IStreamCalculator calculator = factory.CreateCalculator();
             FinalizeHeader((AlgorithmIdentifier)factory.AlgorithmDetails);
             PkiHeader header = hdrBuilBuilder.Build();