IBM Crypto Education Community

IBM Crypto Education Community

IBM Crypto Education Community

Join the IBM Crypto Education community to explore and understand IBM cryptography technology. This community is operated and maintained by the IBM Crypto Development team.

 View Only
  • 1.  TR-34 key distribution error 8/847 questions

    Posted Fri March 06, 2026 01:19 PM

    Hello everyone.  I'm creating a TR-34 keyblock to send to a device. 

    8/847(2119) - "Mode" value in the TR-31 header is invalid or is not acceptable in the chosen operation.  User Action: Check the TR-31 key block header for correctness.

    This call succeeded when I was using rule ENC-ONLY.  When I changed to DEC-ONLY at a request of the device (the only thing I changed), I got this error.

    I think it is telling me that the DES key that I am wrapping was compatible with ENC-ONLY but not compatible with DEC-ONLY and as a result I need to generate a DES key that will match the DEC-ONLY setting.   But I am not sure.  Can anyone let me know if I'm on the right track?

    I'm looking at a table in the APG  (Table 408. Export translation table for DES keys in TR-34 key blocks) and the column Offset (hex) has no meaning to me.  Can someone explain what that column of information is telling me?

    Thanks for your help.

    Sincerely,

    Mark



    ------------------------------
    Mark Vollmer
    Developer, but does everything.
    CV Systems, LLC
    ------------------------------


  • 2.  RE: TR-34 key distribution error 8/847 questions

    Posted Fri March 06, 2026 04:39 PM

    That column is the ACP number (in hex) for the operation listed to the left. That said, that table is for TR-31 Import. Can you say which service you are using? I suspect that table is unrelated to the service you are using.



    ------------------------------
    Eric Rossman
    ------------------------------



  • 3.  RE: TR-34 key distribution error 8/847 questions

    Posted Mon March 09, 2026 12:12 PM

    Eric,

    Thanks for helping me out.   I'm sure the table applies to TR-34 in this case.  

    The DES key I'm trying to export has the following settings during key gen:  OPEX, EXPORTER, IMPORTER.  I also provide a key token that I build with EXPORTER & NOCV settings for the operational EXPORTER key on the key gen command.   I think this gives me an operation exporter with a nocv attribute as one of the key pair.  And the other is an external token IMPORTER key, likely without the NOCV attribute.

    I then pass the operational exporter key to the TR-34 as the source key, and using the ENC-ONLY flag.  This call completes successfully, but my partner doesn't like the TR-31 attribute of ENC-ONLY and wants me to use DEC-ONLY.

    So I altered ENC-ONLY to DEC-ONLY to make the next call.  And I'm going to believe that the error returned (and noted above) probably means that DEC-ONLY and an EXPORTER key isn't a valid acceptable (or permitted?) combination thereby returning the error I noted above.

    In my next test, I've altered the TR-34 export call to use the external IMPORTER key.  I've added the key unwrap exporter key to the parmlist.   I've left the DEC-ONLY parameter on the rule list.

    I now get a x27/39 (Control Vector Violation) error on this new version of the call.   And I'm wondering if this error might be because my external IMPORTER key does not have the NOCV attribute.  And that maybe I need to build a key token for this half of the key pair as well.  

    Does this sound reasonable or should I be looking elsewhere?

    Sincerely,

    Mark



    ------------------------------
    Mark Vollmer
    Developer, but does everything.
    CV Systems, LLC
    ------------------------------



  • 4.  RE: TR-34 key distribution error 8/847 questions

    Posted Mon March 09, 2026 12:19 PM

    Which callable service(s) are you using? You say "DES key I'm trying to export has the following settings during key gen:  OPEX, EXPORTER, IMPORTER".

    Then you said "TR-34 export call to use the external IMPORTER key". Are you referring to TR-34 Key Distribution (CSNDT34D and CSNFT34D)?

    I need to know the specific services and rules you are using to be able to understand where it is going sideways.



    ------------------------------
    Eric Rossman
    ------------------------------



  • 5.  RE: TR-34 key distribution error 8/847 questions

    Posted Tue March 10, 2026 08:52 AM

    Eric,

    I'm using a key gen call to create the DES key I want to export via TR-34 call CSNDT34D.   You are correct.

    Sincerely,

    Mark



    ------------------------------
    Mark Vollmer
    Developer, but does everything.
    CV Systems, LLC
    ------------------------------



  • 6.  RE: TR-34 key distribution error 8/847 questions

    Posted Tue March 10, 2026 12:42 PM

    I think I understand your problem more clearly now. So, if you are trying to export (via TR-34 distribute) an IMPORTER, you would need DEC-ONLY, as you noted. If that IMPORTER is already external, you would need the IMPORTER key that matches the EXPORTER used in CSNBKGN.

    A control vector violation tells me that one of the input keys doesn't meet the needs. This is a bit more complicated than is easy to solve in the community, but if you want to keep working here, I'm OK with that. What I need to know are the specific inputs for both KGN and T34D. I don't need to know key values or anything, but I need to know what the rules are, what kind of key is being used (external or internal, key types, any unique key attributes, etc) for each parm.



    ------------------------------
    Eric Rossman
    ------------------------------



  • 7.  RE: TR-34 key distribution error 8/847 questions

    Posted Wed March 11, 2026 11:39 AM

    Eric,

    Thanks very much for helping me out.  Hopefully this has all the details you need:


    Key Token Build - EXPORTER (TYPE) 
        KEY-TOKEN : LV
        KEY-TYPE : EXPORTER
        RULES: INTERNAL, NOCV-KEK
        KEY-VALUE : LV
        KEY-MKVN : ZERO
        KEY-KRN : ZERO
        KEY-SECURE-TOKEN: LV
        CTL-V : LV
        INIT-V : LV
        KEY-PAD : ZERO
        KEY-CPS : LV
        KEY-MVP : LV

    Move that created token into ID1 of the KEYGEN call.

    Key Gen - OPEX (KEYFORM), DOUBLE (KEYLEN), EXPORTER (TYPE1), IMPORTER(TYPE2), 
        LOW-VALUES (KEY-ID1), DOUBLE LEN DES EXPORTER KEY WITH NOCV ATTRIBUTE (KEK)
        AFOREMENTIONED KEY TOKEN (GEN-ID1), LOW-VALUES (GEN-ID2). 

    CSNDT34D - RULES: 2PASSCRE, PKI-NONE, SKEY-DES, VARDRV-B, T34-2019, DEC-ONLY, EXP-NONE, KEK-WRAP
         SRC KEY LEN : 64
        SRC KEY : GEN-ID2 FROM KEYGEN (IMPORTER EXTERNAL)
        UNWRAP LEN: 64
        UNWRAP KEY: SAME LABEL USED WITH KEY GEN (KEK FIELD).
        RAND-TOKEN-LEN : DON'T REMEMBER BUT CAN LOOK UP AT SOME POINT
        RAND-TOKEN : THE RANDOM NUMBER IN T34 TOKEN FORM
        CRL-LEN - WHATEVER THE LENGTH
        CRL - DER ENCODED CRL
        HOST-CERT-LEN - WHATEVER THE LENGTH
        HOST-CERT - DER ENCODED HOST CERTIFICATE
        ATM-CERT-LEN - WHATEVER THE LENGTH
        ATM-CERT - DER ENCODED ATM CERTIFICATE
        HSTPRIV-RSA-LEN : 64
        HSTPRIV-RSA : LABEL OF PRIVATE RSA KEY
        TR31-KB-VER : ZERP
        OPTBLKS LEN: 0
        OPTBLKS: LV
        OUT-TR34KB-LEN : A LARGE BLOCK LENGTH
        OUT-TR34KB : L


    Key Token Build - EXPORTER (TYPE) 
        KEY-TOKEN : LV
        KEY-TYPE : EXPORTER
        RULES: INTERNAL, NOCV-KEK
        KEY-VALUE : LV
        KEY-MKVN : ZERO
        KEY-KRN : ZERO
        KEY-SECURE-TOKEN: LV
        CTL-V : LV
        INIT-V : LV
        KEY-PAD : ZERO
        KEY-CPS : LV
        KEY-MVP : LV

    Move that created token into ID1 of the KEYGEN call.

    Key Gen - OPEX (KEYFORM), DOUBLE (KEYLEN), EXPORTER (TYPE1), IMPORTER(TYPE2), 
        LOW-VALUES (KEY-ID1), DOUBLE LEN DES EXPORTER KEY WITH NOCV ATTRIBUTE (KEK)
        AFOREMENTIONED KEY TOKEN (GEN-ID1), LOW-VALUES (GEN-ID2). 

    CSNDT34D - RULES: 2PASSCRE, PKI-NONE, SKEY-DES, VARDRV-B, T34-2019, DEC-ONLY, EXP-NONE, KEK-WRAP
         SRC KEY LEN : 64
        SRC KEY : GEN-ID2 FROM KEYGEN (IMPORTER EXTERNAL)
        UNWRAP LEN: 64
        UNWRAP KEY: SAME LABEL USED WITH KEY GEN (KEK FIELD).
        RAND-TOKEN-LEN : DON'T REMEMBER BUT CAN LOOK UP AT SOME POINT
        RAND-TOKEN : THE RANDOM NUMBER IN T34 TOKEN FORM
        CRL-LEN - WHATEVER THE LENGTH
        CRL - DER ENCODED CRL
        HOST-CERT-LEN - WHATEVER THE LENGTH
        HOST-CERT - DER ENCODED HOST CERTIFICATE
        ATM-CERT-LEN - WHATEVER THE LENGTH
        ATM-CERT - DER ENCODED ATM CERTIFICATE
        HSTPRIV-RSA-LEN : 64
        HSTPRIV-RSA : LABEL OF PRIVATE RSA KEY
        TR31-KB-VER : ZERP
        OPTBLKS LEN: 0
        OPTBLKS: LV
        OUT-TR34KB-LEN : A LARGE BLOCK LENGTH
        OUT-TR34KB : LV
        RESERVED LEN : 0
        RESERVED : LV

    Sincerely,

    Mark



    ------------------------------
    Mark Vollmer
    Developer, but does everything.
    CV Systems, LLC
    ------------------------------



  • 8.  RE: TR-34 key distribution error 8/847 questions

    Posted Wed March 11, 2026 11:39 AM

    Eric,

    I've reformatted the KEY GEN call (part of the prior message) to try and make sure it is clarified.

    Key Gen - KEY FORM: OPEX
        KEYLEN : DOUBLE
        TYPE1  : EXPORTER
        TYPE2  : IMPORTER
        KEY ID1: LV
        KEK    : LABEL FOR EXPORTER UTILITY KEY  (DOUBLE LEN EXPORTER KEY WITH NOCV ATTRIBUTE)
        GEN-ID1: AFOREMENTIONED KEY TOKEN
        GEN-ID2: LV    LOW-VALUES (KEY-ID1)

    Sincerely, 

    Mark



    ------------------------------
    Mark Vollmer
    Developer, but does everything.
    CV Systems, LLC
    ------------------------------



  • 9.  RE: TR-34 key distribution error 8/847 questions

    Posted 29 days ago

    Eric,

    I've made progress.  

    I took the external IMPORTER key that I genned at the start and re-imported it back to an internal token.  

    I passed that internal token as my source key.  And I've removed the unwrap key and its length.

    It seems that using the external form of that same key with the exporter key I exported it with during the key gen, did not work. 

    I cannot explain why one version works but the other does not.   I have every reason to believe either should work.

    If you or someone can enlighten me, I'd love to hear it.

    Sincerely,

    Mark



    ------------------------------
    Mark Vollmer
    Developer, but does everything.
    CV Systems, LLC
    ------------------------------