Documentation
¶
Index ¶
- type ECDSAVerifier
- type ECP256PrivateKey
- func (e *ECP256PrivateKey) Bytes() []byte
- func (e *ECP256PrivateKey) Decrypt(data []byte) ([]byte, error)
- func (e *ECP256PrivateKey) Generate() (types.SigningPrivateKey, error)
- func (e *ECP256PrivateKey) Len() int
- func (e *ECP256PrivateKey) NewSigner() (types.Signer, error)
- func (e *ECP256PrivateKey) Public() (types.SigningPublicKey, error)
- func (e *ECP256PrivateKey) Sign(data []byte) (sig []byte, err error)
- func (e *ECP256PrivateKey) SignHash(h []byte) (sig []byte, err error)
- func (e *ECP256PrivateKey) Zero()
- type ECP256PublicKey
- func (k ECP256PublicKey) Bytes() []byte
- func (k *ECP256PublicKey) Encrypt(data []byte) (enc []byte, err error)
- func (k ECP256PublicKey) Len() int
- func (k ECP256PublicKey) NewVerifier() (types.Verifier, error)
- func (k ECP256PublicKey) Verify(data, sig []byte) error
- func (k ECP256PublicKey) VerifyHash(h, sig []byte) error
- type ECP384PrivateKey
- func (e *ECP384PrivateKey) Bytes() []byte
- func (e *ECP384PrivateKey) Decrypt(data []byte) ([]byte, error)
- func (e *ECP384PrivateKey) Generate() (types.SigningPrivateKey, error)
- func (e *ECP384PrivateKey) Len() int
- func (e *ECP384PrivateKey) NewSigner() (types.Signer, error)
- func (e *ECP384PrivateKey) Public() (types.SigningPublicKey, error)
- func (e *ECP384PrivateKey) Sign(data []byte) (sig []byte, err error)
- func (e *ECP384PrivateKey) SignHash(h []byte) (sig []byte, err error)
- func (e *ECP384PrivateKey) Zero()
- type ECP384PublicKey
- type ECP521PrivateKey
- func (e *ECP521PrivateKey) Bytes() []byte
- func (e *ECP521PrivateKey) Decrypt(data []byte) ([]byte, error)
- func (e *ECP521PrivateKey) Generate() (types.SigningPrivateKey, error)
- func (e *ECP521PrivateKey) Len() int
- func (e *ECP521PrivateKey) NewSigner() (types.Signer, error)
- func (e *ECP521PrivateKey) Public() (types.SigningPublicKey, error)
- func (e *ECP521PrivateKey) Sign(data []byte) (sig []byte, err error)
- func (e *ECP521PrivateKey) SignHash(h []byte) (sig []byte, err error)
- func (e *ECP521PrivateKey) Zero()
- type ECP521PublicKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ECDSAVerifier ¶
type ECDSAVerifier struct {
// contains filtered or unexported fields
}
func CreateECVerifier ¶
func (*ECDSAVerifier) Verify ¶
func (v *ECDSAVerifier) Verify(data, sig []byte) (err error)
verify a block of data by hashing it and comparing the hash against the signature
func (*ECDSAVerifier) VerifyHash ¶
func (v *ECDSAVerifier) VerifyHash(h, sig []byte) (err error)
verify a signature given the hash
type ECP256PrivateKey ¶
type ECP256PrivateKey [32]byte
ECP256PrivateKey represents a P-256 ECDSA private key.
CRITICAL: Never create ECP256PrivateKey using zero-value construction (e.g. var key ECP256PrivateKey). Zero-value construction results in an all-zero key which:
- Is cryptographically invalid
- Will panic when calling Public()
- Violates ECDSA security requirements
ALWAYS use NewECP256PrivateKey() for safe construction.
func NewECP256PrivateKey ¶ added in v0.1.0
func NewECP256PrivateKey(data []byte) (*ECP256PrivateKey, error)
NewECP256PrivateKey creates a new P-256 ECDSA private key from bytes with validation.
This constructor provides mandatory validation to prevent common security issues:
- Rejects inputs that are not exactly 32 bytes
- Rejects all-zero keys (cryptographically invalid)
- Returns defensive copy to prevent external mutation
Use this instead of direct byte slice conversion to ensure key validity.
Returns an error if:
- Input is not exactly 32 bytes
- Input is all zeros (invalid ECDSA private key)
func (*ECP256PrivateKey) Bytes ¶
func (e *ECP256PrivateKey) Bytes() []byte
Bytes implements types.PrivateKey.
func (*ECP256PrivateKey) Decrypt ¶
func (e *ECP256PrivateKey) Decrypt(data []byte) ([]byte, error)
Decrypt implements types.Decrypter.
func (*ECP256PrivateKey) Generate ¶
func (e *ECP256PrivateKey) Generate() (types.SigningPrivateKey, error)
Generate implements SigningPrivateKey.Generate
func (*ECP256PrivateKey) Len ¶
func (e *ECP256PrivateKey) Len() int
Len implements types.SigningPrivateKey.
func (*ECP256PrivateKey) NewSigner ¶
func (e *ECP256PrivateKey) NewSigner() (types.Signer, error)
NewSigner implements SigningPrivateKey.NewSigner
func (*ECP256PrivateKey) Public ¶
func (e *ECP256PrivateKey) Public() (types.SigningPublicKey, error)
Public implements types.PrivateKey.
func (*ECP256PrivateKey) Sign ¶
func (e *ECP256PrivateKey) Sign(data []byte) (sig []byte, err error)
Sign implements types.Signer.
type ECP256PublicKey ¶
type ECP256PublicKey [64]byte
ECP256PublicKey represents a P-256 ECDSA public key in uncompressed form.
CRITICAL: Never create ECP256PublicKey using zero-value construction (e.g. var key ECP256PublicKey). Zero-value construction results in an invalid public key which:
- Will fail signature verification
- May panic in cryptographic operations
- Violates ECDSA security requirements
ALWAYS use NewECP256PublicKey() for safe construction.
func NewECP256PublicKey ¶ added in v0.1.0
func NewECP256PublicKey(data []byte) (*ECP256PublicKey, error)
NewECP256PublicKey creates a new P-256 ECDSA public key from bytes with validation.
This constructor provides mandatory validation to prevent common security issues:
- Rejects inputs that are not exactly 64 bytes (uncompressed X||Y point)
- Returns defensive copy to prevent external mutation
Note: This constructor validates size only. Full curve point validation occurs when the key is used for cryptographic operations.
Returns an error if:
- Input is not exactly 64 bytes
func (ECP256PublicKey) Bytes ¶
func (k ECP256PublicKey) Bytes() []byte
func (*ECP256PublicKey) Encrypt ¶
func (k *ECP256PublicKey) Encrypt(data []byte) (enc []byte, err error)
Encrypt implements types.Encrypter.
func (ECP256PublicKey) Len ¶
func (k ECP256PublicKey) Len() int
func (ECP256PublicKey) NewVerifier ¶
func (k ECP256PublicKey) NewVerifier() (types.Verifier, error)
func (ECP256PublicKey) Verify ¶
func (k ECP256PublicKey) Verify(data, sig []byte) error
Verify implements types.Verifier.
func (ECP256PublicKey) VerifyHash ¶
func (k ECP256PublicKey) VerifyHash(h, sig []byte) error
VerifyHash implements types.Verifier.
type ECP384PrivateKey ¶
type ECP384PrivateKey [48]byte
ECP384PrivateKey represents a P-384 ECDSA private key.
CRITICAL: Never create ECP384PrivateKey using zero-value construction (e.g. var key ECP384PrivateKey). Zero-value construction results in an all-zero key which:
- Is cryptographically invalid
- Will panic when calling Public()
- Violates ECDSA security requirements
ALWAYS use NewECP384PrivateKey() for safe construction.
func NewECP384PrivateKey ¶ added in v0.1.0
func NewECP384PrivateKey(data []byte) (*ECP384PrivateKey, error)
NewECP384PrivateKey creates a new P-384 ECDSA private key from bytes with validation.
This constructor provides mandatory validation to prevent common security issues:
- Rejects inputs that are not exactly 48 bytes
- Rejects all-zero keys (cryptographically invalid)
- Returns defensive copy to prevent external mutation
Use this instead of direct byte slice conversion to ensure key validity.
Returns an error if:
- Input is not exactly 48 bytes
- Input is all zeros (invalid ECDSA private key)
func (*ECP384PrivateKey) Bytes ¶
func (e *ECP384PrivateKey) Bytes() []byte
Bytes implements types.PrivateKey.
func (*ECP384PrivateKey) Decrypt ¶
func (e *ECP384PrivateKey) Decrypt(data []byte) ([]byte, error)
Decrypt implements types.Decrypter.
func (*ECP384PrivateKey) Generate ¶ added in v0.1.5
func (e *ECP384PrivateKey) Generate() (types.SigningPrivateKey, error)
Generate implements SigningPrivateKey.Generate
func (*ECP384PrivateKey) Len ¶ added in v0.1.5
func (e *ECP384PrivateKey) Len() int
Len implements types.SigningPrivateKey.
func (*ECP384PrivateKey) NewSigner ¶ added in v0.1.5
func (e *ECP384PrivateKey) NewSigner() (types.Signer, error)
NewSigner implements SigningPrivateKey.NewSigner
func (*ECP384PrivateKey) Public ¶
func (e *ECP384PrivateKey) Public() (types.SigningPublicKey, error)
Public implements types.PrivateKey.
func (*ECP384PrivateKey) Sign ¶
func (e *ECP384PrivateKey) Sign(data []byte) (sig []byte, err error)
Sign implements types.Signer.
type ECP384PublicKey ¶
type ECP384PublicKey [96]byte
ECP384PublicKey represents a P-384 ECDSA public key in uncompressed form.
CRITICAL: Never create ECP384PublicKey using zero-value construction (e.g. var key ECP384PublicKey). Zero-value construction results in an invalid public key which:
- Will fail signature verification
- May panic in cryptographic operations
- Violates ECDSA security requirements
ALWAYS use NewECP384PublicKey() for safe construction.
func NewECP384PublicKey ¶ added in v0.1.0
func NewECP384PublicKey(data []byte) (*ECP384PublicKey, error)
NewECP384PublicKey creates a new P-384 ECDSA public key from bytes with validation.
This constructor provides mandatory validation to prevent common security issues:
- Rejects inputs that are not exactly 96 bytes (uncompressed X||Y point)
- Returns defensive copy to prevent external mutation
Note: This constructor validates size only. Full curve point validation occurs when the key is used for cryptographic operations.
Returns an error if:
- Input is not exactly 96 bytes
func (ECP384PublicKey) Bytes ¶
func (k ECP384PublicKey) Bytes() []byte
func (ECP384PublicKey) Len ¶
func (k ECP384PublicKey) Len() int
func (ECP384PublicKey) NewVerifier ¶
func (k ECP384PublicKey) NewVerifier() (types.Verifier, error)
func (ECP384PublicKey) Verify ¶
func (k ECP384PublicKey) Verify(data, sig []byte) error
Verify implements types.Verifier.
func (ECP384PublicKey) VerifyHash ¶
func (k ECP384PublicKey) VerifyHash(h, sig []byte) error
VerifyHash implements types.Verifier.
type ECP521PrivateKey ¶
type ECP521PrivateKey [66]byte
ECP521PrivateKey represents a P-521 ECDSA private key.
CRITICAL: Never create ECP521PrivateKey using zero-value construction (e.g. var key ECP521PrivateKey). Zero-value construction results in an all-zero key which:
- Is cryptographically invalid
- Will panic when calling Public()
- Violates ECDSA security requirements
ALWAYS use NewECP521PrivateKey() for safe construction.
func NewECP521PrivateKey ¶ added in v0.1.0
func NewECP521PrivateKey(data []byte) (*ECP521PrivateKey, error)
NewECP521PrivateKey creates a new P-521 ECDSA private key from bytes with validation.
This constructor provides mandatory validation to prevent common security issues:
- Rejects inputs that are not exactly 66 bytes
- Rejects all-zero keys (cryptographically invalid)
- Returns defensive copy to prevent external mutation
Use this instead of direct byte slice conversion to ensure key validity.
Returns an error if:
- Input is not exactly 66 bytes
- Input is all zeros (invalid ECDSA private key)
func (*ECP521PrivateKey) Bytes ¶
func (e *ECP521PrivateKey) Bytes() []byte
Bytes implements types.PrivateKey.
func (*ECP521PrivateKey) Decrypt ¶
func (e *ECP521PrivateKey) Decrypt(data []byte) ([]byte, error)
Decrypt implements types.Decrypter.
func (*ECP521PrivateKey) Generate ¶ added in v0.1.5
func (e *ECP521PrivateKey) Generate() (types.SigningPrivateKey, error)
Generate implements SigningPrivateKey.Generate
func (*ECP521PrivateKey) Len ¶ added in v0.1.5
func (e *ECP521PrivateKey) Len() int
Len implements types.SigningPrivateKey.
func (*ECP521PrivateKey) NewSigner ¶ added in v0.1.5
func (e *ECP521PrivateKey) NewSigner() (types.Signer, error)
NewSigner implements SigningPrivateKey.NewSigner
func (*ECP521PrivateKey) Public ¶
func (e *ECP521PrivateKey) Public() (types.SigningPublicKey, error)
Public implements types.PrivateKey.
func (*ECP521PrivateKey) Sign ¶
func (e *ECP521PrivateKey) Sign(data []byte) (sig []byte, err error)
Sign implements types.Signer.
type ECP521PublicKey ¶
type ECP521PublicKey [132]byte
ECP521PublicKey represents a P-521 ECDSA public key in uncompressed form.
CRITICAL: Never create ECP521PublicKey using zero-value construction (e.g. var key ECP521PublicKey). Zero-value construction results in an invalid public key which:
- Will fail signature verification
- May panic in cryptographic operations
- Violates ECDSA security requirements
ALWAYS use NewECP521PublicKey() for safe construction.
func NewECP521PublicKey ¶ added in v0.1.0
func NewECP521PublicKey(data []byte) (*ECP521PublicKey, error)
NewECP521PublicKey creates a new P-521 ECDSA public key from bytes with validation.
This constructor provides mandatory validation to prevent common security issues:
- Rejects inputs that are not exactly 132 bytes (uncompressed X||Y point)
- Returns defensive copy to prevent external mutation
Note: This constructor validates size only. Full curve point validation occurs when the key is used for cryptographic operations.
Returns an error if:
- Input is not exactly 132 bytes
func (ECP521PublicKey) Bytes ¶
func (k ECP521PublicKey) Bytes() []byte
func (ECP521PublicKey) Len ¶
func (k ECP521PublicKey) Len() int
func (ECP521PublicKey) NewVerifier ¶
func (k ECP521PublicKey) NewVerifier() (types.Verifier, error)
func (ECP521PublicKey) Verify ¶
func (k ECP521PublicKey) Verify(data, sig []byte) error
Verify implements types.Verifier.
func (ECP521PublicKey) VerifyHash ¶
func (k ECP521PublicKey) VerifyHash(h, sig []byte) error
VerifyHash implements types.Verifier.