File tree Expand file tree Collapse file tree 1 file changed +7
-14
lines changed
util/src/main/java/org/bouncycastle/asn1/cms Expand file tree Collapse file tree 1 file changed +7
-14
lines changed Original file line number Diff line number Diff line change @@ -151,22 +151,15 @@ public boolean isDefiniteLength()
151151 */
152152 public ASN1Primitive toASN1Primitive ()
153153 {
154- ASN1EncodableVector v = new ASN1EncodableVector (2 );
155-
156- v .add (contentType );
157-
158- if (content != null )
154+ if (isDefiniteLength )
159155 {
160- if (isDefiniteLength )
161- {
162- v .add (new DLTaggedObject (0 , content ));
163- }
164- else
165- {
166- v .add (new BERTaggedObject (0 , content ));
167- }
156+ return content == null
157+ ? new DLSequence (contentType )
158+ : new DLSequence (contentType , new DLTaggedObject (0 , content ));
168159 }
169160
170- return isDefiniteLength ? (ASN1Primitive )new DLSequence (v ) : (ASN1Primitive )new BERSequence (v );
161+ return content == null
162+ ? new BERSequence (contentType )
163+ : new BERSequence (contentType , new BERTaggedObject (0 , content ));
171164 }
172165}
You can’t perform that action at this time.
0 commit comments