File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -85,6 +85,11 @@ func ImportRSAPublicKeyBlob(data []byte) (*rsa.PublicKey, error) {
8585 if bh .Version != curBlobVersion {
8686 return nil , errors .New ("invalid blob version" )
8787 }
88+ switch bh .AiKeyAlg {
89+ case cAlgRSASign , cAlgRSAKeyX :
90+ default :
91+ return nil , errors .New ("invalid public key algorithm" )
92+ }
8893 var rp rsaPubKey
8994 err = binary .Read (reader , binary .LittleEndian , & rp )
9095 if err != nil {
@@ -122,6 +127,11 @@ func ImportRSAPrivateKeyBlob(data []byte) (*rsa.PrivateKey, error) {
122127 if bh .Version != curBlobVersion {
123128 return nil , errors .New ("invalid blob version" )
124129 }
130+ switch bh .AiKeyAlg {
131+ case cAlgRSASign , cAlgRSAKeyX :
132+ default :
133+ return nil , errors .New ("invalid private key algorithm" )
134+ }
125135 var rp rsaPubKey
126136 err = binary .Read (reader , binary .LittleEndian , & rp )
127137 if err != nil {
You can’t perform that action at this time.
0 commit comments