MCPcopy
hub / github.com/hyperledger/fabric / computeSKI

Function computeSKI

integration/msp/rsaca_test.go:460–477  ·  view source on GitHub ↗
(key crypto.PublicKey)

Source from the content-addressed store, hash-verified

458}
459
460func computeSKI(key crypto.PublicKey) ([]byte, error) {
461 var raw []byte
462 switch key := key.(type) {
463 case *rsa.PublicKey:
464 raw = x509.MarshalPKCS1PublicKey(key)
465 case *ecdsa.PublicKey:
466 ecdhKey, err := key.ECDH()
467 if err != nil {
468 return nil, fmt.Errorf("public key transition failed: %w", err)
469 }
470 raw = ecdhKey.Bytes()
471 default:
472
473 return nil, fmt.Errorf("unexpected type: %T", key)
474 }
475 hash := sha256.Sum256(raw)
476 return hash[:], nil
477}

Callers 3

newCAFunction · 0.70
issueSignCertificateMethod · 0.70
issueTLSCertificateMethod · 0.70

Calls 2

ErrorfMethod · 0.65
BytesMethod · 0.65

Tested by

no test coverage detected