Package org.bouncycastle.crypto.digests

Examples of org.bouncycastle.crypto.digests.SHA1Digest


        byte[]              data;

        //
        // ISO 9796-2 - PSS Signing
        //
        Digest              dig = new SHA1Digest();
        ISO9796d2PSSSigner  eng = new ISO9796d2PSSSigner(rsa, dig, dig.getDigestSize());

        //
        // as the padding is random this test needs to repeat a few times to
        // make sure
        //
View Full Code Here


     *
     **/
    public AuthorityKeyIdentifier(
        SubjectPublicKeyInfo    spki)
    {
        Digest  digest = new SHA1Digest();
        byte[]  resBuf = new byte[digest.getDigestSize()];

        byte[] bytes = spki.getPublicKeyData().getBytes();
        digest.update(bytes, 0, bytes.length);
        digest.doFinal(resBuf, 0);
        this.keyidentifier = new DEROctetString(resBuf);
    }
View Full Code Here

    public AuthorityKeyIdentifier(
        SubjectPublicKeyInfo    spki,
        GeneralNames            name,
        BigInteger              serialNumber)
    {
        Digest  digest = new SHA1Digest();
        byte[]  resBuf = new byte[digest.getDigestSize()];

        byte[] bytes = spki.getPublicKeyData().getBytes();
        digest.update(bytes, 0, bytes.length);
        digest.doFinal(resBuf, 0);

        this.keyidentifier = new DEROctetString(resBuf);
        this.certissuer = GeneralNames.getInstance(name.toASN1Object());
        this.certserno = new DERInteger(serialNumber);
    }
View Full Code Here

        RSAKeyParameters    prv,
        byte[]              slt,
        byte[]              msg,
        byte[]              sig)
    {
        PSSSigner           eng = new PSSSigner(new RSAEngine(), new SHA1Digest(), 20);

        eng.init(true, new ParametersWithRandom(prv, new FixedRandom(slt)));

        try
        {
View Full Code Here

        }
       
        //
        // loop test
        //
        PSSSigner           eng = new PSSSigner(new RSAEngine(), new SHA1Digest(), 20);
        int failed = 0;
        byte[] data = new byte[DATA_LENGTH];

        SecureRandom    random = new SecureRandom();
        random.nextBytes(data);
View Full Code Here

public class SignatureRSA implements com.jcraft.jsch.SignatureRSA{
  private SHA1Digest digest;
  private RSAEngine cipher;

  public void init() throws Exception{
    digest=new SHA1Digest();
    cipher=new RSAEngine();
  }    
View Full Code Here

public class SHA1 implements HASH{
  private SHA1Digest md;

  public int getBlockSize(){return 20;}
  public void init() throws Exception{
    try{ md=new SHA1Digest(); }
    catch(Exception e){
      System.out.println(e);
    }
  }
View Full Code Here

      byte[] tmp=new byte[20];
      System.arraycopy(key, 0, tmp, 0, 20);   
      key=tmp;
    }
    CipherParameters param=new KeyParameter(key);
    mac=new HMac(new SHA1Digest());
    mac.init(param);
  }
View Full Code Here

      byte[] tmp=new byte[bsize];
      System.arraycopy(key, 0, tmp, 0, bsize);   
      key=tmp;
    }
    CipherParameters param=new KeyParameter(key);
    mac=new HMac(new SHA1Digest());
    mac.init(param);
  }
View Full Code Here

        System.arraycopy(label, 0, ls, 0, label.length);
        System.arraycopy(seed, 0, ls, label.length, seed.length);

        byte[] prf = new byte[buf.length];
        hmac_hash(new MD5Digest(), s1, ls, prf);
        hmac_hash(new SHA1Digest(), s2, ls, buf);
        for (int i = 0; i < buf.length; i++)
        {
            buf[i] ^= prf[i];
        }
    }
View Full Code Here

TOP

Related Classes of org.bouncycastle.crypto.digests.SHA1Digest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.