@@ -180,6 +180,57 @@ mod choice {
180
180
assert_eq ! ( TIME_DER , encoder. finish( ) . unwrap( ) ) ;
181
181
}
182
182
}
183
+
184
+ mod generic_implicit {
185
+ use der:: {
186
+ Choice , Decode , Encode , SliceWriter ,
187
+ asn1:: { BitStringRef , GeneralizedTime } ,
188
+ } ;
189
+ use hex_literal:: hex;
190
+
191
+ /// PKCS#15 ObjectValue
192
+ #[ derive( Choice , Clone , Debug , Eq , PartialEq ) ]
193
+ pub enum ObjectValue < T >
194
+ where
195
+ for < ' a > T : Encode + Decode < ' a > + EncodeValue + Tagged ,
196
+ {
197
+ #[ asn1( tag_mode = "EXPLICIT" ) ]
198
+ Indirect ( ReferencedValue ) ,
199
+
200
+ #[ asn1( context_specific = "0" , tag_mode = "EXPLICIT" ) ]
201
+ Direct ( T ) ,
202
+ }
203
+
204
+ /// ```asn1
205
+ /// RSAPublicKeyChoice ::= CHOICE {
206
+ /// raw RSAPublicKey,
207
+ /// spki [1] SubjectPublicKeyInfo, -- See ISO/IEC 9594-8. Must contain a public RSA key.
208
+ /// ...
209
+ /// }
210
+ /// ```
211
+ #[ derive( Choice , Clone , Debug , Eq , PartialEq ) ]
212
+ #[ serde( deny_unknown_fields) ]
213
+ pub enum RSAPublicKeyChoice {
214
+ /// `raw RSAPublicKey`
215
+ Raw ( RSAPublicKey ) ,
216
+ }
217
+
218
+ // TODO
219
+ pub type ReferencedValue = ReferencedValueChoice ;
220
+
221
+ /// ```asn1
222
+ /// ReferencedValue {Type} ::= CHOICE {
223
+ /// path Path,
224
+ /// url URL
225
+ /// } (CONSTRAINED BY {-- 'path' or 'url' shall point to an object of type -- Type})
226
+ /// ```
227
+ #[ derive( Clone , Debug , Eq , PartialEq , Choice , Serialize , Deserialize ) ]
228
+ pub enum ReferencedValueChoice {
229
+ Path ( Path ) ,
230
+ // todo
231
+ URL ( Url ) ,
232
+ }
233
+ }
183
234
}
184
235
185
236
/// Custom derive test cases for the `Enumerated` macro.
0 commit comments