Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanSetHolder ¶ added in v0.19.1
func CanSetHolder(key IdentifiedKey) bool
CanSetHolder returns true if the holder of the key can be updated.
func SetHolder ¶ added in v0.19.1
func SetHolder(key IdentifiedKey, holder uuid.UUID) bool
SetHolder sets the holder uuid for a key or returns false if incorrect.
func WritePlayerKey ¶ added in v0.19.1
func WritePlayerKey(wr io.Writer, playerKey IdentifiedKey) error
Types ¶
type IdentifiedKey ¶
type IdentifiedKey interface {
KeySigned
// SignedPublicKey returns RSA public key.
// Note: this key is at least 2048 bits but may be larger.
SignedPublicKey() *rsa.PublicKey
SignedPublicKeyBytes() []byte
// VerifyDataSignature validates a signature against this public key.
VerifyDataSignature(signature []byte, toVerify ...[]byte) bool
// SignatureHolder retrieves the signature holders UUID.
// Returns null before the LoginEvent.
SignatureHolder() uuid.UUID
// KeyRevision retrieves the key revision.
KeyRevision() keyrevision.Revision
}
IdentifiedKey represents session-server cross-signed dated RSA public key.
func NewIdentifiedKey ¶
func NewIdentifiedKey(revision keyrevision.Revision, key []byte, expiry int64, signature []byte) (IdentifiedKey, error)
func ReadPlayerKey ¶ added in v0.19.1
type KeyIdentifiable ¶
type KeyIdentifiable interface {
// IdentifiedKey returns the timed identified key of the object context.
// Only available in 1.19 and newer.
IdentifiedKey() IdentifiedKey
}
KeyIdentifiable identifies a type with a public RSA signature.
type KeySigned ¶
type KeySigned interface {
Signer() *rsa.PublicKey
// ExpiryTemporal returns the expiry time point of the key.
// Note: this limit is arbitrary. RSA keys don't expire,
// but the signature of this key as provided by the session
// server will expire.
ExpiryTemporal() time.Time
// Expired checks if the signature has expired.
Expired() bool
// Signature retrieves the RSA signature of the signed object.
Signature() []byte
// SignatureValid validates the signature, expiry temporal and key against the signer public key.
//
// Note: This will not check for expiry.
//
// DOES NOT WORK YET FOR MESSAGES AND COMMANDS!
//
// Does not work for 1.19.1 until the user has authenticated.
SignatureValid() bool
// Salt returns the signature salt or empty if not salted.
Salt() []byte
}
type SignaturePair ¶ added in v0.19.1
func (*SignaturePair) Decode ¶ added in v0.19.1
func (p *SignaturePair) Decode(c *proto.PacketContext, rd io.Reader) (err error)
func (*SignaturePair) Encode ¶ added in v0.19.1
func (p *SignaturePair) Encode(c *proto.PacketContext, wr io.Writer) error
Click to show internal directories.
Click to hide internal directories.