Package org.bouncycastle.asn1

Examples of org.bouncycastle.asn1.DERBitString


            log.debug("POP algorithm identifier is: "+algId.getObjectId().getId());
          }
          final Signature sig = Signature.getInstance(algId.getObjectId().getId(), "BC");
          sig.initVerify(getRequestPublicKey());
          sig.update(protBytes);
          final DERBitString bs = sk.getSignature();
          ret = sig.verify(bs.getBytes());         
        }
      } catch (IOException e) {
        log.error("Error encoding CertReqMsg: ", e);
      } catch (SignatureException e) {
        log.error("SignatureException verifying POP: ", e);
View Full Code Here


      }
    Signature sig = Signature.getInstance(sigAlg , provider );
    sig.initSign(key);
    sig.update( pKIMessage.getProtectedBytes() );
   
    pKIMessage.setProtection( new DERBitString(sig.sign()) );
    pKIMessage.addExtraCert( cert );
  }
View Full Code Here

    SecretKey key = new SecretKeySpec(basekey, macOid);
    mac.init(key);
    mac.reset();
    mac.update(protectedBytes, 0, protectedBytes.length);
    byte[] out = mac.doFinal();
    DERBitString bs = new DERBitString(out);

    // Finally store the protection bytes in the msg
    ret.setProtection(bs);
   
      if (LOG.isTraceEnabled()) {
View Full Code Here

        for (int i=0; i<shorterByteArray.length; i++) {
          shorterByteArray[i] = byteArray[i+1];
        }
        byteArray = shorterByteArray;
      }
      retval = new DERBitString(byteArray, padBits);
    }catch(NumberFormatException e){
      throw new CertificateExtentionConfigurationException(intres.getLocalizedMessage("certext.basic.illegalvalue",value,Integer.valueOf(getId())));
    }
   
    return retval;
View Full Code Here

          X509Name issuer = ct.getIssuer();
          // Get the revocation reason.
          // For CMPv1 this can be a simple DERBitString or it can be a requested CRL Entry Extension
          // If there exists CRL Entry Extensions we will use that, because it's the only thing allowed in CMPv2
          int reason = RevokedCertInfo.REVOCATION_REASON_UNSPECIFIED;
          DERBitString reasonbits = rd.getRevocationReason();
          if (reasonbits != null) {
            reason = CertTools.bitStringToRevokedCertInfo(reasonbits);           
            LOG.debug("CMPv1 revocation reason: "+reason);
          } else {
            LOG.debug("CMPv1 revocation reason is null");
View Full Code Here

                        if (ext != null) {
                          ASN1OctetString os = ext.getValue();
                          ByteArrayInputStream bIs = new ByteArrayInputStream(os.getOctets());
                          ASN1InputStream dIs = new ASN1InputStream(bIs);
                          DERObject dob = dIs.readObject();
                          DERBitString bs = DERBitString.getInstance(dob);
                          keyusage = bs.intValue();                                                           
                          if (log.isDebugEnabled()) {
                            log.debug("We have a key usage request extension: "+keyusage);
                          }
                        }
                      }
View Full Code Here

    public OriginatorPublicKey(
        AlgorithmIdentifier algorithm,
        byte[]              publicKey)
    {
        this.algorithm = algorithm;
        this.publicKey = new DERBitString(publicKey);
    }
View Full Code Here

    }

    private void addKeyUsage(X509Extension ext) {
        if (ext == null) return;

        DERBitString bits = (DERBitString)getExtentionObject(ext);
        byte data = bits.getBytes()[0];
        data = clearBits(data, KeyUsage.nonRepudiation);
        data = clearBits(data, KeyUsage.keyCertSign);
        byte [] newData = new byte[1];
        newData[0] = data;
        bits = new DERBitString(newData, bits.getPadBits());

        generator.addExtension(X509Extensions.KeyUsage, ext.isCritical(), bits);
    }
View Full Code Here

        ASN1EncodableVector  v = new ASN1EncodableVector();

        v.add(acInfo);
        v.add(sigAlgId);
        v.add(new DERBitString(sig.sign()));

        try
        {
            return new X509V2AttributeCertificate(new AttributeCertificate(new DERSequence(v)));
        }
View Full Code Here

        v.add(new X9FieldElement(curve.getA()).getDERObject());
        v.add(new X9FieldElement(curve.getB()).getDERObject());

        if (seed != null)
        {
            v.add(new DERBitString(seed));
        }

        return new DERSequence(v);
    }
View Full Code Here

TOP

Related Classes of org.bouncycastle.asn1.DERBitString

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.