Illegal Value CryptoException when seeting ECC Private Key S value in JavaCardWarnings when using the Javacard ConverterJavaCard - pure software implementation of ECC over GF(2^n)how i can lock a javacard with a secret key?change GP-Key on JavaCardECC public and private keys settersJavacard send RSA Public Key in APDUComputing ECC public key from a private key in JavaCardNode.js generate ECC private keyError when trying to import a ECC private key with pythonJavacard - protect RSA private key with something other than a plaintext pin?

Probability that THHT occurs in a sequence of 10 coin tosses

How does a computer interpret real numbers?

What does "Scientists rise up against statistical significance" mean? (Comment in Nature)

How should I respond when I lied about my education and the company finds out through background check?

Is aluminum electrical wire used on aircraft?

Does the Linux kernel need a file system to run?

System.QueryException unexpected token

What if a revenant (monster) gains fire resistance?

Has any country ever had 2 former presidents in jail simultaneously?

Why is the "ls" command showing permissions of files in a FAT32 partition?

Limits and Infinite Integration by Parts

What should you do when eye contact makes your subordinate uncomfortable?

Do the primes contain an infinite almost arithmetic progression?

Does Doodling or Improvising on the Piano Have Any Benefits?

Yosemite Fire Rings - What to Expect?

Open a doc from terminal, but not by its name

Mixing PEX brands

How do apertures which seem too large to physically fit work?

Invalid date error by date command

How do you make your own symbol when Detexify fails?

Recommended PCB layout understanding - ADM2572 datasheet

How much character growth crosses the line into breaking the character

PTIJ: Haman's bad computer

Redundant comparison & "if" before assignment



Illegal Value CryptoException when seeting ECC Private Key S value in JavaCard


Warnings when using the Javacard ConverterJavaCard - pure software implementation of ECC over GF(2^n)how i can lock a javacard with a secret key?change GP-Key on JavaCardECC public and private keys settersJavacard send RSA Public Key in APDUComputing ECC public key from a private key in JavaCardNode.js generate ECC private keyError when trying to import a ECC private key with pythonJavacard - protect RSA private key with something other than a plaintext pin?













0















I am getting an CRYPTOEXCEPTION.ILLEGAL_VALUE when attempting to set an ECPrivateKey with its S,A,B,G,R,Field values manually for a SECP-256-R1 private key.



