Data scrubbing options for protecting sensitive data https://godoc.org/maze.io/x/scrub
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

103 lines
5.0 KiB

package scrub
import "testing"
func TestPEMDHParameters(t *testing.T) {
testScrubber(t, PEMDHParameters, []testScrubberCase{
{Test: testDHParams, Want: wantDHParams},
})
}
func TestPEMPrivateKey(t *testing.T) {
testScrubber(t, PEMPrivateKey, []testScrubberCase{
{Test: testRSAPrivateKey, Want: wantRSAPrivateKey},
{Test: testSSHEd25519Key, Want: wantSSHEd25519Key},
})
}
var (
testDHParams = `-----BEGIN DH PARAMETERS-----
MIGHAoGBANob7KUDV/hqwO2TRlE119oYOxrStVPMaqzuPCnXBX0dw5Yn9lYjoMI9
6jSberXoK58qVZzeCIfgcUg7+JeTuEvD2zBI9iayb6NlYV6/6z6vKQHmCeGmK1k/
g1c4LRyWfXDsN94o5oYO7LfyIdZCoOG+mkqO60glbQGBNKMXvPcLAgEC
-----END DH PARAMETERS-----
`
wantDHParams = `-----BEGIN DH PARAMETERS-----
*redacted*******************************************************
*redacted*******************************************************
*redacted***********************************************
-----END DH PARAMETERS-----
`
testRSAPrivateKey = `-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEAtsR8bBSc4ippQhkAO2iPdpQwxjdVfvmHgISQ6pj9lK+XPOu2
qLknjMd+WxN04BSLKup+Pu+3hbnhiyFG9wbipXQxbhLKFSelDfeKpYEQApTbF0Ec
wQ0etVnc0V4mElmmOVN8RIG8HfjXB3NO9lInDvdXoc5IMGEzP9i4wqfGpfxKUkAu
3Mg8/phziJNFJ7f59FlFJrcjOsfmPCV/KqO4zlGY0tLEd0XJ03+0BY6Vs+D3KyyU
6OZIWjKHYM5MNnDTdSdEfK21e/ul+EYD77bsTLmbHDN+HU0lgNzWJTigpsZymEtp
8G3GUsJMBxh8zT/uLIT7vfuuUqnO4fhZxiW0XwIDAQABAoIBACW+QeuX/iX+mCoc
O54JI8dbJw9oEfHc2gzCU6L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I
g9bxjODr2RRt/GOH9WlNd5OkcMkqQfRQ75NNEFNW5I85oWP3yuRCPbav51BB1DrF
Rlg5XnHMNc5SXbMjTQpUjjNVefoNss6FXYZTEvR8k/0CBjh9MFQH
-----END RSA PRIVATE KEY-----
`
wantRSAPrivateKey = `-----BEGIN RSA PRIVATE KEY-----
*redacted*******************************************************
*redacted*******************************************************
*redacted*******************************************************
*redacted*******************************************************
*redacted*******************************************************
*redacted*******************************************************
*redacted*******************************************************
*redacted*******************************************************
*redacted*******************************************************
*redacted*******************************************************
*redacted*******************************************************
*redacted*******************************************************
*redacted*******************************************************
*redacted*******************************************************
*redacted*******************************************************
*redacted*******************************************************
*redacted*******************************************************
*redacted*******************************************************
*redacted*******************************************************
*redacted*******************************************************
*redacted*******************************************************
*redacted*******************************************************
*redacted*******************************************************
*redacted*******************************************************
*redacted*******************************************
-----END RSA PRIVATE KEY-----
`
testSSHEd25519Key = `-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
QyNTUxOQAAACB4nWmwuPMYbVcNVzWhWGsu1CRJ0N9Jq+tDXvP0yG/u/AAAAIiRtuIakbbi
GgAAAAtzc2gtZWQyNTUxOQAAACB4nWmwuPMYbVcNVzWhWGsu1CRJ0N9Jq+tDXvP0yG/u/A
AAAECquNjGZMIC/5JAJ3qFpcmmJ439t5iD3XWsK/dXUjP8RHidabC48xhtVw1XNaFYay7U
JEnQ30mr60Ne8/TIb+78AAAAAAECAwQF
-----END OPENSSH PRIVATE KEY-----
`
wantSSHEd25519Key = `-----BEGIN OPENSSH PRIVATE KEY-----
*redacted*************************************************************
*redacted*************************************************************
*redacted*************************************************************
*redacted*************************************************************
*redacted***********************
-----END OPENSSH PRIVATE KEY-----
`
)