@@ -31,11 +31,11 @@ func (suite *RSAKeypairTestSuite) TestGenerateRSA_UsesMinimumBitLength() {
3131func (suite * RSAKeypairTestSuite ) TestGenerateRSA_GeneratesRSAKeypair () {
3232 kp , err := keypairs .GenerateRSA (keypairs .MinimumRSABitLength )
3333 suite .Require ().Nil (err )
34- suite .Regexp (`^-{5}BEGIN RSA PRIVATE KEY-{5}\s[[:alnum:]/+=]{44} \s-{5}END RSA PRIVATE KEY-{5}\s ` , kp .EncodePrivateKey ())
34+ suite .Regexp (`^-{5}BEGIN RSA PRIVATE KEY-{5}\s[[:alnum:]/+=\s]+? \s-{5}END RSA PRIVATE KEY-{5}` , kp .EncodePrivateKey ())
3535
3636 encPubKey , err := kp .EncodePublicKey ()
3737 suite .Require ().Nil (err )
38- suite .Regexp (`^-{5}BEGIN RSA PUBLIC KEY-{5}\s[[:alnum:]/+=]{44} \s-{5}END RSA PUBLIC KEY-{5}\s ` , encPubKey )
38+ suite .Regexp (`^-{5}BEGIN RSA PUBLIC KEY-{5}\s[[:alnum:]/+=\s]+ \s-{5}END RSA PUBLIC KEY-{5}` , encPubKey )
3939}
4040
4141func (suite * RSAKeypairTestSuite ) TestRSAKeypair_EncryptAndEncodePrivateKey () {
@@ -51,18 +51,8 @@ func (suite *RSAKeypairTestSuite) TestRSAKeypair_EncryptAndEncodePrivateKey() {
5151 suite .Regexp (`-{5}END RSA PRIVATE KEY-{5}\s` , keyPEM )
5252}
5353
54- func (suite * RSAKeypairTestSuite ) TestRSAKeypair_MessageTooLongForKeySize () {
55- kp , err := keypairs .GenerateRSA (keypairs .MinimumRSABitLength )
56- suite .Require ().Nil (err )
57-
58- encMsg , err := kp .Encrypt ([]byte ("howdy doody" ))
59- suite .Nil (encMsg )
60- suite .Require ().Error (err )
61- suite .Contains (err .Error (), "EncryptOAEP failed" )
62- }
63-
6454func (suite * RSAKeypairTestSuite ) TestRSAKeypair_EncryptsAndDecrypts () {
65- kp , err := keypairs .GenerateRSA (1024 )
55+ kp , err := keypairs .GenerateRSA (keypairs . MinimumRSABitLength )
6656 suite .Require ().Nil (err )
6757
6858 encryptedMsg , err := kp .Encrypt ([]byte ("howdy doody" ))
@@ -75,7 +65,7 @@ func (suite *RSAKeypairTestSuite) TestRSAKeypair_EncryptsAndDecrypts() {
7565}
7666
7767func (suite * RSAKeypairTestSuite ) TestRSAKeypair_EncodesAndDeccodesEncryptedValues () {
78- kp , err := keypairs .GenerateRSA (1024 )
68+ kp , err := keypairs .GenerateRSA (keypairs . MinimumRSABitLength )
7969 suite .Require ().Nil (err )
8070
8171 encryptedMsg , err := kp .EncryptAndEncode ([]byte ("howdy doody" ))
@@ -188,7 +178,5 @@ func (suite *RSAKeypairTestSuite) TestParseEncryptedRSA_IncorrectPassphrase() {
188178}
189179
190180func Test_RSAKeypair_TestSuite (t * testing.T ) {
191- t .Skip ("This is still captured by integration tests, but for now we're skipping the unit test as it" +
192- " prevents CI from running and we need time to devise a proper solution." )
193181 suite .Run (t , new (RSAKeypairTestSuite ))
194182}
0 commit comments