JNI: fix for DH state check when loading private/public keys
parent
1132acbae9
commit
3a306131a5
|
@ -84,7 +84,7 @@ public class Dh extends NativeStruct {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPrivateKey(byte[] priv) {
|
public void setPrivateKey(byte[] priv) {
|
||||||
if (state == WolfCryptState.READY) {
|
if (state != WolfCryptState.UNINITIALIZED) {
|
||||||
if (privateKey != null)
|
if (privateKey != null)
|
||||||
for (int i = 0; i < privateKey.length; i++)
|
for (int i = 0; i < privateKey.length; i++)
|
||||||
privateKey[i] = 0;
|
privateKey[i] = 0;
|
||||||
|
@ -97,7 +97,7 @@ public class Dh extends NativeStruct {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPublicKey(byte[] pub) {
|
public void setPublicKey(byte[] pub) {
|
||||||
if (state == WolfCryptState.READY) {
|
if (state != WolfCryptState.UNINITIALIZED) {
|
||||||
if (publicKey != null)
|
if (publicKey != null)
|
||||||
for (int i = 0; i < publicKey.length; i++)
|
for (int i = 0; i < publicKey.length; i++)
|
||||||
publicKey[i] = 0;
|
publicKey[i] = 0;
|
||||||
|
|
Loading…
Reference in New Issue