File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -99,19 +99,29 @@ private function getSigningCert()
99
99
}
100
100
101
101
/**
102
- * FIXME: shouldn't return ASN1Object
103
102
* Signed Attributes
104
- * @return ExplicitlyTaggedObject
103
+ * @return ExplicitlyTaggedObject|ASN1\ASN1ObjectInterface
105
104
* @throws Exception
106
105
*/
107
106
public function getSignedAttributes ()
108
107
{
109
108
$ exTaggedObjects = $ this ->object ->findChildrenByType (ExplicitlyTaggedObject::class);
109
+ /** @var ExplicitlyTaggedObject[] $attributes */
110
110
$ attributes = array_filter ($ exTaggedObjects , function ($ value ) {
111
111
return $ value ->getIdentifier ()->getTagNumber () === 0 ;
112
112
});
113
113
114
- return array_pop ($ attributes );
114
+ // if we return attributes as is - we give reference to parent so any object can be changed directly.
115
+ // so lets detach from parent first
116
+ $ object = array_pop ($ attributes )->detach ();
117
+
118
+ // now replace all children creating them from binary.
119
+ foreach ($ object ->getChildren () as $ child ) {
120
+ $ binary = $ child ->getBinary ();
121
+ $ object ->replaceChild ($ child , Sequence::fromBinary ($ binary ));
122
+ }
123
+
124
+ return $ object ;
115
125
}
116
126
117
127
/**
You can’t perform that action at this time.
0 commit comments