Package codec.asn1

Examples of codec.asn1.ASN1Opaque


  subjectPublicKeyInfo_ = new SubjectPublicKeyInfo();
  certificationRequestInfo_.add(subjectPublicKeyInfo_);

  attributes_ = new ASN1SetOf(Attribute.class);
  certificationRequestInfo_.add(new ASN1TaggedType(0, attributes_, false,
    false));

  add(certificationRequestInfo_);

  signatureAlgorithmIdentifier_ = new AlgorithmIdentifier();
View Full Code Here


    public CertBag() {
  super(2);
  certId_ = new ASN1ObjectIdentifier();
  add(certId_);
  ASN1OpenType ot = new ASN1OpenType(reg_, certId_);
  certValue_ = new ASN1TaggedType(0, ot, true);
  add(certValue_);
    }
View Full Code Here

      throws java.security.cert.CertificateEncodingException {
  super(2);
  certId_ = new ASN1ObjectIdentifier("1.2.840.113549.1.9.22.1");
  add(certId_);
  x509Cert_ = new ASN1OctetString(cert.getEncoded());
  certValue_ = new ASN1TaggedType(0, x509Cert_, true);
  add(certValue_);
    }
View Full Code Here

  if (!(values_ instanceof ASN1SetOf)) {
      return;
  }
  ArrayList list;
  ASN1Type o;
  Iterator i;

  try {
      list = new ArrayList(values_.size());
View Full Code Here

     *
     * @return The raw key decoded according to DER.
     */
    public ASN1Type getDecodedRawKey() throws CorruptedCodeException {
  DERDecoder dec;
  ASN1Type raw;

  try {
      dec = new DERDecoder(new ByteArrayInputStream(encodedKey_
        .getByteArray()));

View Full Code Here

     *                The {@link Decoder Decoder} to use.
     */
    public void decode(Decoder decoder) throws ASN1Exception, IOException {
  super.decode(decoder);

  ASN1Type t;
  ASN1OpenType o;

  t = certValue_.getInnerType();
  if (t instanceof ASN1OpenType) {
      o = (ASN1OpenType) t;
View Full Code Here

        .println("This bag is either password or public-key protected.");
      return null;
  }
  bais = new ByteArrayInputStream(encodedData);
  SafeContents safe = new SafeContents();
  BERDecoder decoder = new BERDecoder(bais);
  safe.decode(decoder);
  bais.close();
  return safe;
    }
View Full Code Here

  SecretKey pbeKey = skf.generateSecret(pbeSpec);
  encData.init(pbeKey);
  data = encData.getData();
  bais = new ByteArrayInputStream(data);
  SafeContents safe = new SafeContents();
  BERDecoder decoder = new BERDecoder(bais);
  safe.decode(decoder);
  bais.close();
  return safe;
    }
View Full Code Here

  envData.init(cert, key);
  byte[] data = envData.getData();

  bais = new ByteArrayInputStream(data);
  SafeContents safe = new SafeContents();
  BERDecoder decoder = new BERDecoder(bais);
  safe.decode(decoder);
  bais.close();
  return safe;
    }
View Full Code Here

  AlgorithmIdentifier aid;
  PBEParameterSpec pspec;
  SecretKeyFactory skf;
  PrivateKeyInfo pki;
  KeyFactory kf;
  DERDecoder dec;
  SecretKey secret;
  KeySpec kspec;
  Cipher cipher;
  String name;
  byte[] buf;

  try {
      name = algorithm_.getAlgorithmOID().toString();
      params = algorithm_.getParameters();
      pspec = (PBEParameterSpec) params
        .getParameterSpec(PBEParameterSpec.class);

      skf = SecretKeyFactory.getInstance(name);
      kspec = new PBEKeySpec(password);
      secret = skf.generateSecret(kspec);

      cipher = Cipher.getInstance(name);
      cipher.init(Cipher.DECRYPT_MODE, secret, pspec);

      buf = cipher.doFinal(encryptedData_.getByteArray());
      kspec = new PKCS8EncodedKeySpec(buf);

      pki = new PrivateKeyInfo();
      dec = new DERDecoder(new ByteArrayInputStream(buf));
      pki.decode(dec);
      dec.close();

      aid = pki.getAlgorithmIdentifier();
      name = aid.getAlgorithmOID().toString();
      kf = KeyFactory.getInstance(name);
View Full Code Here

TOP

Related Classes of codec.asn1.ASN1Opaque

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.