mirror of
				https://github.com/distribution/distribution.git
				synced 2025-10-31 09:25:45 +00:00 
			
		
		
		
	build(deps): bump github.com/Azure/azure-sdk-for-go/sdk/azidentity
Bumps [github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://github.com/Azure/azure-sdk-for-go) from 1.3.0 to 1.6.0. - [Release notes](https://github.com/Azure/azure-sdk-for-go/releases) - [Changelog](https://github.com/Azure/azure-sdk-for-go/blob/main/documentation/release.md) - [Commits](https://github.com/Azure/azure-sdk-for-go/compare/sdk/azcore/v1.3.0...sdk/azcore/v1.6.0) --- updated-dependencies: - dependency-name: github.com/Azure/azure-sdk-for-go/sdk/azidentity dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
		
							
								
								
									
										69
									
								
								vendor/github.com/golang-jwt/jwt/v5/ecdsa_utils.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										69
									
								
								vendor/github.com/golang-jwt/jwt/v5/ecdsa_utils.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,69 @@ | ||||
| package jwt | ||||
|  | ||||
| import ( | ||||
| 	"crypto/ecdsa" | ||||
| 	"crypto/x509" | ||||
| 	"encoding/pem" | ||||
| 	"errors" | ||||
| ) | ||||
|  | ||||
| var ( | ||||
| 	ErrNotECPublicKey  = errors.New("key is not a valid ECDSA public key") | ||||
| 	ErrNotECPrivateKey = errors.New("key is not a valid ECDSA private key") | ||||
| ) | ||||
|  | ||||
| // ParseECPrivateKeyFromPEM parses a PEM encoded Elliptic Curve Private Key Structure | ||||
| func ParseECPrivateKeyFromPEM(key []byte) (*ecdsa.PrivateKey, error) { | ||||
| 	var err error | ||||
|  | ||||
| 	// Parse PEM block | ||||
| 	var block *pem.Block | ||||
| 	if block, _ = pem.Decode(key); block == nil { | ||||
| 		return nil, ErrKeyMustBePEMEncoded | ||||
| 	} | ||||
|  | ||||
| 	// Parse the key | ||||
| 	var parsedKey interface{} | ||||
| 	if parsedKey, err = x509.ParseECPrivateKey(block.Bytes); err != nil { | ||||
| 		if parsedKey, err = x509.ParsePKCS8PrivateKey(block.Bytes); err != nil { | ||||
| 			return nil, err | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	var pkey *ecdsa.PrivateKey | ||||
| 	var ok bool | ||||
| 	if pkey, ok = parsedKey.(*ecdsa.PrivateKey); !ok { | ||||
| 		return nil, ErrNotECPrivateKey | ||||
| 	} | ||||
|  | ||||
| 	return pkey, nil | ||||
| } | ||||
|  | ||||
| // ParseECPublicKeyFromPEM parses a PEM encoded PKCS1 or PKCS8 public key | ||||
| func ParseECPublicKeyFromPEM(key []byte) (*ecdsa.PublicKey, error) { | ||||
| 	var err error | ||||
|  | ||||
| 	// Parse PEM block | ||||
| 	var block *pem.Block | ||||
| 	if block, _ = pem.Decode(key); block == nil { | ||||
| 		return nil, ErrKeyMustBePEMEncoded | ||||
| 	} | ||||
|  | ||||
| 	// Parse the key | ||||
| 	var parsedKey interface{} | ||||
| 	if parsedKey, err = x509.ParsePKIXPublicKey(block.Bytes); err != nil { | ||||
| 		if cert, err := x509.ParseCertificate(block.Bytes); err == nil { | ||||
| 			parsedKey = cert.PublicKey | ||||
| 		} else { | ||||
| 			return nil, err | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	var pkey *ecdsa.PublicKey | ||||
| 	var ok bool | ||||
| 	if pkey, ok = parsedKey.(*ecdsa.PublicKey); !ok { | ||||
| 		return nil, ErrNotECPublicKey | ||||
| 	} | ||||
|  | ||||
| 	return pkey, nil | ||||
| } | ||||
		Reference in New Issue
	
	Block a user