2017-07-11 7 views
0

私はLuna G5 HSMに取り組んでおり、キーペアを生成する必要があります。私は次のようなコードを持っていますが、パブリック指数属性をバイト配列に変更する必要があるというエラーがありますが、この部分を修正する方法はわかりません。パブリック指数属性をバイト配列に変更する方法

templatePub = new CryptokiCollection() 
     templatePub.Add(new ObjectAttribute(ObjectAttribute.CKA_CLASS,CryptokiObject.CKO_PUBLIC_KEY)) 
     templatePub.Add(new ObjectAttribute(ObjectAttribute.CKA_TOKEN, true)) 
     templatePub.Add(new ObjectAttribute(ObjectAttribute.CKA_SENSITIVE, false)) 
     templatePub.Add(new ObjectAttribute(ObjectAttribute.CKA_MODIFIABLE, false)) 
     templatePub.Add(new ObjectAttribute(ObjectAttribute.CKA_EXTRACTABLE, false)) 
     templatePub.Add(new ObjectAttribute(ObjectAttribute.CKA_ENCRYPT, true)) 
     templatePub.Add(new ObjectAttribute(ObjectAttribute.CKA_VERIFY, true)) 
     templatePub.Add(new ObjectAttribute(ObjectAttribute.CKA_WRAP, true)) 
     templatePub.Add(new ObjectAttribute(ObjectAttribute.CKA_DERIVE, false)) 
     templatePub.Add(new ObjectAttribute(ObjectAttribute.CKA_MODULUS_BITS, 2048)) 
     templatePub.Add(new ObjectAttribute(ObjectAttribute.CKA_PUBLIC_EXPONENT, 0x010001)) 
     templatePub.Add(new ObjectAttribute(ObjectAttribute.CKA_ID, "60")); 
     templatePub.Add(new ObjectAttribute(ObjectAttribute.CKA_LABEL, "public key")) 


     templatePri = new CryptokiCollection() 
     templatePri.Add(new ObjectAttribute(ObjectAttribute.CKA_CLASS, CryptokiObject.CKO_PRIVATE_KEY)) 
     templatePri.Add(new ObjectAttribute(ObjectAttribute.CKA_TOKEN, true)) 
     templatePri.Add(new ObjectAttribute(ObjectAttribute.CKA_SENSITIVE, true)) 
     templatePri.Add(new ObjectAttribute(ObjectAttribute.CKA_MODIFIABLE, false)) 
     templatePri.Add(new ObjectAttribute(ObjectAttribute.CKA_EXTRACTABLE, false)) 
     templatePri.Add(new ObjectAttribute(ObjectAttribute.CKA_DECRYPT, true)) 
     templatePri.Add(new ObjectAttribute(ObjectAttribute.CKA_SIGN, true)) 
     templatePri.Add(new ObjectAttribute(ObjectAttribute.CKA_UNWRAP, true)) 
     templatePri.Add(new ObjectAttribute(ObjectAttribute.CKA_DERIVE, false)) 
     templatePri.Add(new ObjectAttribute(ObjectAttribute.CKA_ID, "60")) 
     templatePri.Add(new ObjectAttribute(ObjectAttribute.CKA_LABEL, "private key")) 
+0

appropiateタグを追加してください。タグ 'hsm'の上にカーソルを置くと、プログラミング言語は記述されません。 – reporter

答えて

0

この1と公開指数ラインを置き換えます

templatePub.Add(New ObjectAttribute(ObjectAttribute.CKA_PUBLIC_EXPONENT, &H10001)) 
+0

ありがとうございます、この問題はすでに解決しました。 – ccy

関連する問題