| 1 | package jwebbscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/jwe/jwebb`/ |
| 2 | |
| 3 | import ( |
| 4 | "cryptoscip-go gomod github.com/golang/go/src go1.24.0 crypto/" |
| 5 | "crypto/aesscip-go gomod github.com/golang/go/src go1.24.0 `crypto/aes`/" |
| 6 | "crypto/ecdhscip-go gomod github.com/golang/go/src go1.24.0 `crypto/ecdh`/" |
| 7 | "crypto/randscip-go gomod github.com/golang/go/src go1.24.0 `crypto/rand`/" |
| 8 | "crypto/rsascip-go gomod github.com/golang/go/src go1.24.0 `crypto/rsa`/" |
| 9 | "crypto/sha1scip-go gomod github.com/golang/go/src go1.24.0 `crypto/sha1`/" |
| 10 | "crypto/sha256scip-go gomod github.com/golang/go/src go1.24.0 `crypto/sha256`/" |
| 11 | "crypto/sha512scip-go gomod github.com/golang/go/src go1.24.0 `crypto/sha512`/" |
| 12 | "encoding/binaryscip-go gomod github.com/golang/go/src go1.24.0 `encoding/binary`/" |
| 13 | "fmtscip-go gomod github.com/golang/go/src go1.24.0 fmt/" |
| 14 | "hashscip-go gomod github.com/golang/go/src go1.24.0 hash/" |
| 15 | |
| 16 | "github.com/lestrrat-go/jwx/v3/internal/keyconvscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/keyconv`/" |
| 17 | "github.com/lestrrat-go/jwx/v3/internal/tokensscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/" |
| 18 | "github.com/lestrrat-go/jwx/v3/jwe/internal/concatkdfscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/jwe/internal/concatkdf`/" |
| 19 | "github.com/lestrrat-go/jwx/v3/jwe/internal/keygenscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/jwe/internal/keygen`/" |
| 20 | ) |
| 21 | |
| 22 | func contentEncryptionKeySizescip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/jwe/jwebb`/contentEncryptionKeySize().(ctalg string) (uint32, error) { |
| 23 | switch ctalg { |
| 24 | case tokensscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/.A128GCMscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/A128GCM.: |
| 25 | return tokensscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/.KeySize16scip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/KeySize16., nil |
| 26 | case tokensscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/.A192GCMscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/A192GCM.: |
| 27 | return tokensscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/.KeySize24scip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/KeySize24., nil |
| 28 | case tokensscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/.A256GCMscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/A256GCM.: |
| 29 | return tokensscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/.KeySize32scip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/KeySize32., nil |
| 30 | case tokensscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/.A128CBC_HS256scip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/A128CBC_HS256.: |
| 31 | return tokensscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/.KeySize32scip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/KeySize32., nil |
| 32 | case tokensscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/.A192CBC_HS384scip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/A192CBC_HS384.: |
| 33 | return tokensscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/.KeySize48scip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/KeySize48., nil |
| 34 | case tokensscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/.A256CBC_HS512scip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/A256CBC_HS512.: |
| 35 | return tokensscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/.KeySize64scip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/KeySize64., nil |
| 36 | default: |
| 37 | return 0, fmtscip-go gomod github.com/golang/go/src go1.24.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.24.0 fmt/Errorf().(`unsupported content encryption algorithm %s`, ctalg) |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | func KeyEncryptionECDHESKeySizescip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/jwe/jwebb`/KeyEncryptionECDHESKeySize().(alg, ctalg string) (string, uint32, bool, error) { |
| 42 | switch alg { |
| 43 | case tokensscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/.ECDH_ESscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/ECDH_ES.: |
| 44 | keysize, err := contentEncryptionKeySizescip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/jwe/jwebb`/contentEncryptionKeySize().(ctalg) |
| 45 | if err != nil { |
| 46 | return "", 0, false, err |
| 47 | } |
| 48 | return ctalg, keysize, false, nil |
| 49 | case tokensscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/.ECDH_ES_A128KWscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/ECDH_ES_A128KW.: |
| 50 | return alg, tokensscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/.KeySize16scip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/KeySize16., true, nil |
| 51 | case tokensscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/.ECDH_ES_A192KWscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/ECDH_ES_A192KW.: |
| 52 | return alg, tokensscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/.KeySize24scip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/KeySize24., true, nil |
| 53 | case tokensscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/.ECDH_ES_A256KWscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/ECDH_ES_A256KW.: |
| 54 | return alg, tokensscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/.KeySize32scip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/KeySize32., true, nil |
| 55 | default: |
| 56 | return "", 0, false, fmtscip-go gomod github.com/golang/go/src go1.24.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.24.0 fmt/Errorf().(`unsupported key encryption algorithm %s`, alg) |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | func DeriveECDHESscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/jwe/jwebb`/DeriveECDHES().(alg string, apu, apv []byte, privkeyif, pubkeyif any, keysize uint32) ([]byte, error) { |
| 61 | pubinfo := make([]byte, 4) |
| 62 | binaryscip-go gomod github.com/golang/go/src go1.24.0 `encoding/binary`/.BigEndianscip-go gomod github.com/golang/go/src go1.24.0 `encoding/binary`/BigEndian..PutUint32scip-go gomod github.com/golang/go/src go1.24.0 `encoding/binary`/bigEndian#PutUint32().(pubinfo, keysize*tokensscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/.BitsPerBytescip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/BitsPerByte.) |
| 63 | |
| 64 | var privkey *ecdhscip-go gomod github.com/golang/go/src go1.24.0 `crypto/ecdh`/.PrivateKeyscip-go gomod github.com/golang/go/src go1.24.0 `crypto/ecdh`/PrivateKey# |
| 65 | var pubkey *ecdhscip-go gomod github.com/golang/go/src go1.24.0 `crypto/ecdh`/.PublicKeyscip-go gomod github.com/golang/go/src go1.24.0 `crypto/ecdh`/PublicKey# |
| 66 | if err := keyconvscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/keyconv`/.ECDHPrivateKeyscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/keyconv`/ECDHPrivateKey().(&privkey, privkeyif); err != nil { |
| 67 | return nil, fmtscip-go gomod github.com/golang/go/src go1.24.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.24.0 fmt/Errorf().(`jwebb.DeriveECDHES: %w`, err) |
| 68 | } |
| 69 | if err := keyconvscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/keyconv`/.ECDHPublicKeyscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/keyconv`/ECDHPublicKey().(&pubkey, pubkeyif); err != nil { |
| 70 | return nil, fmtscip-go gomod github.com/golang/go/src go1.24.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.24.0 fmt/Errorf().(`jwebb.DeriveECDHES: %w`, err) |
| 71 | } |
| 72 | |
| 73 | zBytes, err := privkey.ECDHscip-go gomod github.com/golang/go/src go1.24.0 `crypto/ecdh`/PrivateKey#ECDH().(pubkey) |
| 74 | if err != nil { |
| 75 | return nil, fmtscip-go gomod github.com/golang/go/src go1.24.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.24.0 fmt/Errorf().(`jwebb.DeriveECDHES: unable to determine Z: %w`, err) |
| 76 | } |
| 77 | kdf := concatkdfscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/jwe/internal/concatkdf`/.Newscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/jwe/internal/concatkdf`/New().(cryptoscip-go gomod github.com/golang/go/src go1.24.0 crypto/.SHA256scip-go gomod github.com/golang/go/src go1.24.0 crypto/SHA256., []byte(alg), zBytes, apu, apv, pubinfo, []byte{}) |
| 78 | key := make([]byte, keysize) |
| 79 | if _, err := kdf.Readscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/jwe/internal/concatkdf`/KDF#Read().(key); err != nil { |
| 80 | return nil, fmtscip-go gomod github.com/golang/go/src go1.24.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.24.0 fmt/Errorf().(`jwebb.DeriveECDHES: failed to read kdf: %w`, err) |
| 81 | } |
| 82 | |
| 83 | return key, nil |
| 84 | } |
| 85 | |
| 86 | func KeyDecryptECDHESKeyWrapscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/jwe/jwebb`/KeyDecryptECDHESKeyWrap().(_, enckey []byte, alg string, apu, apv []byte, privkey, pubkey any, keysize uint32) ([]byte, error) { |
| 87 | key, err := DeriveECDHESscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/jwe/jwebb`/DeriveECDHES().(alg, apu, apv, privkey, pubkey, keysize) |
| 88 | if err != nil { |
| 89 | return nil, fmtscip-go gomod github.com/golang/go/src go1.24.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.24.0 fmt/Errorf().(`failed to derive ECDHES encryption key: %w`, err) |
| 90 | } |
| 91 | |
| 92 | block, err := aesscip-go gomod github.com/golang/go/src go1.24.0 `crypto/aes`/.NewCipherscip-go gomod github.com/golang/go/src go1.24.0 `crypto/aes`/NewCipher().(key) |
| 93 | if err != nil { |
| 94 | return nil, fmtscip-go gomod github.com/golang/go/src go1.24.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.24.0 fmt/Errorf().(`failed to create cipher for ECDH-ES key wrap: %w`, err) |
| 95 | } |
| 96 | |
| 97 | return Unwrapscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/jwe/jwebb`/Unwrap().(block, enckey) |
| 98 | } |
| 99 | |
| 100 | func KeyDecryptECDHESscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/jwe/jwebb`/KeyDecryptECDHES().(_, _ []byte, alg string, apu, apv []byte, privkey, pubkey any, keysize uint32) ([]byte, error) { |
| 101 | key, err := DeriveECDHESscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/jwe/jwebb`/DeriveECDHES().(alg, apu, apv, privkey, pubkey, keysize) |
| 102 | if err != nil { |
| 103 | return nil, fmtscip-go gomod github.com/golang/go/src go1.24.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.24.0 fmt/Errorf().(`failed to derive ECDHES encryption key: %w`, err) |
| 104 | } |
| 105 | return key, nil |
| 106 | } |
| 107 | |
| 108 | // RSA key decryption functions |
| 109 | |
| 110 | func KeyDecryptRSA15scip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/jwe/jwebb`/KeyDecryptRSA15().(_, enckey []byte, privkeyif any, keysize int) ([]byte, error) { |
| 111 | var privkey *rsascip-go gomod github.com/golang/go/src go1.24.0 `crypto/rsa`/.PrivateKeyscip-go gomod github.com/golang/go/src go1.24.0 `crypto/rsa`/PrivateKey# |
| 112 | if err := keyconvscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/keyconv`/.RSAPrivateKeyscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/keyconv`/RSAPrivateKey().(&privkey, privkeyif); err != nil { |
| 113 | return nil, fmtscip-go gomod github.com/golang/go/src go1.24.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.24.0 fmt/Errorf().(`jwebb.KeyDecryptRSA15: %w`, err) |
| 114 | } |
| 115 | |
| 116 | // Perform some input validation. |
| 117 | expectedlen := privkey.PublicKeyscip-go gomod github.com/golang/go/src go1.24.0 `crypto/rsa`/PrivateKey#PublicKey..Nscip-go gomod github.com/golang/go/src go1.24.0 `crypto/rsa`/PublicKey#N..BitLenscip-go gomod github.com/golang/go/src go1.24.0 `math/big`/Int#BitLen().() / tokensscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/.BitsPerBytescip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/BitsPerByte. |
| 118 | if expectedlen != len(enckey) { |
| 119 | // Input size is incorrect, the encrypted payload should always match |
| 120 | // the size of the public modulus (e.g. using a 2048 bit key will |
| 121 | // produce 256 bytes of output). Reject this since it's invalid input. |
| 122 | return nil, fmtscip-go gomod github.com/golang/go/src go1.24.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.24.0 fmt/Errorf().( |
| 123 | "input size for key decrypt is incorrect (expected %d, got %d)", |
| 124 | expectedlen, |
| 125 | len(enckey), |
| 126 | ) |
| 127 | } |
| 128 | |
| 129 | // Generate a random CEK of the required size |
| 130 | bk, err := keygenscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/jwe/internal/keygen`/.Randomscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/jwe/internal/keygen`/Random().(keysize * tokensscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/.RSAKeyGenMultiplierscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/RSAKeyGenMultiplier.) |
| 131 | if err != nil { |
| 132 | return nil, fmtscip-go gomod github.com/golang/go/src go1.24.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.24.0 fmt/Errorf().(`failed to generate key`) |
| 133 | } |
| 134 | cek := bk.Bytesscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/jwe/internal/keygen`/ByteSource#Bytes.() |
| 135 | |
| 136 | // Use a defer/recover pattern to handle potential panics from DecryptPKCS1v15SessionKey |
| 137 | defer func() { |
| 138 | // DecryptPKCS1v15SessionKey sometimes panics on an invalid payload |
| 139 | // because of an index out of bounds error, which we want to ignore. |
| 140 | // This has been fixed in Go 1.3.1 (released 2014/08/13), the recover() |
| 141 | // only exists for preventing crashes with unpatched versions. |
| 142 | // See: https://groups.google.com/forum/#!topic/golang-dev/7ihX6Y6kx9k |
| 143 | // See: https://code.google.com/p/go/source/detail?r=58ee390ff31602edb66af41ed10901ec95904d33 |
| 144 | _ = recover() |
| 145 | }() |
| 146 | |
| 147 | // When decrypting an RSA-PKCS1v1.5 payload, we must take precautions to |
| 148 | // prevent chosen-ciphertext attacks as described in RFC 3218, "Preventing |
| 149 | // the Million Message Attack on Cryptographic Message Syntax". We are |
| 150 | // therefore deliberately ignoring errors here. |
| 151 | _ = rsascip-go gomod github.com/golang/go/src go1.24.0 `crypto/rsa`/.DecryptPKCS1v15SessionKeyscip-go gomod github.com/golang/go/src go1.24.0 `crypto/rsa`/DecryptPKCS1v15SessionKey().(randscip-go gomod github.com/golang/go/src go1.24.0 `crypto/rand`/.Readerscip-go gomod github.com/golang/go/src go1.24.0 `crypto/rand`/Reader., privkey, enckey, cek) |
| 152 | |
| 153 | return cek, nil |
| 154 | } |
| 155 | |
| 156 | func KeyDecryptRSAOAEPscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/jwe/jwebb`/KeyDecryptRSAOAEP().(_, enckey []byte, alg string, privkeyif any) ([]byte, error) { |
| 157 | var privkey *rsascip-go gomod github.com/golang/go/src go1.24.0 `crypto/rsa`/.PrivateKeyscip-go gomod github.com/golang/go/src go1.24.0 `crypto/rsa`/PrivateKey# |
| 158 | if err := keyconvscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/keyconv`/.RSAPrivateKeyscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/keyconv`/RSAPrivateKey().(&privkey, privkeyif); err != nil { |
| 159 | return nil, fmtscip-go gomod github.com/golang/go/src go1.24.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.24.0 fmt/Errorf().(`jwebb.KeyDecryptRSAOAEP: %w`, err) |
| 160 | } |
| 161 | |
| 162 | var hash hashscip-go gomod github.com/golang/go/src go1.24.0 hash/.Hashscip-go gomod github.com/golang/go/src go1.24.0 hash/Hash# |
| 163 | switch alg { |
| 164 | case tokensscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/.RSA_OAEPscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/RSA_OAEP.: |
| 165 | hash = sha1scip-go gomod github.com/golang/go/src go1.24.0 `crypto/sha1`/.Newscip-go gomod github.com/golang/go/src go1.24.0 `crypto/sha1`/New().() |
| 166 | case tokensscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/.RSA_OAEP_256scip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/RSA_OAEP_256.: |
| 167 | hash = sha256scip-go gomod github.com/golang/go/src go1.24.0 `crypto/sha256`/.Newscip-go gomod github.com/golang/go/src go1.24.0 `crypto/sha256`/New().() |
| 168 | case tokensscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/.RSA_OAEP_384scip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/RSA_OAEP_384.: |
| 169 | hash = sha512scip-go gomod github.com/golang/go/src go1.24.0 `crypto/sha512`/.New384scip-go gomod github.com/golang/go/src go1.24.0 `crypto/sha512`/New384().() |
| 170 | case tokensscip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/.RSA_OAEP_512scip-go gomod github.com/lestrrat-go/jwx/v3 . `github.com/lestrrat-go/jwx/v3/internal/tokens`/RSA_OAEP_512.: |
| 171 | hash = sha512scip-go gomod github.com/golang/go/src go1.24.0 `crypto/sha512`/.Newscip-go gomod github.com/golang/go/src go1.24.0 `crypto/sha512`/New().() |
| 172 | default: |
| 173 | return nil, fmtscip-go gomod github.com/golang/go/src go1.24.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.24.0 fmt/Errorf().(`failed to generate key encrypter for RSA-OAEP: RSA_OAEP/RSA_OAEP_256/RSA_OAEP_384/RSA_OAEP_512 required`) |
| 174 | } |
| 175 | |
| 176 | return rsascip-go gomod github.com/golang/go/src go1.24.0 `crypto/rsa`/.DecryptOAEPscip-go gomod github.com/golang/go/src go1.24.0 `crypto/rsa`/DecryptOAEP().(hash, randscip-go gomod github.com/golang/go/src go1.24.0 `crypto/rand`/.Readerscip-go gomod github.com/golang/go/src go1.24.0 `crypto/rand`/Reader., privkey, enckey, []byte{}) |
| 177 | } |