IAlternativeName::InitializeFromOtherName method (certenroll.h)

The InitializeFromOtherName method initializes the object from an object identifier (OID) and the associated raw data (byte array). This method is provided to support the otherName field in the Abstract Syntax Notation One (ASN.1) AlternativeNames extension declaration.


----------------------------------------------------------------------
-- AlternativeNames 
-- XCN_OID_SUBJECT_ALT_NAME2 (2.5.29.17)
----------------------------------------------------------------------

AltNames ::= SEQUENCE --#public-- OF GeneralName
GeneralNames ::= AltNames

GeneralName ::= CHOICE 
{
   otherName               [0] IMPLICIT OtherName,
   rfc822Name              [1] IMPLICIT IA5STRING,
   dNSName                 [2] IMPLICIT IA5STRING,
   x400Address             [3] IMPLICIT SeqOfAny,       -- Not supported
   directoryName           [4] EXPLICIT ANY,    
   ediPartyName            [5] IMPLICIT SeqOfAny,
   uniformResourceLocator  [6] IMPLICIT IA5STRING,
   iPAddress               [7] IMPLICIT OCTETSTRING,
   registeredID            [8] IMPLICIT EncodedObjectID -- Not supported
}

OtherName ::= SEQUENCE 
{
   type                    EncodedObjectID,
   value                   [0] EXPLICIT NOCOPYANY 
}

Syntax

HRESULT InitializeFromOtherName(
  [in] IObjectId    *pObjectId,
  [in] EncodingType Encoding,
  [in] BSTR         strRawData,
  [in] VARIANT_BOOL ToBeWrapped
);

Parameters

[in] pObjectId

Pointer to an IObjectId interface that represents an OID.

[in] Encoding

An EncodingType enumeration value that identifies the type of Unicode encoding applied to the strRawData parameter.

[in] strRawData

A BSTR variable that contains the name associated with the OID.

[in] ToBeWrapped

A VARIANT_BOOL variable that identifies whether the input string contained in the strRawData parameter is encoded and saved as an octet string (byte array).

Return value

If the function succeeds, the function returns S_OK.

If the function fails, it returns an HRESULT value that indicates the error. Possible values include, but are not limited to, those in the following table. For a list of common error codes, see Common HRESULT Values.

Return code/value Description
HRESULT_FROM_WIN32(ERROR_ALREADY_INITIALIZED)
The object is already initialized.

Remarks

You can use this function to initialize an IAlternativeName object from an OID and an associated string value. The string is Unicode encoded. If you specify true for the ToBeWrapped parameter, the string is encoded by using Distinguished Encoding Rules (DER). You can retrieve the OID by calling the ObjectId property. You can retrieve the encoded string or, if ToBeWrapped is true, the DER-encoded byte array by calling the RawData property to retrieve the encoded byte array.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header certenroll.h
DLL CertEnroll.dll

See also

IAlternativeName