diff --git a/std/ndn/constants.go b/std/ndn/constants.go index 81e21bf7..b0cb4e04 100644 --- a/std/ndn/constants.go +++ b/std/ndn/constants.go @@ -8,7 +8,7 @@ const ( ContentTypeLink ContentType = 1 ContentTypeKey ContentType = 2 ContentTypeNack ContentType = 3 - ContentTypeSecret ContentType = 9 + ContentTypeSigKey ContentType = 9 ) // SigType represents the type of signature. diff --git a/std/security/certificate.go b/std/security/certificate.go index 63f55de8..f128526a 100644 --- a/std/security/certificate.go +++ b/std/security/certificate.go @@ -86,7 +86,7 @@ func getPubKey(data ndn.Data) ([]byte, enc.Name, error) { return nil, nil, err } return pub, keyName, nil - case ndn.ContentTypeSecret: + case ndn.ContentTypeSigKey: // Content is private key, parse the signer signer, err := sig.UnmarshalSecret(data) if err != nil { diff --git a/std/security/decode_file.go b/std/security/decode_file.go index f8050ba2..d9f87710 100644 --- a/std/security/decode_file.go +++ b/std/security/decode_file.go @@ -46,7 +46,7 @@ func DecodeFile(content []byte) (signers []ndn.Signer, certs [][]byte, err error switch *data.ContentType() { case ndn.ContentTypeKey: // cert certs = append(certs, wire) - case ndn.ContentTypeSecret: // key + case ndn.ContentTypeSigKey: // key key, err := sig.UnmarshalSecret(data) if err != nil || key == nil { log.Warn(nil, "Failed to decode key", "name", data.Name(), "error", err) diff --git a/std/security/rfc7468.go b/std/security/rfc7468.go index a92b9cd0..e2bc1e4d 100644 --- a/std/security/rfc7468.go +++ b/std/security/rfc7468.go @@ -71,7 +71,7 @@ func PemEncode(raw []byte) ([]byte, error) { switch *data.ContentType() { case ndn.ContentTypeKey: pemType = PEM_TYPE_CERT - case ndn.ContentTypeSecret: + case ndn.ContentTypeSigKey: pemType = PEM_TYPE_SECRET default: return nil, errors.New("unsupported content type") diff --git a/std/security/signer/marshal.go b/std/security/signer/marshal.go index 503592da..9c1acd5d 100644 --- a/std/security/signer/marshal.go +++ b/std/security/signer/marshal.go @@ -39,7 +39,7 @@ func MarshalSecret(key ndn.Signer) (enc.Wire, error) { // Encode key data packet cfg := &ndn.DataConfig{ - ContentType: utils.IdPtr(ndn.ContentTypeSecret), + ContentType: utils.IdPtr(ndn.ContentTypeSigKey), } data, err := spec.Spec{}.MakeData(name, cfg, enc.Wire{sk}, key) if err != nil { @@ -52,7 +52,7 @@ func MarshalSecret(key ndn.Signer) (enc.Wire, error) { // UnmarshalSecret decodes a signed NDN Data packet to a key secret. func UnmarshalSecret(data ndn.Data) (ndn.Signer, error) { // Check data content type - if data.ContentType() == nil || *data.ContentType() != ndn.ContentTypeSecret { + if data.ContentType() == nil || *data.ContentType() != ndn.ContentTypeSigKey { return nil, ndn.ErrInvalidValue{Item: "content type"} } diff --git a/std/security/signer/marshal_test.go b/std/security/signer/marshal_test.go index 4703cf83..9eee65f8 100644 --- a/std/security/signer/marshal_test.go +++ b/std/security/signer/marshal_test.go @@ -50,7 +50,7 @@ func TestMarshalSecret(t *testing.T) { // check output data data, _, err := spec.Spec{}.ReadData(enc.NewWireReader(wire)) require.NoError(t, err) - require.Equal(t, ndn.ContentTypeSecret, *data.ContentType()) + require.Equal(t, ndn.ContentTypeSigKey, *data.ContentType()) require.Equal(t, RSA_KEY_NAME, data.Name()) require.Equal(t, secret, data.Content().Join()) }