Back to product page

PublicKeyData property

Returns public key - as byte array.


An array of Byte values


  • Basic
The PublicKeyData(object,KeyType) syntax has these parts:
objectAn expression evaluating to an object of type Keys.
KeyTypeRequired. A SSHKeyTypes enumeration, as described in settings. Type of the key.


This property will return raw data for public part of previously generated (or loaded) key. Unlike PublicKey property which returns String, this property returns byte array.

We have noticed that when MFC generates wrappers for wodKeys, it says it cannot generate wrapper for this member. Well, you should then just add it by yourself. In header file, add this line:

void GetPublicKeyData(long KeyType, SAFEARRAY **result);

and in wrapper implementation file, add this

void IKeys::GetPublicKeyData(long KeyType, SAFEARRAY **result)
      VARIANT var;
      var.vt = VT_VARIANT;

      static BYTE parms[] = VTS_I4;
      InvokeHelper(0xd, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&var, parms, KeyType);

      *result = (SAFEARRAY *)var.punkVal;