github.com/zmap/zcrypto@v0.0.0-20240512203510-0fef58d9a9db/x509/names.go (about)

     1  // Copyright 2015 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package x509
     6  
     7  func (p PublicKeyAlgorithm) String() string {
     8  	if p >= total_key_algorithms || p < 0 {
     9  		p = UnknownPublicKeyAlgorithm
    10  	}
    11  	return keyAlgorithmNames[p]
    12  }
    13  
    14  func (c *Certificate) SignatureAlgorithmName() string {
    15  	switch c.SignatureAlgorithm {
    16  	case UnknownSignatureAlgorithm:
    17  		return c.SignatureAlgorithmOID.String()
    18  	default:
    19  		return c.SignatureAlgorithm.String()
    20  	}
    21  }
    22  
    23  func (c *Certificate) PublicKeyAlgorithmName() string {
    24  	switch c.PublicKeyAlgorithm {
    25  	case UnknownPublicKeyAlgorithm:
    26  		return c.PublicKeyAlgorithmOID.String()
    27  	default:
    28  		return c.PublicKeyAlgorithm.String()
    29  	}
    30  }