You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: runtime/auth/aws-signing-default/common/src/aws/smithy/kotlin/runtime/auth/awssigning/SignatureCalculator.kt
+5-7Lines changed: 5 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -152,10 +152,8 @@ internal class SigV4aSignatureCalculator(override val sha256Provider: HashSuppli
152
152
var counter:Byte=1
153
153
var privateKey:ByteArray
154
154
155
-
// N value from NIST P-256 curve
156
-
// FIXME optimization: n is never used by itself, only n-2. Subtract two from the const.
157
-
val nBytes ="FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551".decodeHexBytes()
158
-
val n =BigInteger(nBytes)
155
+
// N value from NIST P-256 curve, minus two.
156
+
val nMinusTwo =BigInteger("FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC63254f".decodeHexBytes())
159
157
160
158
// FIXME Public docs say secret access key needs to be Base64 encoded, that's not right.
161
159
// (or maybe it's already base64-encoded, and they are just repeating it)
@@ -170,18 +168,18 @@ internal class SigV4aSignatureCalculator(override val sha256Provider: HashSuppli
170
168
171
169
privateKey = (c +BigInteger("1")).toByteArray()
172
170
173
-
if (counter ==MAX_KDF_COUNTER_ITERATIONS&& c >n -BigInteger("2")) {
171
+
if (counter ==MAX_KDF_COUNTER_ITERATIONS&& c >nMinusTwo) {
174
172
throwIllegalStateException("Counter exceeded maximum length")
175
173
} else {
176
174
counter++
177
175
}
178
-
} while (c >n -BigInteger("2"))
176
+
} while (c >nMinusTwo)
179
177
180
178
return privateKey
181
179
}
182
180
183
181
/**
184
-
* Computes the fixed input string used for KDF
182
+
* Computes the fixed input string used for ECDSA private key derivation
0 commit comments