🚀 Launch Week Day 4:Introducing the Alert Details Page: A Better Way to Explore Alerts.Learn More →
Socket
Book a DemoInstallSign in
Socket

mz.attahri.com/code/jose

Package Overview
Dependencies
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mz.attahri.com/code/jose

Go Modules
Version
v0.0.0-20251202193919-3c258e103ac9
Version published
Created
Source

JOSE

Go implementation of JSON Object Signing and Encryption (JOSE) standards.

PackageDescriptionRFC
jwkJSON Web KeyRFC 7517
jwsJSON Web SignatureRFC 7515
jweJSON Web EncryptionRFC 7516

JWK

Parse, create, and serialize cryptographic keys in JWK format.

// Parse a JWK Set (e.g., from /.well-known/jwks.json)
set, err := jwk.ParseSet(jsonData)
verifiers, err := set.Verifiers()
verified, err := jws.Verify(token, verifiers...)

// Create JWK from Go crypto key
privateJWK, err := jwk.FromPrivateKey(ecdsaKey, "key-id")
signer, err := privateJWK.Signer()

Supported key types:

  • EC (P-256, P-384, P-521) for ECDSA
  • RSA for RS*/PS* algorithms
  • OKP (Ed25519) for EdDSA
  • oct for HMAC

JWS

Sign and verify data with digital signatures or MACs.

// Sign
signer, verifier, err := jws.HMAC(crypto.SHA256, "key-id", secret)
msg, err := jws.Sign([]byte("payload"), signer)
token, err := msg.Compact()

// Verify
verified, err := jws.Verify(token, verifier)
fmt.Println(string(verified.Payload))

Supported algorithms:

AlgorithmTypeConstructor
HS256, HS384, HS512HMACjws.HMAC
RS256, RS384, RS512RSA PKCS#1 v1.5jws.RSA
PS256, PS384, PS512RSA-PSSjws.RSAPSS
ES256, ES384, ES512ECDSAjws.ECDSA
EdDSAEd25519jws.EdDSA

JWE

Encrypt and decrypt data with authenticated encryption.

// Encrypt
encrypter, err := jwe.RSAOAEP256(publicKey, jwe.A256GCM, "key-id")
msg, err := jwe.Encrypt([]byte("secret"), encrypter)
token, err := msg.Compact()

// Decrypt
decrypter, err := jwe.RSAOAEP256Decrypter(privateKey, "key-id")
decrypted, err := jwe.Decrypt(token, decrypter)
fmt.Println(string(decrypted.Plaintext))

Key management algorithms:

AlgorithmTypeConstructor
RSA-OAEPRSA-OAEP with SHA-1jwe.RSAOAEP
RSA-OAEP-256RSA-OAEP with SHA-256jwe.RSAOAEP256
A128KW, A192KW, A256KWAES Key Wrapjwe.A128KW, jwe.A192KW, jwe.A256KW
ECDH-ESECDH Ephemeral Staticjwe.ECDHES
ECDH-ES+A128KW, +A192KW, +A256KWECDH-ES with AES Key Wrapjwe.ECDHESA128KW, etc.
dirDirect encryptionjwe.Direct

Content encryption algorithms:

AlgorithmDescription
A128GCM, A192GCM, A256GCMAES-GCM
A128CBC-HS256, A192CBC-HS384, A256CBC-HS512AES-CBC with HMAC

FAQs

Package last updated on 02 Dec 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts