Blob Blame History Raw
diff -up jss-4.2.6/mozilla/security/jss/org/mozilla/jss/pkix/crmf/EncryptedKey.java.roysjosh jss-4.2.6/mozilla/security/jss/org/mozilla/jss/pkix/crmf/EncryptedKey.java
--- jss-4.2.6/mozilla/security/jss/org/mozilla/jss/pkix/crmf/EncryptedKey.java.roysjosh	2016-06-24 14:51:48.929122053 -0700
+++ jss-4.2.6/mozilla/security/jss/org/mozilla/jss/pkix/crmf/EncryptedKey.java	2016-06-24 14:52:29.487027005 -0700
@@ -127,7 +127,8 @@ public class EncryptedKey implements ASN
         } else {
             Assert._assert(type == ENVELOPED_DATA);
             Assert._assert(envelopedData != null);
-            envelopedData.encode(implicitTag, ostream);
+            EXPLICIT explicit = new EXPLICIT( new Tag(0), envelopedData );
+            explicit.encode(tag, ostream);
         }
     }
 
@@ -147,7 +148,9 @@ public class EncryptedKey implements ASN
             choicet = new CHOICE.Template();
 
             choicet.addElement( EncryptedValue.getTemplate() );
-            choicet.addElement( new Tag(0), ANY.getTemplate() );
+            choicet.addElement( new EXPLICIT.Template(
+                                        new Tag(0),
+                                        ANY.getTemplate() ));
         }
 
         public boolean tagMatch(Tag tag) {
@@ -164,7 +167,7 @@ public class EncryptedKey implements ASN
                 return new EncryptedKey( (EncryptedValue) choice.getValue() );
             } else {
                 Assert._assert( choice.getTag().equals(new Tag(0)) );
-                return new EncryptedKey( (ANY) choice.getValue() );
+                return new EncryptedKey( (ANY) ((EXPLICIT) choice.getValue()).getContent() );
             }
 
           } catch(InvalidBERException e) {