Generated from Manticore v1.1.5 • 201 packages. View on pkg.go.dev

magic

import "github.com/TheManticoreProject/Manticore/windows/cng/bcrypt/keys/magic"

Index

Constants

Source: bcrypt.h Source: https://learn.microsoft.com/en-us/windows/win32/api/bcrypt/ns-bcrypt-bcrypt_ecckey_blob Source: https://learn.microsoft.com/en-us/windows/win32/api/bcrypt/ns-bcrypt-bcrypt_dsa_key_blob Source: https://learn.microsoft.com/en-us/windows/win32/api/bcrypt/ns-bcrypt-bcrypt_rsakey_blob

const (
    // ECDH
    // The key is a 256 bit elliptic curve Diffie-Hellman public key.
    BCRYPT_ECDH_PUBLIC_P256_MAGIC = 0x314B4345
    // The key is a 256 bit elliptic curve Diffie-Hellman private key.
    BCRYPT_ECDH_PRIVATE_P256_MAGIC = 0x324B4345
    // The key is a 384 bit elliptic curve Diffie-Hellman public key.
    BCRYPT_ECDH_PUBLIC_P384_MAGIC = 0x334B4345
    // The key is a 384 bit elliptic curve Diffie-Hellman private key.
    BCRYPT_ECDH_PRIVATE_P384_MAGIC = 0x344B4345
    // The key is a 521 bit elliptic curve Diffie-Hellman public key.
    BCRYPT_ECDH_PUBLIC_P521_MAGIC = 0x354B4345
    // The key is a 521 bit elliptic curve Diffie-Hellman private key.
    BCRYPT_ECDH_PRIVATE_P521_MAGIC = 0x364B4345

    // ECDSA
    // The key is a 256 bit elliptic curve DSA public key.
    BCRYPT_ECDSA_PUBLIC_P256_MAGIC = 0x31534345
    // The key is a 256 bit elliptic curve DSA private key.
    BCRYPT_ECDSA_PRIVATE_P256_MAGIC = 0x32534345
    // The key is a 384 bit elliptic curve DSA public key.
    BCRYPT_ECDSA_PUBLIC_P384_MAGIC = 0x33534345
    // The key is a 384 bit elliptic curve DSA private key.
    BCRYPT_ECDSA_PRIVATE_P384_MAGIC = 0x34534345
    // The key is a 521 bit elliptic curve DSA public key.
    BCRYPT_ECDSA_PUBLIC_P521_MAGIC = 0x35534345
    // The key is a 521 bit elliptic curve DSA private key.
    BCRYPT_ECDSA_PRIVATE_P521_MAGIC = 0x36534345

    // DSA
    // Source: https://learn.microsoft.com/en-us/windows/win32/api/bcrypt/ns-bcrypt-bcrypt_dsa_key_blob
    BCRYPT_DSA_PUBLIC_MAGIC  = 0x42505344
    BCRYPT_DSA_PRIVATE_MAGIC = 0x56505344

    // RSA
    // Source: https://learn.microsoft.com/en-us/windows/win32/api/bcrypt/ns-bcrypt-bcrypt_rsakey_blob
    BCRYPT_RSAPUBLIC_MAGIC      = 0x31415352
    BCRYPT_RSAPRIVATE_MAGIC     = 0x32415352
    BCRYPT_RSAFULLPRIVATE_MAGIC = 0x33415352

    // Key Data Blob
    // Source: https://learn.microsoft.com/en-us/windows/win32/api/bcrypt/ns-bcrypt-bcrypt_key_data_blob
    BCRYPT_KEY_DATA_BLOB_MAGIC = 0x4d42444b
)

type BCRYPT\_KEY\_BLOB

BCRYPT_KEY_BLOB structure is used as a header for a key BLOB in memory.

See: https://learn.microsoft.com/en-us/windows/win32/api/bcrypt/ns-bcrypt-bcrypt_key_blob

type BCRYPT_KEY_BLOB struct {
    // Specifies the type of key this BLOB represents. The possible values for this member
    // depend on the type of BLOB this structure represents.
    Magic uint32
}

func (*BCRYPT_KEY_BLOB) Describe

func (b *BCRYPT_KEY_BLOB) Describe(indent int)

Describe prints the BCRYPT_KEY_BLOB structure to the console.

Parameters: - indent: The number of spaces to indent the output.

func (*BCRYPT_KEY_BLOB) Equal

func (b *BCRYPT_KEY_BLOB) Equal(other *BCRYPT_KEY_BLOB) bool

Equal returns true if the BCRYPT_KEY_BLOB structure is equal to the other BCRYPT_KEY_BLOB structure.

Parameters: - other: The other BCRYPT_KEY_BLOB structure to compare to.

Returns: - True if the BCRYPT_KEY_BLOB structure is equal to the other BCRYPT_KEY_BLOB structure, otherwise false.

func (*BCRYPT_KEY_BLOB) Marshal

func (b *BCRYPT_KEY_BLOB) Marshal() ([]byte, error)

Marshal returns the raw bytes of the BCRYPT_KEY_BLOB structure.

Returns: - A byte slice representing the raw bytes of the BCRYPT_KEY_BLOB structure.

func (*BCRYPT_KEY_BLOB) String

func (b *BCRYPT_KEY_BLOB) String() string

String returns a string representation of the BCRYPT_KEY_BLOB structure.

Returns: - A string representing the BCRYPT_KEY_BLOB structure.

func (*BCRYPT_KEY_BLOB) Unmarshal

func (b *BCRYPT_KEY_BLOB) Unmarshal(value []byte) (int, error)

Unmarshal parses the provided byte slice into the BCRYPT_KEY_BLOB structure.

Parameters: - value: A byte slice containing the raw key BLOB to be parsed.

Returns: - The number of bytes read from the byte slice. - An error if the parsing fails, otherwise nil.

Note: The function expects the byte slice to follow the key BLOB format, starting with the “KEY1” blob type identifier. It extracts the key type from the byte slice and stores it in the BCRYPT_KEY_BLOB structure.