Ich arbeite an Luna G5 HSM und muss ein Schlüsselpaar generieren. Ich habe den Code wie folgt, aber es gibt einen Fehler, sagte ich muss das Attribut der öffentlichen Exponenten zu einem Byte-Array ändern, aber ich weiß nicht, wie Sie diesen Teil ändern, würde jede Hilfe wirklich zu schätzen wissen.So ändern Sie das Attribut des öffentlichen Exponenten als Byte-Array
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"))
Bitte sachgemäßen Tags hinzufügen. Wenn Sie den Mauszeiger über das Tag 'hsm' halten, wird keine Programmiersprache erwähnt. – reporter