JCOP45 and ALG_TYPE_MONT_DH_25519_PRIVATE

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

JCOP45 and ALG_TYPE_MONT_DH_25519_PRIVATE

1,236件の閲覧回数
SecureElement
Contributor II

trying to use the ALG_TYPE_MONT_DH_25519_PRIVATE.

below is a code stub of what I am trying to do.

private KeyPair eccKeyPair;

private Key eccKey;

 

eccKey = KeyBuilderX.buildKey(KeyBuilderX.ALG_TYPE_MONT_DH_25519_PRIVATE, (byte)0x00 );

eccKeyPair = new KeyPair(KeyBuilderX.ALG_TYPE_MONT_DH_25519_PRIVATE, (short)256);

 

Not sure how to create the key pair to use later on.  the new KeyPair comes back with ALG_NOT_SUPPORTED.

Trying to read documents but it is not clear on how to use this alg type

any help would be greatly appreciated

Mike

ラベル(2)
タグ(2)
0 件の賞賛
返信
3 返答(返信)

890件の閲覧回数
msjcard
Contributor III

eccKey = KeyBuilderX.buildKey(KeyBuilderX.ALG_TYPE_MONT_DH_25519_PRIVATE, (byte)0x00 );

eccKeyPair = new KeyPair(KeyBuilderX.ALG_TYPE_MONT_DH_25519_PRIVATE, (short)256);

The first part of this is almost correct - What you want is ECPrivateKey eccKey = (ECPrivateKey)....

You also want to create an  ECPublicKey using a similar form. 

Then use KeyBuilderX.genKeyPair (ecPubKey, ecPrivateKey); to generate the key material.

You *might* be able to also use the new KeyPair(pubKey, privKey) and then KeyPair.genKeyPair methods as well, but I'd stick to the NXP methods for the non-standard stuff. 

The construct in your second line won't work because the normal non-NXP Javacard "KeyPair" construct doesn't understand KeyBuilderX constants.

 

0 件の賞賛
返信

1,211件の閲覧回数
SecureElement
Contributor II

According to NXP documentation on JCOP 4.5 P71 D600,  they do support this algorithm as an add in library

0 件の賞賛
返信

1,217件の閲覧回数
prakashram72
Contributor III

Hi @SecureElement 

The error ALG_NOT_SUPPORTED indicates that the algorithm you're trying to use is not supported by the JCOP45 card. The JCOP45 card supports a limited number of algorithms and it seems that ALG_TYPE_MONT_DH_25519_PRIVATE is not one of them.

Here is a list of algorithms supported by JCOP45: JCOP45 Supported Algorithms

From the code snippet you've provided, it seems like you're trying to create a key pair for the Montgomery Curve Diffie-Hellman (MontDH) algorithm with a key length of 256 bits. However, the JCOP45 card may not support this specific algorithm or key length. You may need to use a different algorithm or key length that is supported by the JCOP45 card.

Here's an example of how to create a key pair using the RSA algorithm, which is supported by the JCOP45 card:

 private KeyPair rsaKeyPair; private Key rsaKey;
rsaKey = KeyBuilder.buildKey(KeyBuilder.TYPE_RSA_PRIVATE, KeyBuilder.LENGTH_RSA_2048, false); rsaKeyPair = new KeyPair(KeyPair.ALG_RSA, (short)2048);

Please note that the key length for RSA is 2048 bits in this example, which is supported by the JCOP45 card. You may need to adjust the key length based on your specific requirements and the capabilities of the JCOP45 card.

 

Hope this helps!

0 件の賞賛
返信