tu.crossing.JavaCryptographicArchitecture.3.1.2.source-code.KeyAgreement.crysl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of JavaCryptographicArchitecture
Show all versions of JavaCryptographicArchitecture
JavaCryptographicArchitecture CrySL ruleset
The newest version!
SPEC javax.crypto.KeyAgreement
OBJECTS
java.lang.String algorithm;
java.lang.String symmetricKeyAlgorithm;
java.security.Key pubKey;
java.security.Key privKey;
javax.crypto.SecretKey sharedKey;
boolean lastPhase;
byte[] sharedSecretBuffer;
int offset;
java.security.spec.AlgorithmParameterSpec params;
java.security.SecureRandom random;
EVENTS
g1: getInstance(algorithm);
g2: getInstance(algorithm, _);
Get := g1 | g2;
i1: init(privKey);
i2: init(privKey, params);
i3: init(privKey, params, random);
i4: init(privKey, random);
Init := i1 | i2 | i3 | i4;
dp1: doPhase(pubKey, lastPhase);
DoPhase := dp1;
gs1: sharedSecretBuffer = generateSecret();
gs2: generateSecret(sharedSecretBuffer, offset);
GenSecretBuffer := gs1 | g2;
gs3: sharedKey = generateSecret(symmetricKeyAlgorithm);
GenSecret := gs3 | GenSecretBuffer;
ORDER
Get, Init, DoPhase, GenSecretBuffer
CONSTRAINTS
algorithm in {"DH", "DiffieHellman", "ECDH"};
noCallTo[gs3];
REQUIRES
randomized[random];
generatedPrivkey[privKey];
generatedPubkey[pubKey];
algorithm in {"DiffieHellman", "DH"} => preparedDH[params];
algorithm in {"ECDH"} => preparedEC[params];
ENSURES
preparedKeyMaterial[sharedSecretBuffer] after GenSecretBuffer;