text: /*
   * If not stated otherwise in this file or this component's Licenses.txt file the
   * following copyright and licenses apply:
   *
   * Copyright 2015 RDK Management
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   * http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
  */
  
  /**********************************************************************
     Copyright [2014] [Cisco Systems, Inc.]
   
     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at
   
         http://www.apache.org/licenses/LICENSE-2.0
   
     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
  **********************************************************************/
  
  /**********************************************************************
  
      MODULE: asn1_pfx_interface.h
  
          ASN.1 ANSC Code Generated by Cisco Systems, Inc.
  
      ---------------------------------------------------------------
  
      DESCRIPTION:
  
          The ASN.1 object defined in this file
  
          *   ASN1_PFX
          *   ASN1_MACDATA
          *   ASN1_AUTHENTICATEDSAFE
          *   ASN1_SAFECONTENTS
          *   ASN1_SAFEBAG
          *   ASN1_PKCS12ATTRIBUTES
          *   ASN1_PKCS12ATTRIBUTE
          *   ASN1_KEYBAG
          *   ASN1_PKCS8SHROUDEDKEYBAG
          *   ASN1_CERTBAG
          *   ASN1_CERTVALUE
          *   ASN1_CRLBAG
          *   ASN1_CRLVALUE
          *   ASN1_SECRETBAG
          *   ASN1_BAGVALUE
  
  
      ---------------------------------------------------------------
  
      ENVIRONMENT:
  
          platform independent
  
      ---------------------------------------------------------------
  
      AUTHOR:
  
          ASNMAGIC ANSC CODE GENERATOR 1.0
  
      ---------------------------------------------------------------
  
      REVISION HISTORY:
  
          *   12/13/2002  initial revision
  
   **********************************************************************/
  
  
  #ifndef  _ASN1_PFX_INTERFACE_H
  #define  _ASN1_PFX_INTERFACE_H
  
  /**********************************************************************
  
   OBJECT -- ASN1_PFX
  
   PFX ::= Sequence 
       {
                             version Integer 
                            authSafe ContentInfo 
                             macData MacData OPT
       }
  
   **********************************************************************/
  typedef ANSC_STATUS
  (*PFN_PFX_ACTION)
      (
          ANSC_HANDLE                 hThisObject,
          ANSC_HANDLE                 hPKCSUtility,
          PCHAR                       pPassword
      );
  
  typedef ANSC_STATUS
  (*PFN_ENUM_CERT_KEY_PROC)
      (
          ANSC_HANDLE                 hContext,
          PUCHAR                      pCertEncoding,
          ULONG                       ulCertSize,
          PUCHAR                      pKeyEncoding,
          ULONG                       ulKeyInfoSize
      );
  
  typedef ANSC_STATUS
  (*PFN_PFX_PKCS12_ENUMERATE)
      (
          ANSC_HANDLE                 hThisObject,
          PFN_ENUM_CERT_KEY_PROC      proc,
          ANSC_HANDLE                 hContext
      );
  
  typedef ANSC_STATUS
  (*PFN_PFX_PKCS12_INIT_1)
      (
          ANSC_HANDLE                 hThisObject,
          PUCHAR                      pEncoding,
          ULONG                       ulSize
      );
  
  typedef ANSC_STATUS
  (*PFN_PFX_PKCS12_INIT_2)
      (
          ANSC_HANDLE                 hThisObject,
          PUCHAR                      pCertEncoding,
          ULONG                       ulCertSize,
          PUCHAR                      pKeyEncoding,
          ULONG                       ulKeyInfoSize
      );
  
  typedef ANSC_HANDLE
  (*PFN_PFX_LOOKFOR_KEYBAG)
      (
          ANSC_HANDLE                 hThisObject,
          ANSC_HANDLE                 hLocalKeyID
      );
  
  #define  ANSC_ASN1_PFX_CLASS_CONTENT                                  \
      /* duplication of the base object class content */                \
      ANSC_ASN1_SEQUENCE_CLASS_CONTENT                                  \
      /* start of object class content */                               \
      PFN_ASN1_GET_CHILD              GetVersion;                       \
      PFN_ASN1_GET_CHILD              GetAuthSafe;                      \
      PFN_ASN1_GET_CHILD              GetMacData;                       \
                                                                        \
      PFN_PFX_ACTION                  HmacAuthenticate;                 \
      PFN_PFX_ACTION                  DecryptContent;                   \
      PFN_PFX_ACTION                  EncryptAndSign;                   \
      PFN_PFX_PKCS12_ENUMERATE        EnumerateInfo;                    \
      PFN_PFX_PKCS12_INIT_1           AddCertificate;                   \
      PFN_PFX_PKCS12_INIT_2           AddCertAndKeyInfo;                \
      PFN_PFX_LOOKFOR_KEYBAG          LookforKeyInfoBag;                \
      /* end of object class content */                                 \
  
  typedef  struct
  _ANSC_ASN1_PFX
  {
      ANSC_ASN1_PFX_CLASS_CONTENT
  }
  ANSC_ASN1_PFX,  *PANSC_ASN1_PFX;
  
  #define  ACCESS_ANSC_ASN1_PFX(p)    \
           ACCESS_CONTAINER(p, ANSC_ASN1_PFX, Linkage)
  
  /**********************************************************************
  
   OBJECT -- ASN1_MACDATA
  
   MacData ::= Sequence 
       {
                                 mac DigestInfo 
                             macSalt OctetString 
                          iterations Integer DEF
       }
  
   **********************************************************************/
  
  #define  ANSC_ASN1_MACDATA_CLASS_CONTENT                ANSC_ASN1_SEQUENCE_CLASS_CONTENT
  
  typedef  struct
  _ANSC_ASN1_MACDATA
  {
      ANSC_ASN1_MACDATA_CLASS_CONTENT
  }
  ANSC_ASN1_MACDATA,  *PANSC_ASN1_MACDATA;
  
  #define  ACCESS_ANSC_ASN1_MACDATA(p)    \
           ACCESS_CONTAINER(p, ANSC_ASN1_MACDATA, Linkage)
  
  /**********************************************************************
  
   OBJECT -- ASN1_AUTHENTICATEDSAFE
  
   AuthenticatedSafe ::= SequenceOf ContentInfo  {}
  
   **********************************************************************/
  
  #define  ANSC_ASN1_AUTHENTICATEDSAFE_CLASS_CONTENT                    \
      /* duplication of the base object class content */                \
      ANSC_ASN1_SEQUENCEOF_CLASS_CONTENT                                \
      /* start of object class content */                               \
      PFN_PFX_ACTION                  DecryptContent;                   \
      /* end of object class content */                                 \
  
  typedef  struct
  _ANSC_ASN1_AUTHENTICATEDSAFE
  {
      ANSC_ASN1_AUTHENTICATEDSAFE_CLASS_CONTENT
  }
  ANSC_ASN1_AUTHENTICATEDSAFE,  *PANSC_ASN1_AUTHENTICATEDSAFE;
  
  #define  ACCESS_ANSC_ASN1_AUTHENTICATEDSAFE(p)    \
           ACCESS_CONTAINER(p, ANSC_ASN1_AUTHENTICATEDSAFE, Linkage)
  
  /**********************************************************************
  
   OBJECT -- ASN1_SAFECONTENTS
  
   SafeContents ::= SequenceOf SafeBag  {}
  
   **********************************************************************/
  
  #define  ANSC_ASN1_SAFECONTENTS_CLASS_CONTENT           ANSC_ASN1_SEQUENCEOF_CLASS_CONTENT
  
  typedef  struct
  _ANSC_ASN1_SAFECONTENTS
  {
      ANSC_ASN1_SAFECONTENTS_CLASS_CONTENT
  }
  ANSC_ASN1_SAFECONTENTS,  *PANSC_ASN1_SAFECONTENTS;
  
  #define  ACCESS_ANSC_ASN1_SAFECONTENTS(p)    \
           ACCESS_CONTAINER(p, ANSC_ASN1_SAFECONTENTS, Linkage)
  
  /**********************************************************************
  
   OBJECT -- ASN1_SAFEBAG
  
   SafeBag ::= Sequence 
       {
                               bagID OID 
                            bagValue [CON 0] BagValue 
                       bagAttributes PKCS12Attributes OPT
       }
  
   **********************************************************************/
  typedef BOOLEAN
  (*PFN_SAFEBAG_CHECK)
      (
          ANSC_HANDLE                 hThisObject
      );
  
  typedef BOOLEAN
  (*PFN_SAFEBAG_CHECK_2)
      (
          ANSC_HANDLE                 hThisObject,
          BOOLEAN                     bFlag
      );
  
  typedef ANSC_HANDLE
  (*PFN_SAFEBAG_GET_LOCALKEYID)
      (
          ANSC_HANDLE                 hThisObject
      );
  
  typedef ANSC_HANDLE
  (*PFN_SAFEBAG_GET_VALUEHANDLE)
      (
          ANSC_HANDLE                 hThisObject
      );
  
  typedef ANSC_STATUS
  (*PFN_SAFEBAG_SET_LOCALKEYID)
      (
          ANSC_HANDLE                 hThisObject,
          ULONG                       uKeyID
      );
  
  typedef ANSC_STATUS
  (*PFN_SAFEBAG_SET_ACTION)
      (
          ANSC_HANDLE                 hThisObject,
          PUCHAR                      pEncoding,
          ULONG                       uLength
      );
  
  #define  ANSC_ASN1_SAFEBAG_CLASS_CONTENT                              \
      /* duplication of the base object class content */                \
      ANSC_ASN1_SEQUENCE_CLASS_CONTENT                                  \
      /* start of object class content */                               \
      PFN_ASN1_GET_CHILD              GetBagID;                         \
      PFN_ASN1_GET_CHILD              GetBagValue;                      \
      PFN_ASN1_GET_CHILD              GetBagAttributes;                 \
                                                                        \
      PFN_SAFEBAG_CHECK               IsCertBag;                        \
      PFN_SAFEBAG_CHECK_2             IsKeyInfoBag;                     \
      PFN_SAFEBAG_GET_LOCALKEYID      GetLocalKeyIDObj;                 \
      PFN_SAFEBAG_GET_VALUEHANDLE     GetValueHandle;                   \
      PFN_SAFEBAG_SET_LOCALKEYID      SetLocalKeyID;                    \
      PFN_SAFEBAG_SET_ACTION          SetCertInfo;                      \
      PFN_SAFEBAG_SET_ACTION          SetKeyInfo;                       \
      /* end of object class content */                                 \
  
  typedef  struct
  _ANSC_ASN1_SAFEBAG
  {
      ANSC_ASN1_SAFEBAG_CLASS_CONTENT
  }
  ANSC_ASN1_SAFEBAG,  *PANSC_ASN1_SAFEBAG;
  
  #define  ACCESS_ANSC_ASN1_SAFEBAG(p)    \
           ACCESS_CONTAINER(p, ANSC_ASN1_SAFEBAG, Linkage)
  
  /**********************************************************************
  
   OBJECT -- ASN1_PKCS12ATTRIBUTES
  
   PKCS12Attributes ::= SetOf PKCS12Attribute  {}
  
   **********************************************************************/
  
  #define  ANSC_ASN1_PKCS12ATTRIBUTES_CLASS_CONTENT       ANSC_ASN1_SETOF_CLASS_CONTENT
  
  typedef  struct
  _ANSC_ASN1_PKCS12ATTRIBUTES
  {
      ANSC_ASN1_PKCS12ATTRIBUTES_CLASS_CONTENT
  }
  ANSC_ASN1_PKCS12ATTRIBUTES,  *PANSC_ASN1_PKCS12ATTRIBUTES;
  
  #define  ACCESS_ANSC_ASN1_PKCS12ATTRIBUTES(p)    \
           ACCESS_CONTAINER(p, ANSC_ASN1_PKCS12ATTRIBUTES, Linkage)
  
  /**********************************************************************
  
   OBJECT -- ASN1_PKCS12ATTRIBUTE
  
   PKCS12Attribute ::= Attribute 
  
   **********************************************************************/
  
  #define  ANSC_ASN1_PKCS12ATTRIBUTE_CLASS_CONTENT        ANSC_ASN1_ATTRIBUTE_CLASS_CONTENT
  
  typedef  struct
  _ANSC_ASN1_PKCS12ATTRIBUTE
  {
      ANSC_ASN1_PKCS12ATTRIBUTE_CLASS_CONTENT
  }
  ANSC_ASN1_PKCS12ATTRIBUTE,  *PANSC_ASN1_PKCS12ATTRIBUTE;
  
  #define  ACCESS_ANSC_ASN1_PKCS12ATTRIBUTE(p)    \
           ACCESS_CONTAINER(p, ANSC_ASN1_PKCS12ATTRIBUTE, Linkage)
  
  /**********************************************************************
  
   OBJECT -- ASN1_KEYBAG
  
   KeyBag ::= PrivateKeyInfo 
  
   **********************************************************************/
  
  #define  ANSC_ASN1_KEYBAG_CLASS_CONTENT                 ANSC_ASN1_PRIVATEKEYINFO_CLASS_CONTENT
  
  typedef  struct
  _ANSC_ASN1_KEYBAG
  {
      ANSC_ASN1_KEYBAG_CLASS_CONTENT
  }
  ANSC_ASN1_KEYBAG,  *PANSC_ASN1_KEYBAG;
  
  #define  ACCESS_ANSC_ASN1_KEYBAG(p)    \
           ACCESS_CONTAINER(p, ANSC_ASN1_KEYBAG, Linkage)
  
  /**********************************************************************
  
   OBJECT -- ASN1_PKCS8SHROUDEDKEYBAG
  
   PKCS8ShroudedKeyBag ::= EncryptedPrivateKeyInfo 
  
   **********************************************************************/
  
  #define  ANSC_ASN1_PKCS8SHROUDEDKEYBAG_CLASS_CONTENT     ANSC_ASN1_ENCRYPTEDPRIVATEKEYINFO_CLASS_CONTENT
  
  typedef  struct
  _ANSC_ASN1_PKCS8SHROUDEDKEYBAG
  {
      ANSC_ASN1_PKCS8SHROUDEDKEYBAG_CLASS_CONTENT
  }
  ANSC_ASN1_PKCS8SHROUDEDKEYBAG,  *PANSC_ASN1_PKCS8SHROUDEDKEYBAG;
  
  #define  ACCESS_ANSC_ASN1_PKCS8SHROUDEDKEYBAG(p)    \
           ACCESS_CONTAINER(p, ANSC_ASN1_PKCS8SHROUDEDKEYBAG, Linkage)
  
  /**********************************************************************
  
   OBJECT -- ASN1_CERTBAG
  
   CertBag ::= Sequence 
       {
                           certTypes OID 
                           certValue [CON 0] CertValue 
       }
  
   **********************************************************************/
  typedef ANSC_HANDLE
  (*PFN_CERTBAG_GET_CERTOBJ)
      (
          ANSC_HANDLE                 hThisObject
      );
  
  #define  ANSC_ASN1_CERTBAG_CLASS_CONTENT                              \
      /* duplication of the base object class content */                \
      ANSC_ASN1_SEQUENCE_CLASS_CONTENT                                  \
      /* start of object class content */                               \
      PFN_CERTBAG_GET_CERTOBJ         GetCertObject;                    \
      /* end of object class content */                                 \
  
  typedef  struct
  _ANSC_ASN1_CERTBAG
  {
      ANSC_ASN1_CERTBAG_CLASS_CONTENT
  }
  ANSC_ASN1_CERTBAG,  *PANSC_ASN1_CERTBAG;
  
  #define  ACCESS_ANSC_ASN1_CERTBAG(p)    \
           ACCESS_CONTAINER(p, ANSC_ASN1_CERTBAG, Linkage)
  
  /**********************************************************************
  
   OBJECT -- ASN1_CERTVALUE
  
   CertValue ::= Choice 
       {
                          base64Cert IA5String 
                                cert OctetString 
       }
  
   **********************************************************************/
  
  #define  CERTVALUE_MASK_BASE64CERT                                 0x00
  #define  CERTVALUE_MASK_CERT                                       0x01
  #define  CERTVALUE_MAXI_MASK                                       0x01
  
  #define  ANSC_ASN1_CERTVALUE_CLASS_CONTENT    ANSC_ASN1_CHOICE_CLASS_CONTENT
  
  typedef  struct
  _ANSC_ASN1_CERTVALUE
  {
      ANSC_ASN1_CERTVALUE_CLASS_CONTENT
  }
  ANSC_ASN1_CERTVALUE,  *PANSC_ASN1_CERTVALUE;
  
  #define  ACCESS_ANSC_ASN1_CERTVALUE(p)    \
           ACCESS_CONTAINER(p, ANSC_ASN1_CERTVALUE, Linkage)
  
  /**********************************************************************
  
   OBJECT -- ASN1_CRLBAG
  
   CRLBag ::= Sequence 
       {
                             crlType OID 
                            crlValue [CON 0] CRLValue 
       }
  
   **********************************************************************/
  
  #define  ANSC_ASN1_CRLBAG_CLASS_CONTENT                 ANSC_ASN1_SEQUENCE_CLASS_CONTENT
  
  typedef  struct
  _ANSC_ASN1_CRLBAG
  {
      ANSC_ASN1_CRLBAG_CLASS_CONTENT
  }
  ANSC_ASN1_CRLBAG,  *PANSC_ASN1_CRLBAG;
  
  #define  ACCESS_ANSC_ASN1_CRLBAG(p)    \
           ACCESS_CONTAINER(p, ANSC_ASN1_CRLBAG, Linkage)
  
  /**********************************************************************
  
   OBJECT -- ASN1_CRLVALUE
  
   CRLValue ::= OctetString 
  
   **********************************************************************/
  
  #define  ANSC_ASN1_CRLVALUE_CLASS_CONTENT               ANSC_ASN1_STRING_CLASS_CONTENT
  
  typedef  struct
  _ANSC_ASN1_CRLVALUE
  {
      ANSC_ASN1_CRLVALUE_CLASS_CONTENT
  }
  ANSC_ASN1_CRLVALUE,  *PANSC_ASN1_CRLVALUE;
  
  #define  ACCESS_ANSC_ASN1_CRLVALUE(p)    \
           ACCESS_CONTAINER(p, ANSC_ASN1_CRLVALUE, Linkage)
  
  /**********************************************************************
  
   OBJECT -- ASN1_SECRETBAG
  
   SecretBag ::= Sequence 
       {
                          secretType OID 
                         secretValue OctetString 
       }
  
   **********************************************************************/
  
  #define  ANSC_ASN1_SECRETBAG_CLASS_CONTENT              ANSC_ASN1_SEQUENCE_CLASS_CONTENT
  
  typedef  struct
  _ANSC_ASN1_SECRETBAG
  {
      ANSC_ASN1_SECRETBAG_CLASS_CONTENT
  }
  ANSC_ASN1_SECRETBAG,  *PANSC_ASN1_SECRETBAG;
  
  #define  ACCESS_ANSC_ASN1_SECRETBAG(p)    \
           ACCESS_CONTAINER(p, ANSC_ASN1_SECRETBAG, Linkage)
  
  /**********************************************************************
  
   OBJECT -- ASN1_BAGVALUE
  
   BagValue ::= Choice 
       {
                              keyBag KeyBag 
                 pkcs8ShroudedKeyBag PKCS8ShroudedKeyBag 
                             certBag CertBag 
                              crlBag CRLBag 
                           secretBag SecretBag 
                         safeContent SafeContents 
       }
  
   **********************************************************************/
  
  #define  BAGVALUE_MASK_KEYBAG                                      0x00
  #define  BAGVALUE_MASK_PKCS8SHROUDEDKEYBAG                         0x01
  #define  BAGVALUE_MASK_CERTBAG                                     0x02
  #define  BAGVALUE_MASK_CRLBAG                                      0x03
  #define  BAGVALUE_MASK_SECRETBAG                                   0x04
  #define  BAGVALUE_MASK_SAFECONTENT                                 0x05
  #define  BAGVALUE_MAXI_MASK                                        0x05
  
  #define  ANSC_ASN1_BAGVALUE_CLASS_CONTENT               ANSC_ASN1_CHOICE_CLASS_CONTENT
  
  typedef  struct
  _ANSC_ASN1_BAGVALUE
  {
      ANSC_ASN1_BAGVALUE_CLASS_CONTENT
  }
  ANSC_ASN1_BAGVALUE,  *PANSC_ASN1_BAGVALUE;
  
  #define  ACCESS_ANSC_ASN1_BAGVALUE(p)    \
           ACCESS_CONTAINER(p, ANSC_ASN1_BAGVALUE, Linkage)
  
  
  #endif  /* _ASN1_PFX_INTERFACE_H */
  
  