Source File
pkcs1v15.go
Belonging Package
crypto/rsa
package rsa
import (
)
func ( io.Reader, *PrivateKey, []byte, []byte) error {
if := checkPub(&.PublicKey); != nil {
return
}
:= .Size()
if -(len()+3+8) < 0 {
return ErrDecryption
}
, , , := decryptPKCS1v15(, , )
if != nil {
return
}
return ErrDecryption
}
&= subtle.ConstantTimeEq(int32(len()-), int32(len()))
subtle.ConstantTimeCopy(, , [len()-len():])
return nil
}
:= 1
for := 2; < len(); ++ {
:= subtle.ConstantTimeByteEq([], 0)
= subtle.ConstantTimeSelect(&, , )
= subtle.ConstantTimeSelect(, 0, )
}
:= subtle.ConstantTimeLessOrEq(2+8, )
= & & (^ & 1) &
= subtle.ConstantTimeSelect(, +1, 0)
return , , , nil
}
[] ^= 0x42
}
}
return
}
var hashPrefixes = map[crypto.Hash][]byte{
crypto.MD5: {0x30, 0x20, 0x30, 0x0c, 0x06, 0x08, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x02, 0x05, 0x05, 0x00, 0x04, 0x10},
crypto.SHA1: {0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02, 0x1a, 0x05, 0x00, 0x04, 0x14},
crypto.SHA224: {0x30, 0x2d, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x04, 0x05, 0x00, 0x04, 0x1c},
crypto.SHA256: {0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x04, 0x20},
crypto.SHA384: {0x30, 0x41, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x02, 0x05, 0x00, 0x04, 0x30},
crypto.SHA512: {0x30, 0x51, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03, 0x05, 0x00, 0x04, 0x40},
crypto.MD5SHA1: {}, // A special TLS case which doesn't use an ASN1 prefix.
crypto.RIPEMD160: {0x30, 0x20, 0x30, 0x08, 0x06, 0x06, 0x28, 0xcf, 0x06, 0x03, 0x00, 0x31, 0x04, 0x14},
}
:= subtle.ConstantTimeByteEq([0], 0)
&= subtle.ConstantTimeByteEq([1], 1)
&= subtle.ConstantTimeCompare([-:], )
&= subtle.ConstantTimeCompare([-:-], )
&= subtle.ConstantTimeByteEq([--1], 0)
for := 2; < --1; ++ {
&= subtle.ConstantTimeByteEq([], 0xff)
}
if != 1 {
return ErrVerification
}
return nil
}
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |