Skip to content

Commit b102a2e

Browse files
committed
Prefer node identity key for plugin envelope decryption
1 parent e89a893 commit b102a2e

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

sdn-server/internal/node/node.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,12 @@ func (n *Node) loadPluginRegistry() (*license.PluginRegistry, error) {
433433
}
434434

435435
func (n *Node) findPluginDecryptPrivateKey() ([]byte, error) {
436+
if n.identity != nil && len(n.identity.EncryptionKey) == 32 {
437+
key := make([]byte, len(n.identity.EncryptionKey))
438+
copy(key, n.identity.EncryptionKey)
439+
return key, nil
440+
}
441+
436442
envNames := []string{
437443
"SDN_PLUGIN_DECRYPT_KEY",
438444
"SDN_PLUGIN_KEY",
@@ -451,12 +457,6 @@ func (n *Node) findPluginDecryptPrivateKey() ([]byte, error) {
451457
}
452458
}
453459

454-
if n.identity != nil && len(n.identity.EncryptionKey) == 32 {
455-
key := make([]byte, len(n.identity.EncryptionKey))
456-
copy(key, n.identity.EncryptionKey)
457-
return key, nil
458-
}
459-
460460
return nil, nil
461461
}
462462

0 commit comments

Comments
 (0)