@@ -37,19 +37,19 @@ impl Extension {
3737
3838 /// Get the value of the `Extension` in `ExtensionValue`.
3939 #[ must_use]
40- pub fn get_value ( & self ) -> & ExtensionValue {
40+ pub fn value ( & self ) -> & ExtensionValue {
4141 & self . value
4242 }
4343
4444 /// Get the critical flag of the `Extension`.
4545 #[ must_use]
46- pub fn get_critical ( & self ) -> bool {
46+ pub fn critical ( & self ) -> bool {
4747 self . critical
4848 }
4949
5050 /// Get the registered OID of the `Extension`.
5151 #[ must_use]
52- pub fn get_registered_oid ( & self ) -> & C509oidRegistered {
52+ pub ( crate ) fn registered_oid ( & self ) -> & C509oidRegistered {
5353 & self . registered_oid
5454 }
5555}
@@ -80,7 +80,7 @@ impl Serialize for Extension {
8080 fn serialize < S > ( & self , serializer : S ) -> Result < S :: Ok , S :: Error >
8181 where S : serde:: Serializer {
8282 let helper = Helper {
83- oid : self . registered_oid . get_c509_oid ( ) . get_oid ( ) . to_string ( ) ,
83+ oid : self . registered_oid . c509_oid ( ) . oid ( ) . to_string ( ) ,
8484 value : self . value . clone ( ) ,
8585 critical : self . critical ,
8686 } ;
@@ -92,16 +92,15 @@ impl Encode<()> for Extension {
9292 // Extension can be encoded as:
9393 // - (extensionID: int, extensionValue: any)
9494 // - (extensionID: ~oid, ? critical: true, extensionValue: bytes)
95- // - (extensionID: pen, ? critical: true, extensionValue: bytes)
9695 fn encode < W : Write > (
9796 & self , e : & mut Encoder < W > , ctx : & mut ( ) ,
9897 ) -> Result < ( ) , minicbor:: encode:: Error < W :: Error > > {
9998 // Handle CBOR int based on OID mapping
10099 if let Some ( & mapped_oid) = self
101100 . registered_oid
102- . get_table ( )
101+ . table ( )
103102 . get_map ( )
104- . get_by_right ( & self . registered_oid . get_c509_oid ( ) . get_oid ( ) )
103+ . get_by_right ( self . registered_oid . c509_oid ( ) . oid ( ) )
105104 {
106105 // Determine encoded OID value based on critical flag
107106 let encoded_oid = if self . critical {
@@ -111,8 +110,8 @@ impl Encode<()> for Extension {
111110 } ;
112111 e. i16 ( encoded_oid) ?;
113112 } else {
114- // Handle unwrapped CBOR OID or CBOR PEN
115- self . registered_oid . get_c509_oid ( ) . encode ( e, ctx) ?;
113+ // Handle unwrapped CBOR OID
114+ self . registered_oid . c509_oid ( ) . encode ( e, ctx) ?;
116115 if self . critical {
117116 e. bool ( self . critical ) ?;
118117 }
@@ -150,7 +149,7 @@ impl Decode<'_, ()> for Extension {
150149 ) )
151150 } ,
152151 _ => {
153- // Handle unwrapped CBOR OID or CBOR PEN
152+ // Handle unwrapped CBOR OID
154153 let c509_oid = C509oid :: decode ( d, ctx) ?;
155154 // Critical flag is optional, so if exist, this mean we have to decode it
156155 let critical = if d. datatype ( ) ? == minicbor:: data:: Type :: Bool {
@@ -163,7 +162,7 @@ impl Decode<'_, ()> for Extension {
163162 let extension_value = ExtensionValue :: Bytes ( d. bytes ( ) ?. to_vec ( ) ) ;
164163
165164 Ok ( Extension :: new (
166- c509_oid. get_oid ( ) ,
165+ c509_oid. oid ( ) . clone ( ) ,
167166 extension_value,
168167 critical,
169168 ) )
0 commit comments