Exemplo n.º 1
0
            internal override void Evaluate()
            {
                byte[] nonce = tv.nonce();
                byte[] personalisationString = tv.personalizationString();

                ISP80090Drbg d = new HashSP800Drbg(tv.getDigest(), tv.securityStrength(), tv.entropySource(), personalisationString, nonce);

                byte[] output = new byte[tv.expectedValue(0).Length];

                d.Generate(output, tv.additionalInput(0), tv.predictionResistance());

                byte[] expected = tv.expectedValue(0);

                if (!Arrays.AreEqual(expected, output))
                {
                    Fail("Self test " + algorithm.Name + ".1 failed, expected " + Strings.FromByteArray(Hex.Encode(tv.expectedValue(0))) + " got " + Strings.FromByteArray(Hex.Encode(output)));
                }

                output = new byte[tv.expectedValue(0).Length];

                d.Generate(output, tv.additionalInput(1), tv.predictionResistance());

                expected = tv.expectedValue(1);
                if (!Arrays.AreEqual(expected, output))
                {
                    Fail("Self test " + algorithm.Name + ".2 failed, expected " + Strings.FromByteArray(Hex.Encode(tv.expectedValue(1))) + " got " + Strings.FromByteArray(Hex.Encode(output)));
                }
            }
Exemplo n.º 2
0
 internal ReseedSelfTest(Algorithm algorithm, HashSP800Drbg parent) : base(algorithm)
 {
     this.parent = parent;
 }
Exemplo n.º 3
0
            public IDrbg Get(IEntropySource entropySource)
            {
                HashSP800Drbg drbg = new HashSP800Drbg(digest, securityStrength, entropySource, personalizationString, nonce);

                return(new ContinuousTestingPseudoRng(drbg, primaryAdditionalInput));
            }