summaryrefslogtreecommitdiffstats
path: root/base/util
diff options
context:
space:
mode:
authorChristina Fu <cfu@redhat.com>2017-03-26 17:34:51 -0400
committerChristina Fu <cfu@redhat.com>2017-03-28 09:22:06 -0400
commit358064eed09fd43e9fe7b08e43bd03775df880df (patch)
tree9a4564a9c536872156ff9134a57d09fd29ad0ada /base/util
parent58b0563caac110e6950657eb9894c6981f179452 (diff)
downloadpki-358064eed09fd43e9fe7b08e43bd03775df880df.tar.gz
pki-358064eed09fd43e9fe7b08e43bd03775df880df.tar.xz
pki-358064eed09fd43e9fe7b08e43bd03775df880df.zip
Bug #2615 CMC: cleanup code for Encrypted Decrypted POP This patch adds more error checking and debugging
Diffstat (limited to 'base/util')
-rw-r--r--base/util/src/com/netscape/cmsutil/crypto/CryptoUtil.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/base/util/src/com/netscape/cmsutil/crypto/CryptoUtil.java b/base/util/src/com/netscape/cmsutil/crypto/CryptoUtil.java
index 716a3f23f..35888522f 100644
--- a/base/util/src/com/netscape/cmsutil/crypto/CryptoUtil.java
+++ b/base/util/src/com/netscape/cmsutil/crypto/CryptoUtil.java
@@ -2403,12 +2403,25 @@ public class CryptoUtil {
public static EnvelopedData createEnvelopedData(byte[] encContent, byte[] encSymKey)
throws Exception {
String method = "CryptoUtl: createEnvelopedData: ";
+ String msg = "";
System.out.println(method + "begins");
+ if ((encContent == null) ||
+ (encSymKey == null)) {
+ msg = method + "method parameters cannot be null";
+ System.out.println(msg);
+
+ throw new Exception(method + msg);
+ }
EncryptedContentInfo encCInfo = new EncryptedContentInfo(
ContentInfo.DATA,
getDefaultEncAlg(),
new OCTET_STRING(encContent));
+ if (encCInfo == null) {
+ msg = method + "encCInfo null from new EncryptedContentInfo";
+ System.out.println(msg);
+ throw new Exception(method + msg);
+ }
Name name = new Name();
name.addCommonName("unUsedIssuerName"); //unused; okay for cmc EncryptedPOP
@@ -2417,6 +2430,11 @@ public class CryptoUtil {
new IssuerAndSerialNumber(name, new INTEGER(0)), //unUsed
new AlgorithmIdentifier(RSA_ENCRYPTION, new NULL()),
new OCTET_STRING(encSymKey));
+ if (recipient == null) {
+ msg = method + "recipient null from new RecipientInfo";
+ System.out.println(msg);
+ throw new Exception(method + msg);
+ }
SET recipients = new SET();
recipients.addElement(recipient);