Compare commits
No commits in common. "main" and "Andreas" have entirely different histories.
|
|
@ -1,10 +0,0 @@
|
|||
<mxfile host="Electron" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/27.0.5 Chrome/134.0.6998.205 Electron/35.3.0 Safari/537.36" version="27.0.5">
|
||||
<diagram name="Seite-1" id="dzo3m-syK6zVxx0qf2iK">
|
||||
<mxGraphModel dx="1213" dy="828" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
|
||||
<root>
|
||||
<mxCell id="0" />
|
||||
<mxCell id="1" parent="0" />
|
||||
</root>
|
||||
</mxGraphModel>
|
||||
</diagram>
|
||||
</mxfile>
|
||||
241
AKD.drawio
241
AKD.drawio
|
|
@ -1,241 +0,0 @@
|
|||
<mxfile host="Electron" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/27.0.9 Chrome/134.0.6998.205 Electron/35.4.0 Safari/537.36" version="27.0.9">
|
||||
<diagram name="Seite-1" id="dzo3m-syK6zVxx0qf2iK">
|
||||
<mxGraphModel dx="1213" dy="828" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
|
||||
<root>
|
||||
<mxCell id="0" />
|
||||
<mxCell id="1" parent="0" />
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-51" value="" style="rounded=1;whiteSpace=wrap;html=1;fillColor=none;movable=0;resizable=0;rotatable=0;deletable=0;editable=0;locked=1;connectable=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="5" y="50" width="811" height="990" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="dn1SLEveHeubebGqacrZ-1" value="Eingabe eines Passworts<br>String passwort" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="320" y="130" width="120" height="60" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-49" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="dn1SLEveHeubebGqacrZ-2" target="dn1SLEveHeubebGqacrZ-1" edge="1">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="dn1SLEveHeubebGqacrZ-2" value="" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#000000;" parent="1" vertex="1">
|
||||
<mxGeometry x="365" y="70" width="30" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="dn1SLEveHeubebGqacrZ-5" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="dn1SLEveHeubebGqacrZ-3" target="dn1SLEveHeubebGqacrZ-4" edge="1">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="dn1SLEveHeubebGqacrZ-3" value="Überprüfung des Passworts auf Mindestlänge von 20" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="320" y="270" width="120" height="60" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="dn1SLEveHeubebGqacrZ-13" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="dn1SLEveHeubebGqacrZ-4" target="kEltRFM-RFmn2LgqPGvT-55" edge="1">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-39" value="Überprüfung<div>&nbsp;nicht bestanden</div>" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="dn1SLEveHeubebGqacrZ-13" vertex="1" connectable="0">
|
||||
<mxGeometry x="-0.1152" y="-2" relative="1" as="geometry">
|
||||
<mxPoint x="15" y="-13" as="offset" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-1" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="dn1SLEveHeubebGqacrZ-4" target="dn1SLEveHeubebGqacrZ-6" edge="1">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-40" value="Überprüfung<div>&nbsp;bestanden</div>" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="kEltRFM-RFmn2LgqPGvT-1" vertex="1" connectable="0">
|
||||
<mxGeometry x="-0.3756" relative="1" as="geometry">
|
||||
<mxPoint x="34" y="-2" as="offset" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="dn1SLEveHeubebGqacrZ-4" value="" style="rhombus;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="365" y="360" width="30" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-5" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="dn1SLEveHeubebGqacrZ-6" target="kEltRFM-RFmn2LgqPGvT-3" edge="1">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="dn1SLEveHeubebGqacrZ-6" value="Überprüfung auf mindestens 3 Kleinbuchstaben" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="320" y="430" width="120" height="60" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-11" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="dn1SLEveHeubebGqacrZ-7" target="kEltRFM-RFmn2LgqPGvT-4" edge="1">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="dn1SLEveHeubebGqacrZ-7" value="Überprüfung auf mindestens 3 Grossbuchstaben" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="320" y="570" width="120" height="60" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-16" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="dn1SLEveHeubebGqacrZ-8" target="dn1SLEveHeubebGqacrZ-14" edge="1">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="dn1SLEveHeubebGqacrZ-8" value="Überprüfung auf mindestens 3 Sonderzeichen" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="320" y="860" width="120" height="60" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-14" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="dn1SLEveHeubebGqacrZ-9" target="kEltRFM-RFmn2LgqPGvT-10" edge="1">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="dn1SLEveHeubebGqacrZ-9" value="Überprüfung auf mindestens 3 Ziffern" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="320" y="720" width="120" height="60" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-37" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="dn1SLEveHeubebGqacrZ-10" target="dn1SLEveHeubebGqacrZ-3" edge="1">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="dn1SLEveHeubebGqacrZ-10" value="" style="rhombus;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="365" y="215" width="30" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-38" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="dn1SLEveHeubebGqacrZ-11" target="dn1SLEveHeubebGqacrZ-10" edge="1">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="dn1SLEveHeubebGqacrZ-11" value="Eingabe eines verbesserten Passworts" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="10" y="200" width="120" height="60" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-35" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="dn1SLEveHeubebGqacrZ-12" target="dn1SLEveHeubebGqacrZ-11" edge="1">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="dn1SLEveHeubebGqacrZ-12" value="" style="rhombus;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="55" y="360" width="30" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-22" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="dn1SLEveHeubebGqacrZ-14" target="kEltRFM-RFmn2LgqPGvT-18" edge="1">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-48" value="Überprüfung<div>&nbsp;bestanden</div>" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="kEltRFM-RFmn2LgqPGvT-22" vertex="1" connectable="0">
|
||||
<mxGeometry x="-0.2675" y="-1" relative="1" as="geometry">
|
||||
<mxPoint x="6" y="-16" as="offset" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-30" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="dn1SLEveHeubebGqacrZ-14" target="kEltRFM-RFmn2LgqPGvT-59" edge="1">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-44" value="Überprüfung<div>&nbsp;nicht bestanden</div>" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="kEltRFM-RFmn2LgqPGvT-30" vertex="1" connectable="0">
|
||||
<mxGeometry x="0.2723" y="1" relative="1" as="geometry">
|
||||
<mxPoint x="28" y="-16" as="offset" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="dn1SLEveHeubebGqacrZ-14" value="" style="rhombus;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="365" y="940" width="30" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-17" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="kEltRFM-RFmn2LgqPGvT-3" target="dn1SLEveHeubebGqacrZ-7" edge="1">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-45" value="Überprüfung<div>&nbsp;bestanden</div>" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="kEltRFM-RFmn2LgqPGvT-17" vertex="1" connectable="0">
|
||||
<mxGeometry x="0.0291" y="-4" relative="1" as="geometry">
|
||||
<mxPoint x="36" y="-9" as="offset" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-27" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="kEltRFM-RFmn2LgqPGvT-3" target="kEltRFM-RFmn2LgqPGvT-56" edge="1">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-41" value="Überprüfung<div>&nbsp;nicht bestanden</div>" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="kEltRFM-RFmn2LgqPGvT-27" vertex="1" connectable="0">
|
||||
<mxGeometry x="0.3476" y="-1" relative="1" as="geometry">
|
||||
<mxPoint x="40" y="-14" as="offset" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-3" value="" style="rhombus;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="365" y="510" width="30" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-13" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="kEltRFM-RFmn2LgqPGvT-4" target="dn1SLEveHeubebGqacrZ-9" edge="1">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-46" value="Überprüfung<div>&nbsp;bestanden</div>" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="kEltRFM-RFmn2LgqPGvT-13" vertex="1" connectable="0">
|
||||
<mxGeometry x="-0.3594" y="-3" relative="1" as="geometry">
|
||||
<mxPoint x="37" y="1" as="offset" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-28" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="kEltRFM-RFmn2LgqPGvT-4" target="kEltRFM-RFmn2LgqPGvT-57" edge="1">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-42" value="Überprüfung<div>&nbsp;nicht bestanden</div>" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="kEltRFM-RFmn2LgqPGvT-28" vertex="1" connectable="0">
|
||||
<mxGeometry x="0.3108" y="-1" relative="1" as="geometry">
|
||||
<mxPoint x="37" y="-14" as="offset" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-4" value="" style="rhombus;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="365" y="655" width="30" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-15" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="kEltRFM-RFmn2LgqPGvT-10" target="dn1SLEveHeubebGqacrZ-8" edge="1">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-47" value="Überprüfung<div>&nbsp;bestanden</div>" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="kEltRFM-RFmn2LgqPGvT-15" vertex="1" connectable="0">
|
||||
<mxGeometry x="-0.2208" y="-3" relative="1" as="geometry">
|
||||
<mxPoint x="42" y="-9" as="offset" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-29" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="kEltRFM-RFmn2LgqPGvT-10" target="kEltRFM-RFmn2LgqPGvT-58" edge="1">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-43" value="Überprüfung<div>&nbsp;nicht bestanden</div>" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="kEltRFM-RFmn2LgqPGvT-29" vertex="1" connectable="0">
|
||||
<mxGeometry x="0.3548" y="-2" relative="1" as="geometry">
|
||||
<mxPoint x="37" y="-13" as="offset" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-10" value="" style="rhombus;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="365" y="800" width="30" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-67" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="kEltRFM-RFmn2LgqPGvT-18" target="kEltRFM-RFmn2LgqPGvT-20" edge="1">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-18" value="Ausgabe:<div>Passwort ist sicher</div>" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="510" y="925" width="120" height="60" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-34" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="kEltRFM-RFmn2LgqPGvT-23" target="dn1SLEveHeubebGqacrZ-12" edge="1">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-23" value="" style="rhombus;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="55" y="510" width="30" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-33" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="kEltRFM-RFmn2LgqPGvT-24" target="kEltRFM-RFmn2LgqPGvT-23" edge="1">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-24" value="" style="rhombus;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="55" y="655" width="30" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-32" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="kEltRFM-RFmn2LgqPGvT-25" target="kEltRFM-RFmn2LgqPGvT-24" edge="1">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-25" value="" style="rhombus;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="55" y="800" width="30" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-36" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="dn1SLEveHeubebGqacrZ-1" target="dn1SLEveHeubebGqacrZ-10" edge="1">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-52" value="Andreas Wurst 1720808<br><div>Denis Shala 3022668</div>" style="text;html=1;align=right;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
|
||||
<mxGeometry x="650" y="10" width="150" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-54" value="<h1 style="margin-top: 0px;">Passwort_Check</h1><p>Das Programm überprüfft ein eingegebenes Passwort auf folgenden Bedingungen, die die komplexität herhöhen soll. Diese Bedingungen lauten:<br>1) mindestens 20 Zeichen<br>2) mindestens 3 Kleinbuchstaben<br>3) mindestens 3 Großbuchstaben<br>4) mindestens 3 Ziffern<br>5) mindestens 3 druckbare Sonderzeichen</p><p>Bei nicht einhalten mindenstens einer Bedingungen wird sofort ein neues passwort erbeten. Bei einem sicheren Passwort wird das Programm beendet.</p>" style="text;html=1;whiteSpace=wrap;overflow=hidden;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="520" y="80" width="270" height="250" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-62" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="kEltRFM-RFmn2LgqPGvT-55" target="dn1SLEveHeubebGqacrZ-12" edge="1">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-55" value="Ausgabe:<div>"Zu wenig Zeichen"</div>" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="110" y="345" width="120" height="60" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-61" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="kEltRFM-RFmn2LgqPGvT-56" target="kEltRFM-RFmn2LgqPGvT-23" edge="1">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-56" value="Ausgabe:<div>"Zu wenig Kleinbuchstaben"</div>" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="120" y="495" width="120" height="60" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-63" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="kEltRFM-RFmn2LgqPGvT-57" target="kEltRFM-RFmn2LgqPGvT-24" edge="1">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-57" value="Ausgabe:<div>"Zu wenig Großbuchstaben"</div>" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="120" y="640" width="120" height="60" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-64" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="kEltRFM-RFmn2LgqPGvT-58" target="kEltRFM-RFmn2LgqPGvT-25" edge="1">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-58" value="Ausgabe:<div>"Zu wenig Ziffern"</div>" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="110" y="785" width="120" height="60" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-65" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="kEltRFM-RFmn2LgqPGvT-59" target="kEltRFM-RFmn2LgqPGvT-25" edge="1">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="85" y="955.0000000000002" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-59" value="Ausgabe:<div>"Zu wenig Sonderzeichen"</div>" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="130" y="925" width="120" height="60" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-66" value="" style="group" parent="1" vertex="1" connectable="0">
|
||||
<mxGeometry x="670" y="935" width="40" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-20" value="" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;" parent="kEltRFM-RFmn2LgqPGvT-66" vertex="1">
|
||||
<mxGeometry width="40" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kEltRFM-RFmn2LgqPGvT-19" value="" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#000000;container=1;" parent="kEltRFM-RFmn2LgqPGvT-66" vertex="1">
|
||||
<mxGeometry x="5" y="5" width="30" height="30" as="geometry">
|
||||
<mxRectangle x="735" y="960" width="50" height="40" as="alternateBounds" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
</root>
|
||||
</mxGraphModel>
|
||||
</diagram>
|
||||
</mxfile>
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,114 +1,39 @@
|
|||
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
* Dieses Programm prüft anhand von fünf Bedingungen, ob ein Passwort sicher
|
||||
* ist:
|
||||
* - Mindestens 20 Zeichen lang
|
||||
* - Enthält mindestens drei Kleinbuchstaben
|
||||
* - Enthält mindestens drei Großbuchstaben
|
||||
* - Enthält mindestens drei Ziffern
|
||||
* - Enthält mindestens drei Sonderzeichen
|
||||
*/
|
||||
|
||||
public class Passwort_Check {
|
||||
/**
|
||||
* Prüft, ob das Passwort mindestens 20 Zeichen lang ist.
|
||||
*
|
||||
* @param password Das zu prüfende Kennwort.
|
||||
* @return True, wenn das Kennwort mindestens 20 Zeichen lang ist, sonst false.
|
||||
*/
|
||||
public static boolean checkLaenge(String passwort) {
|
||||
if (passwort == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean checkLaenge(String passwort) {
|
||||
return passwort.length() >= 20;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prüft, ob das Passwort mindestens drei Kleinbuchstaben enthält.
|
||||
*
|
||||
* @param password Das zu prüfende Kennwort.
|
||||
* @return True, wenn das Kennwort mindestens drei Kleinbuchstaben enthält,
|
||||
* sonst false.
|
||||
*/
|
||||
public static boolean checkKleinBuchstaben(String passwort) {
|
||||
if (passwort == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return passwort.matches(".*[a-z].*[a-z].*[a-z].*");
|
||||
}
|
||||
|
||||
/**
|
||||
* Prüft, ob das Passwort mindestens drei Großbuchstaben enthält.
|
||||
*
|
||||
* @param password Das zu prüfende Kennwort.
|
||||
* @return True, wenn das Kennwort mindestens drei Großbuchstaben enthält, sonst
|
||||
* false.
|
||||
*/
|
||||
public static boolean checkGrossBuchstaben(String passwort) {
|
||||
if (passwort == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return passwort.matches(".*[A-Z].*[A-Z].*[A-Z].*");
|
||||
}
|
||||
|
||||
/**
|
||||
* Prüft, ob das Passwort mindestens drei Ziffern enthält.
|
||||
*
|
||||
* @param password Das zu prüfende Kennwort.
|
||||
* @return True, wenn das Kennwort mindestens dreistellig ist, sonst false.
|
||||
*/
|
||||
public static boolean checkZiffer(String passwort) {
|
||||
if (passwort == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return passwort.matches(".*[0-9].*[0-9].*[0-9].*");
|
||||
}
|
||||
|
||||
/**
|
||||
* Prüft, ob das Passwort mindestens drei Sonderzeichen enthält.
|
||||
*
|
||||
* @param password Das zu prüfende Kennwort.
|
||||
* @return True, wenn das Kennwort mindestens drei Sonderzeichen enthält, sonst
|
||||
* false.
|
||||
*/
|
||||
public static boolean checkSonderZeichen(String passwort) {
|
||||
if (passwort == null) {
|
||||
return false;
|
||||
}
|
||||
// \\x20-\\x2F -> SP, !, ", #, $, %, &, ', (, ), *, +, ,, -, ., /
|
||||
// \\x3A-\\x40 -> :, ;, <, =, >, ?, @
|
||||
// \\x5B-\\x60 -> [, \, ], ^, -, `
|
||||
// \\x7B-\\x7E -> {, |, }, ~
|
||||
// \\x80 -> €
|
||||
String reg = "[\\x20-\\x2F\\x3A-\\x40\\x5B-\\x60\\x7B-\\x7E\\x80]";
|
||||
return passwort.matches(".*" + reg + ".*" + reg + ".*" + reg + ".*");
|
||||
|
||||
// String negReg = "[^A-Za-z0-9\\x00-\\x1F\\x7F]";
|
||||
// return passwort.matches(".*"+negReg+".*"+negReg+".*"+negReg+".*");
|
||||
// return
|
||||
return passwort.matches(".*[!\\?\\$%&#@*+\\-=_.].*[!\\?\\$%&#@*+\\-=_.].*[!\\?\\$%&#@*+\\-=_.].*");
|
||||
}
|
||||
|
||||
/**
|
||||
* Hauptmethode, die den Benutzer zur Eingabe eines Passworts auffordert und
|
||||
* dessen Sicherheit anhand der definierten Bedingungen überprüft.
|
||||
*
|
||||
* @param args Kommandozeilenargumente (werden in diesem Programm nicht
|
||||
* verwendet).
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
// Variablen werden initialisiert
|
||||
String passwort = null;
|
||||
boolean check = false; // Ein boolean das anzeigt, ob ein Passwort sicher ist
|
||||
|
||||
boolean check = false;
|
||||
Scanner in = new Scanner(System.in);
|
||||
System.out.println("Geben Sie ein Passwort zur überprüfung ein:");
|
||||
|
||||
passwort = in.nextLine();
|
||||
// Schleife beinhaltet die Überprüfung des Passworts auf die einzelnen Bedingungen
|
||||
// s wie die wiederholung des Vorgangs bei nicht sicherem Passwort.
|
||||
do {
|
||||
|
||||
if (!checkLaenge(passwort)) {
|
||||
|
|
@ -132,8 +57,6 @@ public class Passwort_Check {
|
|||
}
|
||||
} while (check == false);
|
||||
|
||||
// ende des Programms
|
||||
|
||||
System.out.println("...und Tschüss");
|
||||
in.close();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,459 +0,0 @@
|
|||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class Test_Passwords_Oliver_S {
|
||||
|
||||
Random random = new Random();
|
||||
|
||||
//Mindestanforderungen an das Passwort
|
||||
final static int MIN_LENGTH = 20;
|
||||
final static int MIN_KLEINBUCHSTABEN = 3;
|
||||
final static int MIN_GROSSBUCHSTABEN = 3;
|
||||
final static int MIN_ZIFFERN = 3;
|
||||
final static int MIN_SONDERZEICHEN = 3;
|
||||
|
||||
|
||||
final static int TEST_RUNS = 1000000; //Wie häufig die Tests wiederholt werden sollen
|
||||
final static int MAX_GEN_PASSWORD_LENGTH = 100; //Wie lang das roh generierte Passwort sein sollte (ohne enthaltene Testcases).
|
||||
final static int MAX_EXTRA_CHARACTERS = 10; //Wie viele Extra Zeichen in das Passwort für den Testcase (More than min) eingefügt werden sollen.
|
||||
|
||||
|
||||
//Spezifiziert die Bereiche in denen verschiedene Arten von Zeichen liegen.
|
||||
final static int START_CHAR_ALL = 32;
|
||||
final static int STOP_CHAR_ALL = 126;
|
||||
|
||||
final static int START_CHAR_ZIFFERN = 48;
|
||||
final static int STOP_CHAR_ZIFFERN = 57;
|
||||
|
||||
final static int START_CHAR_KEINB = 97;
|
||||
final static int STOP_CHAR_KLEINB = 122;
|
||||
|
||||
final static int START_CHAR_GROSSB = 65;
|
||||
final static int STOP_CHAR_GROSSB = 90;
|
||||
|
||||
final static int START_CHAR_SONDERZ_1 = 32;
|
||||
final static int STOP_CHAR_SONDERZ_1 = 47;
|
||||
|
||||
final static int START_CHAR_SONDERZ_2 = 58;
|
||||
final static int STOP_CHAR_SONDERZ_2 = 64;
|
||||
|
||||
final static int START_CHAR_SONDERZ_3 = 91;
|
||||
final static int STOP_CHAR_SONDERZ_3 = 96;
|
||||
|
||||
final static int START_CHAR_SONDERZ_4 = 123;
|
||||
final static int STOP_CHAR_SONDERZ_4 = 126;
|
||||
|
||||
@FunctionalInterface
|
||||
interface Check_X_Interface{
|
||||
boolean X_Method(String password);
|
||||
}
|
||||
|
||||
//Generiert einen zufälligen String mit der Länge "length", mit den Zeichen zwischen "start_char" und "stop_char" und exkluidert ggf. den Bereich von "start_exclude" bis "stop_exclude"
|
||||
String generateRandomString(int length,int start_char, int stop_char, int start_exclude, int stop_exclude){
|
||||
|
||||
StringBuilder text = new StringBuilder(length);
|
||||
int i = 0;
|
||||
|
||||
while(i < length){
|
||||
int random_int_in_range = random.nextInt(start_char,stop_char+1);
|
||||
|
||||
if(start_exclude <= random_int_in_range && random_int_in_range <= stop_exclude){
|
||||
i--;
|
||||
}
|
||||
else{
|
||||
text.append((char)random_int_in_range);
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
return text.toString();
|
||||
}
|
||||
|
||||
//Spezielle Mehtode, die einen String ohne Sonderzeichen erzeugt.
|
||||
String generateRandomStringWithOutSonderZeichen(int length){
|
||||
|
||||
StringBuilder text = new StringBuilder(length);
|
||||
int i = 0;
|
||||
|
||||
while(i < length){
|
||||
int random_int_in_range = random.nextInt(START_CHAR_ALL,STOP_CHAR_ALL+1);
|
||||
|
||||
if((START_CHAR_SONDERZ_1 <= random_int_in_range && random_int_in_range <= STOP_CHAR_SONDERZ_1)||
|
||||
(START_CHAR_SONDERZ_2 <= random_int_in_range && random_int_in_range <= STOP_CHAR_SONDERZ_2)||
|
||||
(START_CHAR_SONDERZ_3 <= random_int_in_range && random_int_in_range <= STOP_CHAR_SONDERZ_3)||
|
||||
(START_CHAR_SONDERZ_4 <= random_int_in_range && random_int_in_range <= STOP_CHAR_SONDERZ_4)){
|
||||
|
||||
i--;
|
||||
}
|
||||
else{
|
||||
text.append((char)random_int_in_range);
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
return text.toString();
|
||||
}
|
||||
|
||||
char getRandomSonderzeichen(){
|
||||
int random_sonderzeichen_region = random.nextInt(0,4); //Because we have 4 Sonderzeichen Areas in ASCII...
|
||||
int start_region;
|
||||
int end_region;
|
||||
|
||||
if(random_sonderzeichen_region == 0){
|
||||
|
||||
start_region = START_CHAR_SONDERZ_1;
|
||||
end_region = STOP_CHAR_SONDERZ_1;
|
||||
|
||||
} else if(random_sonderzeichen_region == 1){
|
||||
|
||||
start_region = START_CHAR_SONDERZ_2;
|
||||
end_region = STOP_CHAR_SONDERZ_2;
|
||||
|
||||
}else if(random_sonderzeichen_region == 2){
|
||||
|
||||
start_region = START_CHAR_SONDERZ_3;
|
||||
end_region = STOP_CHAR_SONDERZ_3;
|
||||
|
||||
}else{
|
||||
start_region = START_CHAR_SONDERZ_4;
|
||||
end_region = STOP_CHAR_SONDERZ_4;
|
||||
}
|
||||
|
||||
int random_int_in_range = random.nextInt(start_region,end_region+1);
|
||||
|
||||
return (char)random_int_in_range;
|
||||
}
|
||||
|
||||
//Das Herzstück der Tests:
|
||||
//Es werden für jede zu testende Methode jeweils 3 Fälle abgefragt:
|
||||
//1. Anforderung an die Methode wird nicht erfüllt, z.B zu wenige Ziffern -> Methode sollte immer falsch liefern.
|
||||
//2. Anforderungen werden erfüllt, z.B genau 3 Ziffern -> Methode sollte immer wahr liefern.
|
||||
//3. Anforderung werden über erfüllt z.B mehr als 3 Ziffern -> Methode sollte immer wahr liefern.
|
||||
|
||||
//Die Test Methoden sind sehr ähnlich aufgebaut und unterscheiden sich nur in der inneren for Schleife und dem assert am Ende.
|
||||
//Alle Zufälle finden in einem vordefinierten Breich statt um die Tests besser kontrollieren zu können.
|
||||
void test_checkX_with_less_than_Min_X(int start_char, int stop_char, int start_exclude_char, int stop_exclude_char, int min_X, Check_X_Interface password_check_interface){
|
||||
|
||||
for(int i=0; i<TEST_RUNS;i++){
|
||||
int random_password_length = random.nextInt(1,MAX_GEN_PASSWORD_LENGTH);
|
||||
int random_less_X_character = random.nextInt(1,min_X);
|
||||
|
||||
//Die Test Mehtode generiert einen zufälligen String, mit zufälliger Länge. Dieser enthält KEINE zu testenden Zeichen. -> Wird die Mehtode "checkZiffer" getestet enthält der String bis hier keine Ziffern!
|
||||
StringBuilder test_password_build = new StringBuilder(generateRandomString(random_password_length,start_char,stop_char,start_exclude_char,stop_exclude_char));
|
||||
//System.out.println(test_password_build.toString());
|
||||
|
||||
//Ab hier wir es interessant. Je nach dem welcher Test läuft, wird eine zufälliges zu testendes Zeichen (z.B Ziffer) in den String, in einer zufälligen Position eingefügt.
|
||||
//Die Anzahl der Testzeichen liegt wie hier immer immer unter der Mindestanforderung für die zu testende Methode. -> Hier sollte immer false heraus kommen.
|
||||
for(int j=0; j<min_X-random_less_X_character;j++){
|
||||
int test_password_length = test_password_build.length();
|
||||
int insert_index = random.nextInt(test_password_length);
|
||||
char random_X = (char)random.nextInt(start_exclude_char,stop_exclude_char+1);
|
||||
test_password_build.insert(insert_index,random_X);
|
||||
}
|
||||
//System.out.println("\n");
|
||||
|
||||
//Hier wird die Mehtode nun getestet, und es wird IMMER ein false erwartet!
|
||||
String test_password = test_password_build.toString();
|
||||
boolean test_result = password_check_interface.X_Method(test_password);
|
||||
assertFalse(test_result, "Test failed with Password: " + test_password);
|
||||
} //Dies wiederholt sich "TEST_RUNS" mal bis alle Tests erfolgreich sind, oder die zu testende Methode einen falschen Wert liefert. -> Der Test ist dann fehlgeschlagen.
|
||||
}
|
||||
|
||||
void test_checkX_with_exact_Min_X(int start_char, int stop_char, int start_exclude_char, int stop_exclude_char, int min_X, Check_X_Interface password_check_interface){
|
||||
|
||||
for(int i=0; i<TEST_RUNS;i++){
|
||||
int random_password_length = random.nextInt(1,MAX_GEN_PASSWORD_LENGTH);
|
||||
|
||||
StringBuilder test_password_build = new StringBuilder(generateRandomString(random_password_length,start_char,stop_char,start_exclude_char,stop_exclude_char));
|
||||
//System.out.println(test_password_build.toString());
|
||||
|
||||
//Hier das gleiche wie oben beschrieben nur diesmal wird die Mindestanforderung erfüllt.
|
||||
for(int j=0; j<min_X;j++){
|
||||
int test_password_length = test_password_build.length();
|
||||
int insert_index = random.nextInt(test_password_length);
|
||||
char random_X = (char)random.nextInt(start_exclude_char,stop_exclude_char+1);
|
||||
|
||||
test_password_build.insert(insert_index,random_X);
|
||||
}
|
||||
|
||||
//Hier sollte IMMER wahr herauskommen.
|
||||
String test_password = test_password_build.toString();
|
||||
boolean test_result = password_check_interface.X_Method(test_password);
|
||||
assertTrue(test_result, "Test failed with Password: " + test_password);
|
||||
}
|
||||
}
|
||||
|
||||
void test_checkX_with_more_than_Min_X(int start_char, int stop_char, int start_exclude_char, int stop_exclude_char, int min_X, Check_X_Interface password_check_interface){
|
||||
|
||||
for(int i=0; i<TEST_RUNS;i++){
|
||||
int random_password_length = random.nextInt(1,MAX_GEN_PASSWORD_LENGTH);
|
||||
|
||||
StringBuilder test_password_build = new StringBuilder(generateRandomString(random_password_length,start_char,stop_char,start_exclude_char,stop_exclude_char));
|
||||
//System.out.println(test_password_build.toString());
|
||||
|
||||
int extra_X = random.nextInt(MAX_EXTRA_CHARACTERS);
|
||||
|
||||
//Das gleiche wie oben, nur hier wird die Mindestanforderung über erfüllt.
|
||||
for(int j=0; j<min_X+extra_X;j++){
|
||||
int test_password_length = test_password_build.length();
|
||||
int insert_index = random.nextInt(test_password_length);
|
||||
char random_X = (char)random.nextInt(start_exclude_char,stop_exclude_char+1);
|
||||
|
||||
test_password_build.insert(insert_index,random_X);
|
||||
}
|
||||
//Es sollte dann entsprechend auch IMMER wahr herauskommen!
|
||||
String test_password = test_password_build.toString();
|
||||
boolean test_result = password_check_interface.X_Method(test_password);
|
||||
assertTrue(test_result, "Test failed with Password: " + test_password);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Tests für Methode "checkLaenge":
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@Test
|
||||
void test_checkLaenge_with_null_Password(){
|
||||
String test_password = null;
|
||||
boolean test_result = Passwort_Check.checkLaenge(test_password);
|
||||
assertFalse(test_result);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
void test_checkLaenge_with_empty_Password(){
|
||||
String test_password = "";
|
||||
boolean test_result = Passwort_Check.checkLaenge(test_password);
|
||||
assertFalse(test_result);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
void test_checkLaenge_with_less_than_Min_Length(){
|
||||
|
||||
for(int i=0; i<TEST_RUNS;i++){
|
||||
int random_password_length = random.nextInt(0,MIN_LENGTH);
|
||||
String test_password = generateRandomString(random_password_length, START_CHAR_ALL, STOP_CHAR_ALL,0,-1); //From char 32 to char 126, Exclude: nothing!
|
||||
boolean test_result = Passwort_Check.checkLaenge(test_password);
|
||||
assertFalse(test_result, "Test failed with Password: " + test_password);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void test_checkLaenge_with_exact_Min_Length(){
|
||||
|
||||
for(int i=0; i<TEST_RUNS;i++){
|
||||
int random_password_length = MIN_LENGTH;
|
||||
String test_password = generateRandomString(random_password_length, START_CHAR_ALL, STOP_CHAR_ALL,0,-1); //From char 32 to char 126, Exclude: nothing!
|
||||
boolean test_result = Passwort_Check.checkLaenge(test_password);
|
||||
assertTrue(test_result, "Test failed with Password: " + test_password);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void test_checkLaenge_with_more_than_Min_Length(){
|
||||
|
||||
for(int i=0; i<TEST_RUNS;i++){
|
||||
int random_password_length = random.nextInt(MIN_LENGTH,MAX_GEN_PASSWORD_LENGTH);
|
||||
String test_password = generateRandomString(random_password_length, START_CHAR_ALL, STOP_CHAR_ALL,0,-1); //From char 32 to char 126, Exclude: nothing!
|
||||
boolean test_result = Passwort_Check.checkLaenge(test_password);
|
||||
assertTrue(test_result, "Test failed with Password: " + test_password);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
//Tests für Methode "checkKleinBuchstaben":
|
||||
@Test
|
||||
void test_checkKleinBuchstaben_with_null_Password(){
|
||||
String test_password = null;
|
||||
boolean test_result = Passwort_Check.checkKleinBuchstaben(test_password);
|
||||
assertFalse(test_result);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
void test_checkKleinBuchstaben_with_empty_Password(){
|
||||
String test_password = "";
|
||||
boolean test_result = Passwort_Check.checkKleinBuchstaben(test_password);
|
||||
assertFalse(test_result);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
void test_checkKleinBuchstaben_with_less_than_Min_Klein_Buchstaben(){
|
||||
test_checkX_with_less_than_Min_X(START_CHAR_ALL,STOP_CHAR_ALL,START_CHAR_KEINB,STOP_CHAR_KLEINB,MIN_KLEINBUCHSTABEN,Passwort_Check::checkKleinBuchstaben);
|
||||
}
|
||||
|
||||
@Test
|
||||
void test_checkKleinBuchstaben_with_exact_Min_Klein_Buchstaben(){
|
||||
test_checkX_with_exact_Min_X(START_CHAR_ALL,STOP_CHAR_ALL,START_CHAR_KEINB,STOP_CHAR_KLEINB,MIN_KLEINBUCHSTABEN,Passwort_Check::checkKleinBuchstaben);
|
||||
}
|
||||
|
||||
@Test
|
||||
void test_checkKleinBuchstaben_with_more_than_Min_Klein_Buchstaben(){
|
||||
test_checkX_with_more_than_Min_X(START_CHAR_ALL,STOP_CHAR_ALL,START_CHAR_KEINB,STOP_CHAR_KLEINB,MIN_KLEINBUCHSTABEN,Passwort_Check::checkKleinBuchstaben);
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
//Tests für Methode "checkGrossBuchstaben":
|
||||
@Test
|
||||
void test_checkGrossBuchstaben_with_null_Password(){
|
||||
String test_password = null;
|
||||
boolean test_result = Passwort_Check.checkGrossBuchstaben(test_password);
|
||||
assertFalse(test_result);
|
||||
}
|
||||
|
||||
@Test
|
||||
void test_checkGrossBuchstaben_with_empty_Password(){
|
||||
String test_password = "";
|
||||
boolean test_result = Passwort_Check.checkGrossBuchstaben(test_password);
|
||||
assertFalse(test_result);
|
||||
}
|
||||
|
||||
@Test
|
||||
void test_checkGrossBuchstaben_with_less_than_Min_Gross_Buchstaben(){
|
||||
test_checkX_with_less_than_Min_X(START_CHAR_ALL,STOP_CHAR_ALL,START_CHAR_GROSSB,STOP_CHAR_GROSSB,MIN_GROSSBUCHSTABEN,Passwort_Check::checkGrossBuchstaben);
|
||||
}
|
||||
|
||||
@Test
|
||||
void test_checkGrossBuchstaben_with_exact_Min_Gross_Buchstaben(){
|
||||
test_checkX_with_exact_Min_X(START_CHAR_ALL,STOP_CHAR_ALL,START_CHAR_GROSSB,STOP_CHAR_GROSSB,MIN_GROSSBUCHSTABEN,Passwort_Check::checkGrossBuchstaben);
|
||||
}
|
||||
|
||||
@Test
|
||||
void test_checkGrossBuchstaben_with_more_than_Min_Gross_Buchstaben(){
|
||||
test_checkX_with_more_than_Min_X(START_CHAR_ALL,STOP_CHAR_ALL,START_CHAR_GROSSB,STOP_CHAR_GROSSB,MIN_GROSSBUCHSTABEN,Passwort_Check::checkGrossBuchstaben);
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
//Tests für Methode "checkZiffer":
|
||||
@Test
|
||||
void test_checkZiffer_with_null_Password(){
|
||||
String test_password = null;
|
||||
boolean test_result = Passwort_Check.checkZiffer(test_password);
|
||||
assertFalse(test_result);
|
||||
}
|
||||
|
||||
@Test
|
||||
void test_checkZiffer_with_empty_Password(){
|
||||
String test_password = "";
|
||||
boolean test_result = Passwort_Check.checkZiffer(test_password);
|
||||
assertFalse(test_result);
|
||||
}
|
||||
|
||||
@Test
|
||||
void test_checkZiffern_with_less_than_Min_Ziffern(){
|
||||
test_checkX_with_less_than_Min_X(START_CHAR_ALL,STOP_CHAR_ALL,START_CHAR_ZIFFERN,STOP_CHAR_ZIFFERN,MIN_ZIFFERN,Passwort_Check::checkZiffer);
|
||||
}
|
||||
|
||||
@Test
|
||||
void test_checkZiffern_with_exact_Min_Ziffern(){
|
||||
test_checkX_with_exact_Min_X(START_CHAR_ALL,STOP_CHAR_ALL,START_CHAR_ZIFFERN,STOP_CHAR_ZIFFERN,MIN_ZIFFERN,Passwort_Check::checkZiffer);
|
||||
}
|
||||
|
||||
@Test
|
||||
void test_checkZiffern_with_more_than_Min_Ziffern(){
|
||||
test_checkX_with_more_than_Min_X(START_CHAR_ALL,STOP_CHAR_ALL,START_CHAR_ZIFFERN,STOP_CHAR_ZIFFERN,MIN_ZIFFERN,Passwort_Check::checkZiffer);
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
//Tests für Methode "checkSonderZeichen":
|
||||
@Test
|
||||
void test_checkSonderZeichen_with_null_Password(){
|
||||
String test_password = null;
|
||||
boolean test_result = Passwort_Check.checkSonderZeichen(test_password);
|
||||
assertFalse(test_result);
|
||||
}
|
||||
|
||||
@Test
|
||||
void test_checkSonderZeichen_with_empty_Password(){
|
||||
String test_password = "";
|
||||
boolean test_result = Passwort_Check.checkSonderZeichen(test_password);
|
||||
assertFalse(test_result);
|
||||
}
|
||||
|
||||
|
||||
//Da die Sonderzeichen ein etwas anderes Verhalten haben, werden die Testmehtoden von oben leicht abgewandelt.
|
||||
@Test
|
||||
void test_checkSonderZeichen_with_less_than_Min_Sonder_Zeichen(){
|
||||
|
||||
for(int i=0; i<TEST_RUNS;i++){
|
||||
int random_password_length = random.nextInt(1,MAX_GEN_PASSWORD_LENGTH);
|
||||
int random_less_Sonder_Zeichen_character = random.nextInt(1,MIN_SONDERZEICHEN);
|
||||
|
||||
StringBuilder test_password_build = new StringBuilder(generateRandomStringWithOutSonderZeichen(random_password_length));
|
||||
//System.out.println(test_password_build.toString());
|
||||
|
||||
for(int j=0; j<MIN_SONDERZEICHEN-random_less_Sonder_Zeichen_character;j++){
|
||||
int test_password_length = test_password_build.length();
|
||||
int insert_index = random.nextInt(test_password_length);
|
||||
|
||||
char random_X = getRandomSonderzeichen();
|
||||
test_password_build.insert(insert_index,random_X);
|
||||
}
|
||||
//System.out.println("\n");
|
||||
|
||||
String test_password = test_password_build.toString();
|
||||
boolean test_result = Passwort_Check.checkSonderZeichen(test_password);
|
||||
assertFalse(test_result, "Test failed with Password: " + test_password);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void test_checkSonderZeichen_with_exact_Min_Sonder_Zeichen(){
|
||||
|
||||
for(int i=0; i<TEST_RUNS;i++){
|
||||
int random_password_length = random.nextInt(1,MAX_GEN_PASSWORD_LENGTH);
|
||||
|
||||
StringBuilder test_password_build = new StringBuilder(generateRandomStringWithOutSonderZeichen(random_password_length));
|
||||
//System.out.println(test_password_build.toString());
|
||||
|
||||
for(int j=0; j<MIN_SONDERZEICHEN;j++){
|
||||
int test_password_length = test_password_build.length();
|
||||
int insert_index = random.nextInt(test_password_length);
|
||||
|
||||
char random_X = getRandomSonderzeichen();
|
||||
test_password_build.insert(insert_index,random_X);
|
||||
}
|
||||
//System.out.println("\n");
|
||||
|
||||
String test_password = test_password_build.toString();
|
||||
boolean test_result = Passwort_Check.checkSonderZeichen(test_password);
|
||||
assertTrue(test_result, "Test failed with Password: " + test_password);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void test_checkSonderZeichen_with_more_than_Min_Sonder_Zeichen(){
|
||||
|
||||
for(int i=0; i<TEST_RUNS;i++){
|
||||
int random_password_length = random.nextInt(1,MAX_GEN_PASSWORD_LENGTH);
|
||||
|
||||
StringBuilder test_password_build = new StringBuilder(generateRandomStringWithOutSonderZeichen(random_password_length));
|
||||
//System.out.println(test_password_build.toString());
|
||||
|
||||
int extra_X = random.nextInt(MAX_EXTRA_CHARACTERS);
|
||||
|
||||
for(int j=0; j<MIN_SONDERZEICHEN+extra_X;j++){
|
||||
int test_password_length = test_password_build.length();
|
||||
int insert_index = random.nextInt(test_password_length);
|
||||
|
||||
char random_X = getRandomSonderzeichen();
|
||||
test_password_build.insert(insert_index,random_X);
|
||||
}
|
||||
//System.out.println("\n");
|
||||
|
||||
String test_password = test_password_build.toString();
|
||||
boolean test_result = Passwort_Check.checkSonderZeichen(test_password);
|
||||
assertTrue(test_result, "Test failed with Password: " + test_password);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,86 +1,104 @@
|
|||
|
||||
import org.junit.jupiter.api.Test;
|
||||
// import static org.junit.Assert.assertNull;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
public class Test_Passwort_Check {
|
||||
import java.io.*;
|
||||
|
||||
@Test
|
||||
public void testCheckLaenge() {
|
||||
// Länge ist zu kurz
|
||||
assertFalse(Passwort_Check.checkLaenge("KurzesPasswort123!"));
|
||||
public class Test_Passwort_Check {
|
||||
@Test
|
||||
public void testPasswortZuKurz() {
|
||||
assertFalse(Passwort_Check.checkLaenge("Hello Wolrd"));
|
||||
assertFalse(Passwort_Check.checkLaenge("qwertzuiopasdfghjkl"));
|
||||
assertFalse(Passwort_Check.checkLaenge("1234567890qwertzuio"));
|
||||
// richtige Länge
|
||||
assertTrue(Passwort_Check.checkLaenge("LangesPasswortMit123!@#"));
|
||||
|
||||
}
|
||||
@Test
|
||||
public void testPasswortKleinBuchstaben() {
|
||||
assertFalse(Passwort_Check.checkKleinBuchstaben("HELLO!WorLD!ICHLIEBEJAVA"));
|
||||
assertFalse(Passwort_Check.checkKleinBuchstaben("QWERTZUoPlYXCVBNMLKJHGFDS"));
|
||||
assertFalse(Passwort_Check.checkKleinBuchstaben("1234567890QWERTZUIOP"));
|
||||
|
||||
}
|
||||
@Test
|
||||
public void testPasswortGrossBuchstaben(){
|
||||
assertFalse(Passwort_Check.checkKleinBuchstaben("HelloWorldichliebejava"));
|
||||
}
|
||||
}
|
||||
public class Passwort_CheckTest {
|
||||
|
||||
@Test
|
||||
public void testCheckLaenge() {
|
||||
assertFalse(Passwort_Check.checkLaenge("KurzesPasswort123!")); // < 20
|
||||
assertTrue(Passwort_Check.checkLaenge("LangesPasswortMit123!@#")); // >= 20
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCheckKleinBuchstaben() {
|
||||
// zu wenig Kleinbuchstaben
|
||||
assertFalse(Passwort_Check.checkKleinBuchstaben("ABCDEF123!@#")); // keine Kleinbuchstaben
|
||||
assertFalse(Passwort_Check.checkKleinBuchstaben("aB123")); // nur 1 Kleinbuchstaben
|
||||
assertFalse(Passwort_Check.checkKleinBuchstaben("HELLO!WorLD!ICHLIEBEJAVA")); // nur 2 Kleinbuchstaben
|
||||
|
||||
// genügend Kleinbuchstaben
|
||||
assertTrue(Passwort_Check.checkKleinBuchstaben("abc DEF 123!@#"));
|
||||
|
||||
assertFalse(Passwort_Check.checkKleinBuchstaben("aB123")); // nur 1 Kleinbuchstabe
|
||||
assertTrue(Passwort_Check.checkKleinBuchstaben("abcDEF123!@#")); // 3 Kleinbuchstaben
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCheckGrossBuchstaben() {
|
||||
// zu wenig Großbuchstaben
|
||||
assertFalse(Passwort_Check.checkGrossBuchstaben("abcdef123!@#")); // keine Grossbuchstaben
|
||||
assertFalse(Passwort_Check.checkGrossBuchstaben("aB123")); // nur 1 Grossbuchstaben
|
||||
assertFalse(Passwort_Check.checkGrossBuchstaben("aAB123")); // nur 2 Grossbuchstaben
|
||||
// mind. 3 Großbuchstaben
|
||||
assertTrue(Passwort_Check.checkGrossBuchstaben("ABCdef123!@#"));
|
||||
assertTrue(Passwort_Check.checkKleinBuchstaben("HelloWorldichliebejava"));
|
||||
assertFalse(Passwort_Check.checkGrossBuchstaben("abcdef123!@#")); // keine Großbuchstaben
|
||||
assertFalse(Passwort_Check.checkGrossBuchstaben("aB123")); // nur 1 Großbuchstabe
|
||||
assertTrue(Passwort_Check.checkGrossBuchstaben("ABCdef123!@#")); // 3 Großbuchstaben
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCheckZiffer() {
|
||||
// zu wenig Ziffern
|
||||
assertFalse(Passwort_Check.checkZiffer("abcdefABC!@#")); // keine Ziffern
|
||||
assertFalse(Passwort_Check.checkZiffer("aB1")); // nur 1 Ziffer
|
||||
assertFalse(Passwort_Check.checkZiffer("a2 B1")); // nur 2 Ziffer
|
||||
// mid. 3 Ziffern
|
||||
assertTrue(Passwort_Check.checkZiffer("abcABC123!@#")); // 3 Ziffern
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCheckSonderZeichen() {
|
||||
// zu wenig Sonderzeichen
|
||||
assertFalse(Passwort_Check.checkSonderZeichen("abcABC123")); // keine Sonderzeichen
|
||||
assertFalse(Passwort_Check.checkSonderZeichen("abcABC123!")); // nur 1 Sonderzeichen
|
||||
assertFalse(Passwort_Check.checkSonderZeichen("abcABC123!@")); // nur 2 Sonderzeichen
|
||||
// mind. 3 Sonderzeichen
|
||||
assertTrue(Passwort_Check.checkSonderZeichen("abcABC123!@#")); // 3 Sonderzeichen
|
||||
// Überprüfung der speziellen Sonderzeichen
|
||||
assertTrue(Passwort_Check.checkSonderZeichen("a b c d")); // Leerzeichen als Sonderzeichen
|
||||
|
||||
// Prüfe einzeln alle ASCII-Sonderzeichen (33–47, 58–64, 91–96, 123–126)
|
||||
String asciiSonderzeichen = "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~";
|
||||
for (int i = 0; i < asciiSonderzeichen.length(); i++) {
|
||||
String c = "" + asciiSonderzeichen.charAt(i);
|
||||
assertFalse(Passwort_Check.checkSonderZeichen("abcABC123" + c + c)); // nur 2 Sonderzeichen
|
||||
assertTrue(Passwort_Check.checkSonderZeichen("abcABC123" + c + c + c)); // 3 identische Sonderzeichen
|
||||
}
|
||||
|
||||
String steuerzeichen = "";
|
||||
for (int i = 0; i <= 31; i++) {
|
||||
steuerzeichen += (char) i;
|
||||
}
|
||||
steuerzeichen += (char) 127;
|
||||
for (int i = 0; i < steuerzeichen.length(); i++) {
|
||||
String c = "" + steuerzeichen.charAt(i);
|
||||
System.out.println(c);
|
||||
assertFalse(Passwort_Check.checkSonderZeichen("abcABC123" + c + c)); // nur 2 Sonderzeichen
|
||||
assertFalse(Passwort_Check.checkSonderZeichen("abcABC123" + c + c + c)); // 3 identische Sonderzeichen
|
||||
}
|
||||
assertFalse(Passwort_Check.checkSonderZeichen("\t\t\t")); // Tab als Sonderzeichen
|
||||
assertFalse(Passwort_Check.checkSonderZeichen("\r\r\r")); // Carriage Return als Sonderzeichen
|
||||
assertFalse(Passwort_Check.checkSonderZeichen("\n\n\n")); // Line Feed als Sonderzeichen
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class Passwort_CheckIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void testMainMitUnsicheremUndSicheremPasswort() {
|
||||
// Simulierte Benutzereingaben (1. Versuch unsicher, 2. Versuch sicher)
|
||||
String simulatedInput = String.join("\n",
|
||||
"kurz123", // zu kurz
|
||||
"PasswortMit2BUCHSTABEN", // kein Sonderzeichen, keine Ziffern
|
||||
"AbcAbcAbc123!@#", // zu kurz
|
||||
"abcABC123!@#abcABC123!@#", // gültiges Passwort
|
||||
""
|
||||
);
|
||||
|
||||
// Eingabe simulieren
|
||||
ByteArrayInputStream in = new ByteArrayInputStream(simulatedInput.getBytes());
|
||||
System.setIn(in);
|
||||
|
||||
// Ausgabe abfangen
|
||||
ByteArrayOutputStream outContent = new ByteArrayOutputStream();
|
||||
PrintStream originalOut = System.out;
|
||||
System.setOut(new PrintStream(outContent));
|
||||
|
||||
// Main-Methode ausführen
|
||||
Passwort_Check.main(new String[]{});
|
||||
|
||||
// Wiederherstellen der Originalstreams
|
||||
System.setOut(originalOut);
|
||||
System.setIn(System.in);
|
||||
|
||||
String output = outContent.toString();
|
||||
|
||||
// Wichtige Ausgaben überprüfen
|
||||
assertTrue(output.contains("Passwort ist zu kurz!"));
|
||||
assertTrue(output.contains("Es fehlen Ziffern!") || output.contains("Es fehlen Sonderzeichen!"));
|
||||
assertTrue(output.contains("Passwort ist sicher."));
|
||||
assertTrue(output.contains("...und Tschüss"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,45 +0,0 @@
|
|||
import org.junit.jupiter.api.Test;
|
||||
// import static org.junit.Assert.assertNull;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
public class Test_Passwort_Check_Konsole {
|
||||
|
||||
@Test
|
||||
public void testMain() {
|
||||
// Simulierte Benutzereingaben (1. Versuch unsicher, 2. Versuch sicher)
|
||||
String simulatedInput = String.join("\n",
|
||||
"kurz123", // zu kurz
|
||||
"PasswortMit2BUCHSTABEN", // kein Sonderzeichen, keine Ziffern
|
||||
"AbcAbcAbc123!@#", // zu kurz
|
||||
"abcABC123!@#abcABC123!@#", // gültiges Passwort
|
||||
""
|
||||
);
|
||||
|
||||
// Eingabe simulieren
|
||||
ByteArrayInputStream in = new ByteArrayInputStream(simulatedInput.getBytes());
|
||||
System.setIn(in);
|
||||
|
||||
// Ausgabe abfangen
|
||||
ByteArrayOutputStream outContent = new ByteArrayOutputStream();
|
||||
PrintStream originalOut = System.out;
|
||||
System.setOut(new PrintStream(outContent));
|
||||
|
||||
// Main-Methode ausführen
|
||||
Passwort_Check.main(new String[]{});
|
||||
|
||||
// Wiederherstellen der Originalstreams
|
||||
System.setOut(originalOut);
|
||||
System.setIn(System.in);
|
||||
|
||||
String output = outContent.toString();
|
||||
|
||||
// Wichtige Ausgaben überprüfen
|
||||
assertTrue(output.contains("Passwort ist zu kurz!"));
|
||||
assertTrue(output.contains("Es fehlen Ziffern!") || output.contains("Es fehlen Sonderzeichen!"));
|
||||
assertTrue(output.contains("Passwort ist sicher."));
|
||||
assertTrue(output.contains("...und Tschüss"));
|
||||
}
|
||||
}
|
||||
|
||||
128
message.java
128
message.java
|
|
@ -1,128 +0,0 @@
|
|||
// package uebung4;
|
||||
|
||||
/*Programm, dass ein eingegebenes Passwort auf seine Sicherheit überprüft.
|
||||
Es soll mindestens 20 Zeichen und mindestens 3 Klein-, Großbuchstaben, Ziffern und Sonderzeichen beinhalten.*/
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
public class message {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
boolean istPasswortSicher = false;//Passwort wird initial auf false gesetzt
|
||||
String passwort;// String-Variable zum Speichern des Passworts
|
||||
System.out.println("Willkommen beim Passwort-Checker!");
|
||||
|
||||
//Überprüfung und Ausgabe des Problems oder der Sicherheit des Passworts
|
||||
do {
|
||||
System.out.print("Bitte geben Sie ein Passwort ein: ");
|
||||
passwort = scanner.nextLine();/* speichert die Benutzereingabe in der Variable passwort*/
|
||||
|
||||
if (!checkLaenge(passwort)) {
|
||||
System.out.println("Fehler: Das Passwort ist zu kurz. Es muss mindestens 20 Zeichen lang sein.");
|
||||
}
|
||||
|
||||
else if (!checkKleinBuchstaben(passwort)) {
|
||||
System.out.println("Fehler: Das Passwort muss mindestens 3 Kleinbuchstaben enthalten.");
|
||||
}
|
||||
|
||||
|
||||
else if (!checkGrossBuchstaben(passwort)) {
|
||||
System.out.println("Fehler: Das Passwort muss mindestens 3 Großbuchstaben enthalten.");
|
||||
}
|
||||
|
||||
|
||||
else if (!checkZiffer(passwort)) {
|
||||
System.out.println("Fehler: Das Passwort muss mindestens 3 Ziffern enthalten.");
|
||||
}
|
||||
|
||||
|
||||
else if (!checkSonderZeichen(passwort)) {
|
||||
System.out.println("Fehler: Das Passwort muss mindestens 3 Sonderzeichen enthalten.");
|
||||
}
|
||||
|
||||
|
||||
else {
|
||||
istPasswortSicher = true;
|
||||
System.out.println("Passwort ist sicher.");
|
||||
}
|
||||
}while (!istPasswortSicher);//wiederhole die Eingabe bis Passwort sicher ist
|
||||
|
||||
|
||||
scanner.close();
|
||||
System.out.println("Programm beendet.");
|
||||
//wenn das Passwort sicher ist, wird das Programm beendet
|
||||
}
|
||||
|
||||
/*Rückgabewert ist true, wenn das Passwort mindestens 20 Zeichen enthält, ansonsten wird false zurückgegeben*/
|
||||
public static boolean checkLaenge(String passwort) {
|
||||
return passwort != null && passwort.length() >= 20;
|
||||
}
|
||||
|
||||
/*Rückgabewert ist true, wenn das Passwort mindestens 3 Kleinbuchstaben enthält, ansonsten wird false zurückgegeben*/
|
||||
public static boolean checkKleinBuchstaben(String passwort) {
|
||||
//Anzahl der Kleinbuchstaben wird gezählt
|
||||
int count = 0;
|
||||
if (passwort==null) {
|
||||
return false;
|
||||
}
|
||||
for (char c : passwort.toCharArray()) {
|
||||
if (Character.isLowerCase(c)) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return count >= 3;
|
||||
//wenn Anzahl der Kleinbuchstaben größer gleich 3 ist, wird true zurückgegeben
|
||||
}
|
||||
|
||||
/*Rückgabewert ist true, wenn das Passwort mindestens 3 Großbuchstaben enthält, ansonsten wird false zurückgegeben*/
|
||||
public static boolean checkGrossBuchstaben(String passwort) {
|
||||
//Anzahl der Großbuchstaben wird gezählt
|
||||
int count = 0;
|
||||
if (passwort==null) {
|
||||
return false;
|
||||
}
|
||||
for (char c : passwort.toCharArray()) {
|
||||
if (Character.isUpperCase(c)) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return count >= 3;
|
||||
//wenn Anzahl der Großbuchstaben größer gleich 3 ist, wird true zurückgegeben
|
||||
}
|
||||
|
||||
/*Rückgabewert ist true, wenn das Passwort mindestens 3 Ziffern enthält, ansonsten wird false zurückgegeben*/
|
||||
public static boolean checkZiffer(String passwort) {
|
||||
//Anzahl der Zahlen wird gezählt
|
||||
int count = 0;
|
||||
if (passwort==null) {
|
||||
return false;
|
||||
}
|
||||
for (char c : passwort.toCharArray()) {
|
||||
if (Character.isDigit(c)) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return count >= 3;
|
||||
//wenn Anzahl der Zahlen größer gleich 3 ist, wird true zurückgegeben
|
||||
}
|
||||
|
||||
/*Rückgabewert ist true, wenn das Passwort mindestens 3 Sonderzeichen enthält, ansonsten wird false zurückgegeben*/
|
||||
public static boolean checkSonderZeichen(String passwort) {
|
||||
int count = 0;
|
||||
if (passwort==null) {
|
||||
return false;
|
||||
}
|
||||
for (char c : passwort.toCharArray()) {
|
||||
int ascii = (int) c;
|
||||
if ((ascii >= 32 && ascii <= 47) || (ascii >= 58 && ascii <= 64) ||
|
||||
(ascii >= 91 && ascii <= 96) || (ascii >= 123 && ascii <= 126) ||
|
||||
ascii == 128 || ascii == 130 || ascii == 132 || ascii == 136) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return count >= 3;
|
||||
//wenn Anzahl der Sonderzeichen größer gleich 3 ist, wird true zurückgegeben
|
||||
}
|
||||
|
||||
}
|
||||
BIN
uebung4.pdf
BIN
uebung4.pdf
Binary file not shown.
Loading…
Reference in New Issue