protected static byte[] EC_P256R1_FIELD_A = 
(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x01,
(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,
(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFC

;
protected static byte[] EC_P256R1_FIELD_B =
(byte)0x5A,(byte)0xC6,(byte)0x35,(byte)0xD8,(byte)0xAA,(byte)0x3A,(byte)0x93,(byte)0xE7,
(byte)0xB3,(byte)0xEB,(byte)0xBD,(byte)0x55,(byte)0x76,(byte)0x98,(byte)0x86,(byte)0xBC,
(byte)0x65,(byte)0x1D,(byte)0x06,(byte)0xB0,(byte)0xCC,(byte)0x53,(byte)0xB0,(byte)0xF6,
(byte)0x3B,(byte)0xCE,(byte)0x3C,(byte)0x3E,(byte)0x27,(byte)0xD2,(byte)0x60,(byte)0x4B

;
protected static byte[] EC_P256R1_FIELD_G =
(byte)0x04,
(byte)0x6B,(byte)0x17,(byte)0xD1,(byte)0xF2,(byte)0xE1,(byte)0x2C,(byte)0x42,(byte)0x47,
(byte)0xF8,(byte)0xBC,(byte)0xE6,(byte)0xE5,(byte)0x63,(byte)0xA4,(byte)0x40,(byte)0xF2,
(byte)0x77,(byte)0x03,(byte)0x7D,(byte)0x81,(byte)0x2D,(byte)0xEB,(byte)0x33,(byte)0xA0,
(byte)0xF4,(byte)0xA1,(byte)0x39,(byte)0x45,(byte)0xD8,(byte)0x98,(byte)0xC2,(byte)0x96,
(byte)0x4F,(byte)0xE3,(byte)0x42,(byte)0xE2,(byte)0xFE,(byte)0x1A,(byte)0x7F,(byte)0x9B,
(byte)0x8E,(byte)0xE7,(byte)0xEB,(byte)0x4A,(byte)0x7C,(byte)0x0F,(byte)0x9E,(byte)0x16,
(byte)0x2B,(byte)0xCE,(byte)0x33,(byte)0x57,(byte)0x6B,(byte)0x31,(byte)0x5E,(byte)0xCE,
(byte)0xCB,(byte)0xB6,(byte)0x40,(byte)0x68,(byte)0x37,(byte)0xBF,(byte)0x51,(byte)0xF5

;
protected static byte[] EC_P256R1_FIELD_R =
(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,
(byte)0xBC,(byte)0xE6,(byte)0xFA,(byte)0xAD,(byte)0xA7,(byte)0x17,(byte)0x9E,(byte)0x84,
(byte)0xF3,(byte)0xB9,(byte)0xCA,(byte)0xC2,(byte)0xFC,(byte)0x63,(byte)0x25,(byte)0x51

;
protected static byte[] EC_P256R1_FP = {
(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x01,
(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,
(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF

public void initSigner(byte[] input, short offset, short len)
ECPrivateKey tempKey = (ECPrivateKey) KeyBuilder.buildKey(KeyBuilder.TYPE_EC_FP_PRIVATE_TRANSIENT_RESET, KeyBuilder.LENGTH_EC_FP_256, false);
tempKey.setS(input, offset, len);
tempKey.setA(EC_P256R1_FIELD_A, (short) 0, (short) EC_P256R1_FIELD_A.length);
tempKey.setB(EC_P256R1_FIELD_B, (short) 0, (short) EC_P256R1_FIELD_B.length);
tempKey.setG(EC_P256R1_FIELD_G, (short) 0, (short) EC_P256R1_FIELD_G.length);
tempKey.setR(EC_P256R1_FIELD_R, (short) 0, (short) EC_P256R1_FIELD_R.length);
tempKey.setFieldFP(EC_P256R1_FP, (short) 0, (short) EC_P256R1_FP.length);
Signature signer = Signature.getInstance(Signature.ALG_ECDSA_SHA_256, true);
signer.init(tempKey, Signature.MODE_SIGN);



Is there anything I am missing out when setting the ECC P256R1 values manually and how do I get the above code to work ?










share|improve this question


























    0















    I am getting an CRYPTOEXCEPTION.ILLEGAL_VALUE when attempting to set an ECPrivateKey with its S,A,B,G,R,Field values manually for a SECP-256-R1 private key.



    protected static byte[] EC_P256R1_FIELD_A = 
    (byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x01,
    (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
    (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,
    (byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFC

    ;
    protected static byte[] EC_P256R1_FIELD_B =
    (byte)0x5A,(byte)0xC6,(byte)0x35,(byte)0xD8,(byte)0xAA,(byte)0x3A,(byte)0x93,(byte)0xE7,
    (byte)0xB3,(byte)0xEB,(byte)0xBD,(byte)0x55,(byte)0x76,(byte)0x98,(byte)0x86,(byte)0xBC,
    (byte)0x65,(byte)0x1D,(byte)0x06,(byte)0xB0,(byte)0xCC,(byte)0x53,(byte)0xB0,(byte)0xF6,
    (byte)0x3B,(byte)0xCE,(byte)0x3C,(byte)0x3E,(byte)0x27,(byte)0xD2,(byte)0x60,(byte)0x4B

    ;
    protected static byte[] EC_P256R1_FIELD_G =
    (byte)0x04,
    (byte)0x6B,(byte)0x17,(byte)0xD1,(byte)0xF2,(byte)0xE1,(byte)0x2C,(byte)0x42,(byte)0x47,
    (byte)0xF8,(byte)0xBC,(byte)0xE6,(byte)0xE5,(byte)0x63,(byte)0xA4,(byte)0x40,(byte)0xF2,
    (byte)0x77,(byte)0x03,(byte)0x7D,(byte)0x81,(byte)0x2D,(byte)0xEB,(byte)0x33,(byte)0xA0,
    (byte)0xF4,(byte)0xA1,(byte)0x39,(byte)0x45,(byte)0xD8,(byte)0x98,(byte)0xC2,(byte)0x96,
    (byte)0x4F,(byte)0xE3,(byte)0x42,(byte)0xE2,(byte)0xFE,(byte)0x1A,(byte)0x7F,(byte)0x9B,
    (byte)0x8E,(byte)0xE7,(byte)0xEB,(byte)0x4A,(byte)0x7C,(byte)0x0F,(byte)0x9E,(byte)0x16,
    (byte)0x2B,(byte)0xCE,(byte)0x33,(byte)0x57,(byte)0x6B,(byte)0x31,(byte)0x5E,(byte)0xCE,
    (byte)0xCB,(byte)0xB6,(byte)0x40,(byte)0x68,(byte)0x37,(byte)0xBF,(byte)0x51,(byte)0xF5

    ;
    protected static byte[] EC_P256R1_FIELD_R =
    (byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
    (byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,
    (byte)0xBC,(byte)0xE6,(byte)0xFA,(byte)0xAD,(byte)0xA7,(byte)0x17,(byte)0x9E,(byte)0x84,
    (byte)0xF3,(byte)0xB9,(byte)0xCA,(byte)0xC2,(byte)0xFC,(byte)0x63,(byte)0x25,(byte)0x51

    ;
    protected static byte[] EC_P256R1_FP = {
    (byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x01,
    (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
    (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,
    (byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF

    public void initSigner(byte[] input, short offset, short len)
    ECPrivateKey tempKey = (ECPrivateKey) KeyBuilder.buildKey(KeyBuilder.TYPE_EC_FP_PRIVATE_TRANSIENT_RESET, KeyBuilder.LENGTH_EC_FP_256, false);
    tempKey.setS(input, offset, len);
    tempKey.setA(EC_P256R1_FIELD_A, (short) 0, (short) EC_P256R1_FIELD_A.length);
    tempKey.setB(EC_P256R1_FIELD_B, (short) 0, (short) EC_P256R1_FIELD_B.length);
    tempKey.setG(EC_P256R1_FIELD_G, (short) 0, (short) EC_P256R1_FIELD_G.length);
    tempKey.setR(EC_P256R1_FIELD_R, (short) 0, (short) EC_P256R1_FIELD_R.length);
    tempKey.setFieldFP(EC_P256R1_FP, (short) 0, (short) EC_P256R1_FP.length);
    Signature signer = Signature.getInstance(Signature.ALG_ECDSA_SHA_256, true);
    signer.init(tempKey, Signature.MODE_SIGN);



    Is there anything I am missing out when setting the ECC P256R1 values manually and how do I get the above code to work ?










    share|improve this question
























      0












      0








      0








      I am getting an CRYPTOEXCEPTION.ILLEGAL_VALUE when attempting to set an ECPrivateKey with its S,A,B,G,R,Field values manually for a SECP-256-R1 private key.



      protected static byte[] EC_P256R1_FIELD_A = 
      (byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x01,
      (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
      (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,
      (byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFC

      ;
      protected static byte[] EC_P256R1_FIELD_B =
      (byte)0x5A,(byte)0xC6,(byte)0x35,(byte)0xD8,(byte)0xAA,(byte)0x3A,(byte)0x93,(byte)0xE7,
      (byte)0xB3,(byte)0xEB,(byte)0xBD,(byte)0x55,(byte)0x76,(byte)0x98,(byte)0x86,(byte)0xBC,
      (byte)0x65,(byte)0x1D,(byte)0x06,(byte)0xB0,(byte)0xCC,(byte)0x53,(byte)0xB0,(byte)0xF6,
      (byte)0x3B,(byte)0xCE,(byte)0x3C,(byte)0x3E,(byte)0x27,(byte)0xD2,(byte)0x60,(byte)0x4B

      ;
      protected static byte[] EC_P256R1_FIELD_G =
      (byte)0x04,
      (byte)0x6B,(byte)0x17,(byte)0xD1,(byte)0xF2,(byte)0xE1,(byte)0x2C,(byte)0x42,(byte)0x47,
      (byte)0xF8,(byte)0xBC,(byte)0xE6,(byte)0xE5,(byte)0x63,(byte)0xA4,(byte)0x40,(byte)0xF2,
      (byte)0x77,(byte)0x03,(byte)0x7D,(byte)0x81,(byte)0x2D,(byte)0xEB,(byte)0x33,(byte)0xA0,
      (byte)0xF4,(byte)0xA1,(byte)0x39,(byte)0x45,(byte)0xD8,(byte)0x98,(byte)0xC2,(byte)0x96,
      (byte)0x4F,(byte)0xE3,(byte)0x42,(byte)0xE2,(byte)0xFE,(byte)0x1A,(byte)0x7F,(byte)0x9B,
      (byte)0x8E,(byte)0xE7,(byte)0xEB,(byte)0x4A,(byte)0x7C,(byte)0x0F,(byte)0x9E,(byte)0x16,
      (byte)0x2B,(byte)0xCE,(byte)0x33,(byte)0x57,(byte)0x6B,(byte)0x31,(byte)0x5E,(byte)0xCE,
      (byte)0xCB,(byte)0xB6,(byte)0x40,(byte)0x68,(byte)0x37,(byte)0xBF,(byte)0x51,(byte)0xF5

      ;
      protected static byte[] EC_P256R1_FIELD_R =
      (byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
      (byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,
      (byte)0xBC,(byte)0xE6,(byte)0xFA,(byte)0xAD,(byte)0xA7,(byte)0x17,(byte)0x9E,(byte)0x84,
      (byte)0xF3,(byte)0xB9,(byte)0xCA,(byte)0xC2,(byte)0xFC,(byte)0x63,(byte)0x25,(byte)0x51

      ;
      protected static byte[] EC_P256R1_FP = {
      (byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x01,
      (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
      (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,
      (byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF

      public void initSigner(byte[] input, short offset, short len)
      ECPrivateKey tempKey = (ECPrivateKey) KeyBuilder.buildKey(KeyBuilder.TYPE_EC_FP_PRIVATE_TRANSIENT_RESET, KeyBuilder.LENGTH_EC_FP_256, false);
      tempKey.setS(input, offset, len);
      tempKey.setA(EC_P256R1_FIELD_A, (short) 0, (short) EC_P256R1_FIELD_A.length);
      tempKey.setB(EC_P256R1_FIELD_B, (short) 0, (short) EC_P256R1_FIELD_B.length);
      tempKey.setG(EC_P256R1_FIELD_G, (short) 0, (short) EC_P256R1_FIELD_G.length);
      tempKey.setR(EC_P256R1_FIELD_R, (short) 0, (short) EC_P256R1_FIELD_R.length);
      tempKey.setFieldFP(EC_P256R1_FP, (short) 0, (short) EC_P256R1_FP.length);
      Signature signer = Signature.getInstance(Signature.ALG_ECDSA_SHA_256, true);
      signer.init(tempKey, Signature.MODE_SIGN);



      Is there anything I am missing out when setting the ECC P256R1 values manually and how do I get the above code to work ?










      share|improve this question














      I am getting an CRYPTOEXCEPTION.ILLEGAL_VALUE when attempting to set an ECPrivateKey with its S,A,B,G,R,Field values manually for a SECP-256-R1 private key.



      protected static byte[] EC_P256R1_FIELD_A = 
      (byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x01,
      (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
      (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,
      (byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFC

      ;
      protected static byte[] EC_P256R1_FIELD_B =
      (byte)0x5A,(byte)0xC6,(byte)0x35,(byte)0xD8,(byte)0xAA,(byte)0x3A,(byte)0x93,(byte)0xE7,
      (byte)0xB3,(byte)0xEB,(byte)0xBD,(byte)0x55,(byte)0x76,(byte)0x98,(byte)0x86,(byte)0xBC,
      (byte)0x65,(byte)0x1D,(byte)0x06,(byte)0xB0,(byte)0xCC,(byte)0x53,(byte)0xB0,(byte)0xF6,
      (byte)0x3B,(byte)0xCE,(byte)0x3C,(byte)0x3E,(byte)0x27,(byte)0xD2,(byte)0x60,(byte)0x4B

      ;
      protected static byte[] EC_P256R1_FIELD_G =
      (byte)0x04,
      (byte)0x6B,(byte)0x17,(byte)0xD1,(byte)0xF2,(byte)0xE1,(byte)0x2C,(byte)0x42,(byte)0x47,
      (byte)0xF8,(byte)0xBC,(byte)0xE6,(byte)0xE5,(byte)0x63,(byte)0xA4,(byte)0x40,(byte)0xF2,
      (byte)0x77,(byte)0x03,(byte)0x7D,(byte)0x81,(byte)0x2D,(byte)0xEB,(byte)0x33,(byte)0xA0,
      (byte)0xF4,(byte)0xA1,(byte)0x39,(byte)0x45,(byte)0xD8,(byte)0x98,(byte)0xC2,(byte)0x96,
      (byte)0x4F,(byte)0xE3,(byte)0x42,(byte)0xE2,(byte)0xFE,(byte)0x1A,(byte)0x7F,(byte)0x9B,
      (byte)0x8E,(byte)0xE7,(byte)0xEB,(byte)0x4A,(byte)0x7C,(byte)0x0F,(byte)0x9E,(byte)0x16,
      (byte)0x2B,(byte)0xCE,(byte)0x33,(byte)0x57,(byte)0x6B,(byte)0x31,(byte)0x5E,(byte)0xCE,
      (byte)0xCB,(byte)0xB6,(byte)0x40,(byte)0x68,(byte)0x37,(byte)0xBF,(byte)0x51,(byte)0xF5

      ;
      protected static byte[] EC_P256R1_FIELD_R =
      (byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
      (byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,
      (byte)0xBC,(byte)0xE6,(byte)0xFA,(byte)0xAD,(byte)0xA7,(byte)0x17,(byte)0x9E,(byte)0x84,
      (byte)0xF3,(byte)0xB9,(byte)0xCA,(byte)0xC2,(byte)0xFC,(byte)0x63,(byte)0x25,(byte)0x51

      ;
      protected static byte[] EC_P256R1_FP = {
      (byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x01,
      (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
      (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,
      (byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF

      public void initSigner(byte[] input, short offset, short len)
      ECPrivateKey tempKey = (ECPrivateKey) KeyBuilder.buildKey(KeyBuilder.TYPE_EC_FP_PRIVATE_TRANSIENT_RESET, KeyBuilder.LENGTH_EC_FP_256, false);
      tempKey.setS(input, offset, len);
      tempKey.setA(EC_P256R1_FIELD_A, (short) 0, (short) EC_P256R1_FIELD_A.length);
      tempKey.setB(EC_P256R1_FIELD_B, (short) 0, (short) EC_P256R1_FIELD_B.length);
      tempKey.setG(EC_P256R1_FIELD_G, (short) 0, (short) EC_P256R1_FIELD_G.length);
      tempKey.setR(EC_P256R1_FIELD_R, (short) 0, (short) EC_P256R1_FIELD_R.length);
      tempKey.setFieldFP(EC_P256R1_FP, (short) 0, (short) EC_P256R1_FP.length);
      Signature signer = Signature.getInstance(Signature.ALG_ECDSA_SHA_256, true);
      signer.init(tempKey, Signature.MODE_SIGN);



      Is there anything I am missing out when setting the ECC P256R1 values manually and how do I get the above code to work ?







      cryptography javacard






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked yesterday









      thotheolhthotheolh

      2,73862440




      2,73862440






















          1 Answer
          1






          active

          oldest

          votes


















          0














          I figured out that the particular card does not support KeyBuilder.TYPE_EC_FP_PRIVATE_TRANSIENT_RESET thus the reason why it kept throwing CRYPTOEXCEPTION.ILLEGAL_VALUE.






          share|improve this answer






















            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55280642%2fillegal-value-cryptoexception-when-seeting-ecc-private-key-s-value-in-javacard%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            I figured out that the particular card does not support KeyBuilder.TYPE_EC_FP_PRIVATE_TRANSIENT_RESET thus the reason why it kept throwing CRYPTOEXCEPTION.ILLEGAL_VALUE.






            share|improve this answer



























              0














              I figured out that the particular card does not support KeyBuilder.TYPE_EC_FP_PRIVATE_TRANSIENT_RESET thus the reason why it kept throwing CRYPTOEXCEPTION.ILLEGAL_VALUE.






              share|improve this answer

























                0












                0








                0







                I figured out that the particular card does not support KeyBuilder.TYPE_EC_FP_PRIVATE_TRANSIENT_RESET thus the reason why it kept throwing CRYPTOEXCEPTION.ILLEGAL_VALUE.






                share|improve this answer













                I figured out that the particular card does not support KeyBuilder.TYPE_EC_FP_PRIVATE_TRANSIENT_RESET thus the reason why it kept throwing CRYPTOEXCEPTION.ILLEGAL_VALUE.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered yesterday









                thotheolhthotheolh

                2,73862440




                2,73862440





























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55280642%2fillegal-value-cryptoexception-when-seeting-ecc-private-key-s-value-in-javacard%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                    Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript