keys
import "github.com/TheManticoreProject/Manticore/windows/cng/bcrypt/keys"
Index
- type BCRYPT_DSA_PRIVATE_KEY
- type BCRYPT_DSA_PUBLIC_KEY
- type BCRYPT_ECC_PRIVATE_KEY
- type BCRYPT_ECC_PUBLIC_KEY
- type BCRYPT_RSA_PRIVATE_KEY
- func (k *BCRYPT_RSA_PRIVATE_KEY) Describe(indent int)
- func (key *BCRYPT_RSA_PRIVATE_KEY) ExportDER() ([]byte, error)
- func (key *BCRYPT_RSA_PRIVATE_KEY) ExportPEM() ([]byte, error)
- func (key *BCRYPT_RSA_PRIVATE_KEY) Fingerprint() string
- func (k *BCRYPT_RSA_PRIVATE_KEY) Marshal() ([]byte, error)
- func (k *BCRYPT_RSA_PRIVATE_KEY) Unmarshal(value []byte) (int, error)
- type BCRYPT_RSA_PUBLIC_KEY
- func (k *BCRYPT_RSA_PUBLIC_KEY) Describe(indent int)
- func (k *BCRYPT_RSA_PUBLIC_KEY) Equal(other *BCRYPT_RSA_PUBLIC_KEY) bool
- func (key *BCRYPT_RSA_PUBLIC_KEY) ExportDER() ([]byte, error)
- func (key *BCRYPT_RSA_PUBLIC_KEY) ExportPEM() ([]byte, error)
- func (key *BCRYPT_RSA_PUBLIC_KEY) Fingerprint() string
- func (k *BCRYPT_RSA_PUBLIC_KEY) Marshal() ([]byte, error)
- func (k *BCRYPT_RSA_PUBLIC_KEY) Unmarshal(value []byte) (int, error)
type BCRYPT\_DSA\_PRIVATE\_KEY
type BCRYPT_DSA_PRIVATE_KEY struct {
// Magic is the magic signature of the key.
Magic magic.BCRYPT_KEY_BLOB
// Header is the header of the key.
Header headers.BCRYPT_DSA_KEY_BLOB
// Content is the content of the key.
Content blob.BCRYPT_DSA_PRIVATE_BLOB
}
func (*BCRYPT_DSA_PRIVATE_KEY) Describe
func (k *BCRYPT_DSA_PRIVATE_KEY) Describe(indent int)
Describe prints a detailed description of the BCRYPT_DSA_PRIVATE_KEY structure.
Parameters: - indent: An integer representing the indentation level for the printed output.
Note: The function prints the Header and Data of the BCRYPT_DSA_PRIVATE_KEY structure. The output is formatted with the specified indentation level to improve readability.
func (*BCRYPT_DSA_PRIVATE_KEY) Fingerprint
func (key *BCRYPT_DSA_PRIVATE_KEY) Fingerprint() string
Fingerprint returns the fingerprint of the BCRYPT_DSA_PRIVATE_KEY structure.
Parameters: - key: The BCRYPT_DSA_PRIVATE_KEY structure to get the fingerprint of.
Returns: - A string representing the fingerprint of the BCRYPT_DSA_PRIVATE_KEY structure.
func (*BCRYPT_DSA_PRIVATE_KEY) Marshal
func (k *BCRYPT_DSA_PRIVATE_KEY) Marshal() ([]byte, error)
Marshal returns the raw bytes of the BCRYPT_DSA_PRIVATE_KEY structure.
Returns: - A byte slice representing the raw bytes of the BCRYPT_DSA_PRIVATE_KEY structure.
func (*BCRYPT_DSA_PRIVATE_KEY) Unmarshal
func (k *BCRYPT_DSA_PRIVATE_KEY) Unmarshal(value []byte) (int, error)
Unmarshal parses the provided byte slice into the BCRYPT_DSA_PRIVATE_KEY structure.
Parameters: - value: A byte slice containing the raw DSA PRIVATE key 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 RSA PRIVATE key format, starting with the BCRYPT_RSA_KEY_BLOB header. It extracts the PRIVATE exponent and modulus from the byte slice and stores them in the BCRYPT_DSA_PRIVATE_KEY structure.
type BCRYPT\_DSA\_PUBLIC\_KEY
type BCRYPT_DSA_PUBLIC_KEY struct {
// Magic is the magic signature of the key.
Magic magic.BCRYPT_KEY_BLOB
// Header is the header of the key.
Header headers.BCRYPT_DSA_KEY_BLOB
// Content is the content of the key.
Content blob.BCRYPT_DSA_PUBLIC_BLOB
}
func (*BCRYPT_DSA_PUBLIC_KEY) Describe
func (k *BCRYPT_DSA_PUBLIC_KEY) Describe(indent int)
Describe prints a detailed description of the BCRYPT_DSA_PUBLIC_KEY structure.
Parameters: - indent: An integer representing the indentation level for the printed output.
Note: The function prints the Header and Data of the BCRYPT_DSA_PUBLIC_KEY structure. The output is formatted with the specified indentation level to improve readability.
func (*BCRYPT_DSA_PUBLIC_KEY) Fingerprint
func (key *BCRYPT_DSA_PUBLIC_KEY) Fingerprint() string
Fingerprint returns the fingerprint of the BCRYPT_DSA_PUBLIC_KEY structure.
Parameters: - key: The BCRYPT_DSA_PUBLIC_KEY structure to get the fingerprint of.
Returns: - A string representing the fingerprint of the BCRYPT_DSA_PUBLIC_KEY structure.
func (*BCRYPT_DSA_PUBLIC_KEY) Marshal
func (k *BCRYPT_DSA_PUBLIC_KEY) Marshal() ([]byte, error)
Marshal returns the raw bytes of the BCRYPT_DSA_PUBLIC_KEY structure.
Returns: - A byte slice representing the raw bytes of the BCRYPT_DSA_PUBLIC_KEY structure.
func (*BCRYPT_DSA_PUBLIC_KEY) Unmarshal
func (k *BCRYPT_DSA_PUBLIC_KEY) Unmarshal(value []byte) (int, error)
Unmarshal parses the provided byte slice into the BCRYPT_DSA_PUBLIC_KEY structure.
Parameters: - value: A byte slice containing the raw DSA public key 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 RSA public key format, starting with the BCRYPT_RSA_KEY_BLOB header. It extracts the public exponent and modulus from the byte slice and stores them in the BCRYPT_DSA_PUBLIC_KEY structure.
type BCRYPT\_ECC\_PRIVATE\_KEY
type BCRYPT_ECC_PRIVATE_KEY struct {
// Magic is the magic signature of the key.
Magic magic.BCRYPT_KEY_BLOB
// Header is the header of the key.
Header headers.BCRYPT_ECC_KEY_BLOB
// Content is the content of the key.
Content blob.BCRYPT_ECC_PRIVATE_BLOB
}
func (*BCRYPT_ECC_PRIVATE_KEY) Describe
func (k *BCRYPT_ECC_PRIVATE_KEY) Describe(indent int)
Describe prints a detailed description of the BCRYPT_ECC_PRIVATE_KEY structure.
Parameters: - indent: An integer representing the indentation level for the printed output.
Note: The function prints the Header and Data of the BCRYPT_ECC_PRIVATE_KEY structure. The output is formatted with the specified indentation level to improve readability.
func (*BCRYPT_ECC_PRIVATE_KEY) Fingerprint
func (key *BCRYPT_ECC_PRIVATE_KEY) Fingerprint() string
Fingerprint returns the fingerprint of the BCRYPT_ECC_PRIVATE_KEY structure.
Parameters: - key: The BCRYPT_ECC_PRIVATE_KEY structure to get the fingerprint of.
Returns: - A string representing the fingerprint of the BCRYPT_ECC_PRIVATE_KEY structure.
func (*BCRYPT_ECC_PRIVATE_KEY) Marshal
func (k *BCRYPT_ECC_PRIVATE_KEY) Marshal() ([]byte, error)
Marshal returns the raw bytes of the BCRYPT_ECC_PRIVATE_KEY structure.
Returns: - A byte slice representing the raw bytes of the BCRYPT_ECC_PRIVATE_KEY structure.
func (*BCRYPT_ECC_PRIVATE_KEY) Unmarshal
func (k *BCRYPT_ECC_PRIVATE_KEY) Unmarshal(value []byte) (int, error)
Unmarshal parses the provided byte slice into the BCRYPT_ECC_PRIVATE_KEY structure.
Parameters: - value: A byte slice containing the raw ECC private key 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 ECC private key format, starting with the BCRYPT_ECC_KEY_BLOB header. It extracts the X, Y and D big-endian values from the byte slice and stores them in the BCRYPT_ECC_PRIVATE_KEY structure.
type BCRYPT\_ECC\_PUBLIC\_KEY
type BCRYPT_ECC_PUBLIC_KEY struct {
// Magic is the magic signature of the key.
Magic magic.BCRYPT_KEY_BLOB
// Header is the header of the key.
Header headers.BCRYPT_ECC_KEY_BLOB
// Content is the content of the key.
Content blob.BCRYPT_ECC_PUBLIC_BLOB
}
func (*BCRYPT_ECC_PUBLIC_KEY) Describe
func (k *BCRYPT_ECC_PUBLIC_KEY) Describe(indent int)
Describe prints a detailed description of the BCRYPT_ECC_PUBLIC_KEY structure.
Parameters: - indent: An integer representing the indentation level for the printed output.
Note: The function prints the Header and Data of the BCRYPT_ECC_PUBLIC_KEY structure. The output is formatted with the specified indentation level to improve readability.
func (*BCRYPT_ECC_PUBLIC_KEY) Fingerprint
func (key *BCRYPT_ECC_PUBLIC_KEY) Fingerprint() string
Fingerprint returns the fingerprint of the BCRYPT_ECC_PUBLIC_KEY structure.
Parameters: - key: The BCRYPT_ECC_PUBLIC_KEY structure to get the fingerprint of.
Returns: - A string representing the fingerprint of the BCRYPT_ECC_PUBLIC_KEY structure.
func (*BCRYPT_ECC_PUBLIC_KEY) Marshal
func (k *BCRYPT_ECC_PUBLIC_KEY) Marshal() ([]byte, error)
Marshal returns the raw bytes of the BCRYPT_ECC_PUBLIC_KEY structure.
Returns: - A byte slice representing the raw bytes of the BCRYPT_ECC_PUBLIC_KEY structure.
func (*BCRYPT_ECC_PUBLIC_KEY) Unmarshal
func (k *BCRYPT_ECC_PUBLIC_KEY) Unmarshal(value []byte) (int, error)
Unmarshal parses the provided byte slice into the BCRYPT_ECC_PUBLIC_KEY structure.
Parameters: - value: A byte slice containing the raw ECC public key 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 ECC public key format, starting with the BCRYPT_ECC_KEY_BLOB header. It extracts the X and Y big-endian values from the byte slice and stores them in the BCRYPT_ECC_PUBLIC_KEY structure.
type BCRYPT\_RSA\_PRIVATE\_KEY
type BCRYPT_RSA_PRIVATE_KEY struct {
// Magic is the magic signature of the key.
Magic magic.BCRYPT_KEY_BLOB
// Header is the header of the key.
Header headers.BCRYPT_RSA_KEY_BLOB
// Content is the content of the key.
Content blob.BCRYPT_RSA_PRIVATE_BLOB
}
func (*BCRYPT_RSA_PRIVATE_KEY) Describe
func (k *BCRYPT_RSA_PRIVATE_KEY) Describe(indent int)
Describe prints a detailed description of the BCRYPT_RSA_PRIVATE_KEY structure.
Parameters: - indent: An integer representing the indentation level for the printed output.
Note: The function prints the Header and Data of the BCRYPT_RSA_PRIVATE_KEY structure. The output is formatted with the specified indentation level to improve readability.
func (*BCRYPT_RSA_PRIVATE_KEY) ExportDER
func (key *BCRYPT_RSA_PRIVATE_KEY) ExportDER() ([]byte, error)
ExportDER exports the RSA private key in DER format (PKCS#1 RSAPrivateKey).
The structure encoded is:
RSAPrivateKey ::= SEQUENCE {
version Version,
modulus INTEGER, -- n
publicExponent INTEGER, -- e
privateExponent INTEGER, -- d
prime1 INTEGER, -- p
prime2 INTEGER, -- q
exponent1 INTEGER, -- d mod (p-1)
exponent2 INTEGER, -- d mod (q-1)
coefficient INTEGER -- (inverse of q) mod p
}
Returns: - A byte slice containing the DER-encoded RSA private key. - An error if encoding fails.
func (*BCRYPT_RSA_PRIVATE_KEY) ExportPEM
func (key *BCRYPT_RSA_PRIVATE_KEY) ExportPEM() ([]byte, error)
ExportPEM exports the RSA private key in PEM format (PKCS#1).
Returns: - A byte slice containing the PEM-encoded RSA private key. - An error if encoding fails.
func (*BCRYPT_RSA_PRIVATE_KEY) Fingerprint
func (key *BCRYPT_RSA_PRIVATE_KEY) Fingerprint() string
Fingerprint returns the fingerprint of the BCRYPT_RSA_PUBLIC_KEY structure.
Parameters: - key: The BCRYPT_RSA_PRIVATE_KEY structure to get the fingerprint of.
Returns: - A string representing the fingerprint of the BCRYPT_RSA_PRIVATE_KEY structure.
func (*BCRYPT_RSA_PRIVATE_KEY) Marshal
func (k *BCRYPT_RSA_PRIVATE_KEY) Marshal() ([]byte, error)
Marshal returns the raw bytes of the BCRYPT_RSA_PRIVATE_KEY structure.
Returns: - A byte slice representing the raw bytes of the BCRYPT_RSA_PRIVATE_KEY structure.
func (*BCRYPT_RSA_PRIVATE_KEY) Unmarshal
func (k *BCRYPT_RSA_PRIVATE_KEY) Unmarshal(value []byte) (int, error)
Unmarshal parses the provided byte slice into the BCRYPT_RSA_PRIVATE_KEY structure.
Parameters: - value: A byte slice containing the raw RSA private key 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 RSA private key format, starting with the BCRYPT_RSA_KEY_BLOB header. It extracts the public exponent, modulus, prime1, and prime2 from the byte slice and stores them in the BCRYPT_RSA_PRIVATE_KEY structure.
type BCRYPT\_RSA\_PUBLIC\_KEY
type BCRYPT_RSA_PUBLIC_KEY struct {
// Magic is the magic signature of the key.
Magic magic.BCRYPT_KEY_BLOB
// Header is the header of the key.
Header headers.BCRYPT_RSA_KEY_BLOB
// Content is the content of the key.
Content blob.BCRYPT_RSA_PUBLIC_BLOB
}
func (*BCRYPT_RSA_PUBLIC_KEY) Describe
func (k *BCRYPT_RSA_PUBLIC_KEY) Describe(indent int)
Describe prints a detailed description of the BCRYPT_RSA_PUBLIC_KEY structure.
Parameters: - indent: An integer representing the indentation level for the printed output.
Note: The function prints the Header and Data of the BCRYPT_RSA_PUBLIC_KEY structure. The output is formatted with the specified indentation level to improve readability.
func (*BCRYPT_RSA_PUBLIC_KEY) Equal
func (k *BCRYPT_RSA_PUBLIC_KEY) Equal(other *BCRYPT_RSA_PUBLIC_KEY) bool
Equal checks if two BCRYPT_RSA_PUBLIC_KEY structures are equal.
Parameters: - other: The BCRYPT_RSA_PUBLIC_KEY structure to compare to.
Returns: - True if the two BCRYPT_RSA_PUBLIC_KEY structures are equal, false otherwise.
func (*BCRYPT_RSA_PUBLIC_KEY) ExportDER
func (key *BCRYPT_RSA_PUBLIC_KEY) ExportDER() ([]byte, error)
ExportDER exports the RSA public key in DER format (SubjectPublicKeyInfo/PKIX).
Returns: - A byte slice containing the DER-encoded RSA public key. - An error if encoding fails.
func (*BCRYPT_RSA_PUBLIC_KEY) ExportPEM
func (key *BCRYPT_RSA_PUBLIC_KEY) ExportPEM() ([]byte, error)
ExportPEM exports the RSA public key in PEM format.
Returns: - A byte slice containing the PEM-encoded RSA public key. - An error if encoding fails.
func (*BCRYPT_RSA_PUBLIC_KEY) Fingerprint
func (key *BCRYPT_RSA_PUBLIC_KEY) Fingerprint() string
Fingerprint returns the fingerprint of the BCRYPT_RSA_PUBLIC_KEY structure.
Parameters: - key: The BCRYPT_RSA_PUBLIC_KEY structure to get the fingerprint of.
Returns: - A string representing the fingerprint of the BCRYPT_RSA_PUBLIC_KEY structure.
func (*BCRYPT_RSA_PUBLIC_KEY) Marshal
func (k *BCRYPT_RSA_PUBLIC_KEY) Marshal() ([]byte, error)
Marshal returns the raw bytes of the BCRYPT_RSA_PUBLIC_KEY structure.
Returns: - A byte slice representing the raw bytes of the BCRYPT_RSA_PUBLIC_KEY structure.
func (*BCRYPT_RSA_PUBLIC_KEY) Unmarshal
func (k *BCRYPT_RSA_PUBLIC_KEY) Unmarshal(value []byte) (int, error)
Unmarshal parses the provided byte slice into the BCRYPT_RSA_PUBLIC_KEY structure.
Parameters: - value: A byte slice containing the raw RSA public key 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 RSA public key format, starting with the BCRYPT_RSA_KEY_BLOB header. It extracts the public exponent and modulus from the byte slice and stores them in the BCRYPT_RSA_PUBLIC_KEY structure.