@@ -122,6 +122,8 @@ pub enum AttributeType {
122
122
Token ,
123
123
/// Determines if the object is trusted
124
124
Trusted ,
125
+ /// Unique Object Id
126
+ UniqueId ,
125
127
/// Determines if a key supports unwrapping
126
128
Unwrap ,
127
129
/// Gives the URL where the complete certificate can be obtained
@@ -258,6 +260,7 @@ impl AttributeType {
258
260
CKA_UNWRAP_TEMPLATE => String :: from ( stringify ! ( CKA_UNWRAP_TEMPLATE ) ) ,
259
261
CKA_DERIVE_TEMPLATE => String :: from ( stringify ! ( CKA_DERIVE_TEMPLATE ) ) ,
260
262
CKA_ALLOWED_MECHANISMS => String :: from ( stringify ! ( CKA_ALLOWED_MECHANISMS ) ) ,
263
+ CKA_UNIQUE_ID => String :: from ( stringify ! ( CKA_UNIQUE_ID ) ) ,
261
264
CKA_VENDOR_DEFINED ..=MAX_CU_ULONG => {
262
265
format ! ( "{}_{}" , stringify!( CKA_VENDOR_DEFINED ) , val)
263
266
}
@@ -327,6 +330,7 @@ impl From<AttributeType> for CK_ATTRIBUTE_TYPE {
327
330
AttributeType :: Subject => CKA_SUBJECT ,
328
331
AttributeType :: Token => CKA_TOKEN ,
329
332
AttributeType :: Trusted => CKA_TRUSTED ,
333
+ AttributeType :: UniqueId => CKA_UNIQUE_ID ,
330
334
AttributeType :: Unwrap => CKA_UNWRAP ,
331
335
AttributeType :: Url => CKA_URL ,
332
336
AttributeType :: Value => CKA_VALUE ,
@@ -396,6 +400,7 @@ impl TryFrom<CK_ATTRIBUTE_TYPE> for AttributeType {
396
400
CKA_SUBJECT => Ok ( AttributeType :: Subject ) ,
397
401
CKA_TOKEN => Ok ( AttributeType :: Token ) ,
398
402
CKA_TRUSTED => Ok ( AttributeType :: Trusted ) ,
403
+ CKA_UNIQUE_ID => Ok ( AttributeType :: UniqueId ) ,
399
404
CKA_UNWRAP => Ok ( AttributeType :: Unwrap ) ,
400
405
CKA_URL => Ok ( AttributeType :: Url ) ,
401
406
CKA_VALUE => Ok ( AttributeType :: Value ) ,
@@ -519,6 +524,8 @@ pub enum Attribute {
519
524
Token ( bool ) ,
520
525
/// Determines if an object is trusted
521
526
Trusted ( bool ) ,
527
+ /// Unique Object Id
528
+ UniqueId ( Vec < u8 > ) ,
522
529
/// Determines if a key supports unwrapping
523
530
Unwrap ( bool ) ,
524
531
/// Gives the URL where the complete certificate can ber obtained
@@ -594,6 +601,7 @@ impl Attribute {
594
601
Attribute :: Subject ( _) => AttributeType :: Subject ,
595
602
Attribute :: Token ( _) => AttributeType :: Token ,
596
603
Attribute :: Trusted ( _) => AttributeType :: Trusted ,
604
+ Attribute :: UniqueId ( _) => AttributeType :: UniqueId ,
597
605
Attribute :: Unwrap ( _) => AttributeType :: Unwrap ,
598
606
Attribute :: Url ( _) => AttributeType :: Url ,
599
607
Attribute :: Value ( _) => AttributeType :: Value ,
@@ -663,6 +671,7 @@ impl Attribute {
663
671
Attribute :: PublicKeyInfo ( bytes) => bytes. len ( ) ,
664
672
Attribute :: SerialNumber ( bytes) => bytes. len ( ) ,
665
673
Attribute :: Subject ( bytes) => bytes. len ( ) ,
674
+ Attribute :: UniqueId ( bytes) => bytes. len ( ) ,
666
675
Attribute :: Value ( bytes) => bytes. len ( ) ,
667
676
Attribute :: ValueLen ( _) => size_of :: < CK_ULONG > ( ) ,
668
677
Attribute :: EndDate ( _) | Attribute :: StartDate ( _) => size_of :: < CK_DATE > ( ) ,
@@ -741,6 +750,7 @@ impl Attribute {
741
750
| Attribute :: Owner ( bytes)
742
751
| Attribute :: SerialNumber ( bytes)
743
752
| Attribute :: Subject ( bytes)
753
+ | Attribute :: UniqueId ( bytes)
744
754
| Attribute :: Url ( bytes)
745
755
| Attribute :: Value ( bytes)
746
756
| Attribute :: VendorDefined ( ( _, bytes) )
@@ -868,6 +878,7 @@ impl TryFrom<CK_ATTRIBUTE> for Attribute {
868
878
AttributeType :: Owner => Ok ( Attribute :: Owner ( val. to_vec ( ) ) ) ,
869
879
AttributeType :: SerialNumber => Ok ( Attribute :: SerialNumber ( val. to_vec ( ) ) ) ,
870
880
AttributeType :: Subject => Ok ( Attribute :: Subject ( val. to_vec ( ) ) ) ,
881
+ AttributeType :: UniqueId => Ok ( Attribute :: UniqueId ( val. to_vec ( ) ) ) ,
871
882
AttributeType :: Url => Ok ( Attribute :: Url ( val. to_vec ( ) ) ) ,
872
883
AttributeType :: Value => Ok ( Attribute :: Value ( val. to_vec ( ) ) ) ,
873
884
AttributeType :: Id => Ok ( Attribute :: Id ( val. to_vec ( ) ) ) ,
0 commit comments