Skip to content

Add option to pass key without begin/end boundaries #139

Closed
@enver

Description

@enver

After merging fix for #131 a brake change has been introduced as users can't import keys without begin/end boundaries anymore. Previously boundaries were removed if they existed now beside removing boundaries there is also check which is raising error if they don't exist.

<<< error >>>

(node:1) UnhandledPromiseRejectionWarning: Error: Missing BEGIN line
    at Object.module.exports.trimSurroundingText (/app/node_modules/node-rsa/src/utils.js:96:15)
    at Object.privateImport (/app/node_modules/node-rsa/src/formats/pkcs1.js:55:33)
    at Object.detectAndImport (/app/node_modules/node-rsa/src/formats/formats.js:63:48)
    at NodeRSA.module.exports.NodeRSA.importKey (/app/node_modules/node-rsa/src/NodeRSA.js:183:22)

There should be an option to disable boundary checks https://github.com/garethsime/node-rsa/blob/4fce44453452855033f1fab8c7afbaebfcd019d9/src/formats/pkcs1.js#L17 and https://github.com/garethsime/node-rsa/blob/4fce44453452855033f1fab8c7afbaebfcd019d9/src/formats/pkcs1.js#L22 in order to provide some kind of backward compatibility or this check should be removed completely.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions