-
Notifications
You must be signed in to change notification settings - Fork 12
BSI Adherance #247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
BSI Adherance #247
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,21 @@ | ||
SPEC javax.crypto.spec.DHParameterSpec | ||
|
||
OBJECTS | ||
OBJECTS | ||
java.math.BigInteger p; | ||
java.math.BigInteger g; | ||
int l; | ||
|
||
EVENTS | ||
c1: DHParameterSpec(p, g); | ||
c2: DHParameterSpec(p, g, l); | ||
Con := c1 | c2; | ||
|
||
ORDER | ||
Con | ||
|
||
CONSTRAINTS | ||
p >= 1^2048; | ||
g >= 1^2048; | ||
bitlength(p) >= 3000;// Choose an element g ∈ F∗ p withord(g) primeandq := ord(g) ≥ 2^250 | ||
bitlength(g) >= 250; | ||
|
||
ENSURES | ||
preparedDH[this]; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ OBJECTS | |
byte[] src; | ||
int offset; | ||
int len; | ||
byte[] iv; | ||
|
||
EVENTS | ||
c1: GCMParameterSpec(tagLen, src); | ||
|
@@ -15,10 +16,12 @@ ORDER | |
Con | ||
|
||
CONSTRAINTS | ||
tagLen in {96, 104, 112, 120, 128}; | ||
tagLen in {96, 104, 112, 120, 128};//GCM with a length of the GCM tags of at least 96 bits should be used. | ||
length[src] >= offset + len; | ||
offset >= 0; | ||
len > 0; | ||
length[iv] == 12; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
unique[iv] // initiallization vector should not be repeated over the entire lifetime of a key | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't have a predefined predicate |
||
|
||
REQUIRES | ||
randomized[src]; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ CONSTRAINTS | |
length[iv] >= offset + len; | ||
offset >= 0; | ||
len > 0; | ||
unique[iv] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't have a predefined predicate |
||
|
||
REQUIRES | ||
randomized[iv]; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,15 +37,19 @@ ORDER | |
Get, Init, DoPhase, (GenSecret | GenSecretBuffer) | ||
|
||
CONSTRAINTS | ||
algorithm in {"DH", "DiffieHellman", "NH" ,"ECDH", "ECDHC"}; | ||
algorithm in {"DH","DiffieHellman","ECDH","NH", "ECDHC"}; | ||
keyLength>=3000; | ||
curveBits>= 250; | ||
symmetricKeyAlgorithm in {"AES", "HmacSHA256", "HmacSHA384", "HmacSHA512", | ||
"HMACSHA3-256", "HMACSHA3-384", "HMACSHA3-512"}; | ||
tagLength>=96 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
|
||
REQUIRES | ||
randomized[random]; | ||
generatedPrivkey[privKey]; | ||
generatedPubkey[pubKey]; | ||
algorithm in {"DiffieHellman", "DH"} => preparedDH[params]; | ||
algorithm in {"DiffieHellman","DH"} => preparedDH[params]; | ||
algorithm in {"ECDH", "ECDHC"} => preparedEC[params]; | ||
|
||
ENSURES | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,7 @@ CONSTRAINTS | |
"Twofish", "Poly1305-Twofish", "XSalsa20"}; | ||
algorithm in {"AES", "Poly1305-Camellia", "Camellia", "ChaCha", "Salsa20", "SHACAL-2", "Shacal2", | ||
"Rijndael", "Serpent", "Tnepres", "ChaCha7539", "Poly1305", "Poly1305-Serpent", | ||
"Twofish", "Poly1305-Twofish", "XSalsa20"} => keysize in {128, 192, 256}; | ||
"Twofish", "Poly1305-Twofish", "XSalsa20"} => keysize >= 128; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AFAIK, the JCA supports only key sizes of 128, 192 and 256. In all other cases, it throws an exception. Hence, we should keep the explicit key sizes |
||
|
||
REQUIRES | ||
randomized[random]; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,8 @@ EVENTS | |
i2: initialize(keysize, _); | ||
i3: initialize(params); | ||
i4: initialize(params, _); | ||
Init := i1 | i2 | i3 | i4; | ||
i5: initialize(java.security.spec.AlgorithmParameterSpec, java.security.SecureRandom) | ||
Init := i1 | i2 | i3 | i4 | i5; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This does not work, because |
||
|
||
k1: keyPair = generateKeyPair(); | ||
k2: keyPair = genKeyPair(); | ||
|
@@ -25,18 +26,18 @@ ORDER | |
Get, Init, Gen | ||
|
||
CONSTRAINTS | ||
algorithm in {"RSA", "DSA", "DiffieHellman", "DH", "EC", "ECDSA", "ECDH", "ECDHWITHSHA1KDF", "ECDHC", | ||
algorithm in {"RSA", "DSA", "DiffieHellman", "DH", "EC", "ECDSA", "ECDH", "ECDHWITHSHA1KDF", "ECDHC", | ||
"ECIES", "ElGamal", "McElieceKobaraImai", "McEliecePointcheval", "McElieceFujisaki", | ||
"McEliece", "McEliece-CCA2", "NH", "QTESLA", "Rainbow", "SPHINCS256", "XMSS", "XMSSMT"}; | ||
|
||
algorithm in {"RSA"} => keysize in {4096, 3072}; //BSI TR-02102-1 Recommends atleast 3000bits for keys | ||
algorithm in {"DSA"} => keysize in {3072}; | ||
algorithm in {"DiffieHellman", "DH"} => keysize in {3072}; | ||
algorithm in {"EC", "ECDSA", "ECDH", "ECDHWITHSHA1KDF", "ECDHC", "ECIES"} => keysize in {256}; | ||
|
||
algorithm in {"RSA"} => keysize >= 3000; //BSI TR-02102-1 Recommends atleast 3000bits for keys | ||
algorithm in {"DSA"} => keysize >= 3072; | ||
algorithm in {"DiffieHellman", "DH"} => keysize >= 3000; | ||
algorithm in {"EC", "ECDSA", "ECDH", "ECDHWITHSHA1KDF", "ECDHC", "ECIES"} => keysize >= 320; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See above. We should keep explicit key sizes |
||
algorithm in {"DSA"} && afterYear >= 2029 => false;//# DSA deprecated after 2029 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is |
||
|
||
REQUIRES | ||
algorithm in {"RSA"} => preparedRSA[params]; | ||
algorithm in {"DSA"} => preparedDSA[params]; | ||
algorithm in {"RSA"} => preparedRSA[params]; algorithm in {"DSA"} => preparedDSA[params]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wrong inlining |
||
algorithm in {"DiffieHellman", "DH"} => preparedDH[params]; | ||
algorithm in {"EC"} => preparedEC[params]; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ ORDER | |
Con | ||
|
||
CONSTRAINTS | ||
keysize in {4096}; //BSI TR-02102-1 Recommends atleast 3000bits for keys | ||
keysize >= 3000; //BSI TR-02102-1 Recommends atleast 3000bits for keys | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keep explicit key sizes |
||
publicExponent in {65537}; | ||
|
||
ENSURES | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,8 @@ ORDER | |
|
||
CONSTRAINTS | ||
algorithm in {"DEFAULT", "NONCEANDIV"}; | ||
|
||
|
||
|
||
REQUIRES | ||
randomized[seed]; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,6 +39,8 @@ CONSTRAINTS | |
plainTextOffset >= 0; | ||
plainTextLen > 0; | ||
cipherTextOffset >= 0; | ||
|
||
padding in {ISO, Padding58,ESP}// BSI recoomedation for padding Scheme (ISO-Padding, Padding according to [58], ESP-Padding) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. padding is never defined |
||
|
||
REQUIRES | ||
generatedRijndaelEngine[cipher]; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,16 +25,19 @@ ORDER | |
Get, Init, Gen | ||
|
||
CONSTRAINTS | ||
algorithm in {"RSA", "EC", "DSA", "DiffieHellman", "DH"}; //BSI TR-02102-1 Recommends atleast 3000bits for keys | ||
algorithm in {"RSA"} => keysize in {4096, 3072}; | ||
algorithm in {"DSA"} => keysize in {3072}; | ||
algorithm in {"DiffieHellman", "DH"} => keysize in {3072}; | ||
algorithm in {"EC"} => keysize in {256}; | ||
algorithm in {"RSA", "EC", "DSA", "DiffieHellman", "DH"}; | ||
algorithm in {"RSA"} => keysize >=3000; | ||
algorithm in {"DSA"} => keysize >= 3072; | ||
algorithm in {"DiffieHellman", "DH"} => keysize >=3000; | ||
algorithm in {"EC"} => keysize >=250; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keep exlicit key sizes |
||
|
||
FORBIDDEN | ||
algorithm =="DSA" && afterYear>=2029; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
REQUIRES | ||
algorithm in {"RSA"} => preparedRSA[params]; | ||
algorithm in {"DSA"} => preparedDSA[params]; | ||
algorithm in {"DiffieHellman", "DH"} => preparedDH[params]; | ||
algorithm in {"DiffieHellman","DH"} => preparedDH[params]; | ||
algorithm in {"EC"} => preparedEC[params]; | ||
|
||
ENSURES | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ ORDER | |
Con | ||
|
||
CONSTRAINTS | ||
keysize in {3072, 4096}; //BSI TR-02102-1 Recommends atleast 3000bits for keys | ||
keysize >= 3000; //BSI TR-02102-1 Recommends atleast 3000bits for keys | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keep explicit key sizes |
||
publicExponent in {65537}; | ||
|
||
ENSURES | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't have a predefined predicate
bitlength
...