tu.crossing.JavaCryptographicArchitecture.3.1.2.source-code.Signature.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 java.security.Signature
OBJECTS
byte[] sign;
byte inputByte;
byte[] input;
byte[] output;
java.nio.ByteBuffer inputByteBuffer;
java.lang.String algorithm;
java.security.PrivateKey privateKey;
java.security.PublicKey publicKey;
java.security.cert.Certificate cert;
java.security.spec.AlgorithmParameterSpec params;
boolean verified;
int offset;
int len;
EVENTS
g1: getInstance(algorithm);
g2: getInstance(algorithm, _);
Get := g1 | g2;
i1: initSign(privateKey);
i2: initSign(privateKey, _);
i3: initVerify(cert);
i4: initVerify(publicKey);
InitSign := i1 | i2;
InitVerify := i3 | i4;
u1: update(input);
u2: update(inputByte);
u3: update(input, offset, len);
u4: update(inputByteBuffer);
Update := u1 | u2 | u3 | u4;
s1: output = sign();
s2: sign(output, offset, len);
Sign := s1 | s2;
v1: verified = verify(sign);
v2: verified = verify(sign, offset, len);
Verify := v1 | v2;
ORDER
Get, ((InitSign+, (Update+, Sign+)+ )+ | (InitVerify+, (Update*, Verify+)+ )+ )
CONSTRAINTS
algorithm in {"SHA256withRSA", "SHA256withECDSA", "SHA256withDSA", "SHA384withRSA", "SHA512withRSA", "SHA384withECDSA", "SHA512withECDSA"};
length[input] >= offset + len;
offset >= 0;
len > 0;
REQUIRES
generatedPrivkey[privateKey];
generatedPubkey[publicKey];
ENSURES
signed[output, inputByte] after Sign;
signed[output, input] after Sign;
signed[output, inputByteBuffer] after Sign;
verified[verified, sign] after Verify;