Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion cryptojs/decrypt.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
category: 'function',
color: '#a6bbcf',
defaults: {
name: {value: ''}, algorithm: {value: '', required: true}, key: {value: '', required: true}
name: {value: ''}, algorithm: {value: '', required: true}, key: {value: '', required: true}, isSecretKeyHex: {value: false}
},
inputs: 1,
outputs: 1,
Expand Down Expand Up @@ -33,6 +33,10 @@
<label for="node-input-key"><i class="icon-tag"></i> Secret Key</label>
<input type="text" id="node-input-key" placeholder="Secret Key">
</div>
<div class="form-row">
<label for="node-input-isSecretKeyHex"><i class="icon-tag"></i> Interpret Secret Key as hex string</label>
<input type="checkbox" id="node-input-isSecretKeyHex">
</div>
</script>

<script type="text/x-red" data-help-name="decrypt">
Expand Down
7 changes: 7 additions & 0 deletions cryptojs/decrypt.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ module.exports = function (RED) {
if(msg.secretkey) {
node.key = msg.secretkey;
}
if(msg.isSecretKeyHex !== undefined
&& typeof msg.isSecretKeyHex == "boolean") {
config.isSecretKeyHex = msg.isSecretKeyHex;
}
if(config.isSecretKeyHex) {
node.key = CryptoJS.enc.Hex.parse(node.key);
}
// check configurations
if(!node.algorithm || !node.key) {
// rising misconfiguration error
Expand Down
6 changes: 5 additions & 1 deletion cryptojs/encrypt.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
category: 'function',
color: '#a6bbcf',
defaults: {
name: {value: ''}, algorithm: {value: '', required: true}, key: {value: '', required: true}
name: {value: ''}, algorithm: {value: '', required: true}, key: {value: '', required: true}, isSecretKeyHex: {value: false}
},
inputs: 1,
outputs: 1,
Expand Down Expand Up @@ -33,6 +33,10 @@
<label for="node-input-key"><i class="icon-tag"></i> Secret Key</label>
<input type="text" id="node-input-key" placeholder="Secret Key">
</div>
<div class="form-row">
<label for="node-input-isSecretKeyHex"><i class="icon-tag"></i> Interpret Secret Key as hex string</label>
<input type="checkbox" id="node-input-isSecretKeyHex">
</div>
</script>

<script type="text/x-red" data-help-name="encrypt">
Expand Down
7 changes: 7 additions & 0 deletions cryptojs/encrypt.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ module.exports = function (RED) {
if(msg.secretkey) {
node.key = msg.secretkey;
}
if(msg.isSecretKeyHex !== undefined
&& typeof msg.isSecretKeyHex == "boolean") {
config.isSecretKeyHex = msg.isSecretKeyHex;
}
if(config.isSecretKeyHex) {
node.key = CryptoJS.enc.Hex.parse(node.key);
}
// check configurations
if(!node.algorithm || !node.key) {
// rising misconfiguration error
Expand Down
6 changes: 5 additions & 1 deletion cryptojs/hmac.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
category: 'function',
color: '#a6bbcf',
defaults: {
name: {value: ''}, algorithm: {value: '', required: true}, key: {value: '', required: true}
name: {value: ''}, algorithm: {value: '', required: true}, key: {value: '', required: true}, isSecretKeyHex: {value: false}
},
inputs: 1,
outputs: 1,
Expand Down Expand Up @@ -36,6 +36,10 @@
<label for="node-input-key"><i class="icon-tag"></i> Secret Key</label>
<input type="text" id="node-input-key" placeholder="Secret Key">
</div>
<div class="form-row">
<label for="node-input-isSecretKeyHex"><i class="icon-tag"></i> Interpret Secret Key as hex string</label>
<input type="checkbox" id="node-input-isSecretKeyHex">
</div>
</script>

<script type="text/x-red" data-help-name="hmac">
Expand Down
7 changes: 7 additions & 0 deletions cryptojs/hmac.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ module.exports = function (RED) {
if(msg.secretkey) {
node.key = msg.secretkey;
}
if(msg.isSecretKeyHex !== undefined
&& typeof msg.isSecretKeyHex == "boolean") {
config.isSecretKeyHex = msg.isSecretKeyHex;
}
if(config.isSecretKeyHex) {
node.key = CryptoJS.enc.Hex.parse(node.key);
}
// check configurations
if(!node.algorithm || !node.key) {
// rising misconfiguration error
Expand Down