Package rdpclient.ntlmssp.asn1

Examples of rdpclient.ntlmssp.asn1.AlgorithmIdentifier


     * structure.
     */
    public EncryptedPrivateKeyInfo() {
  super(2);

  algorithm_ = new AlgorithmIdentifier();
  add(algorithm_);
  encryptedData_ = new ASN1OctetString();
  add(encryptedData_);
    }
View Full Code Here


  params = AlgorithmParameters.getInstance(algorithm);
  params.init(pspec);

  clear();

  algorithm_ = new AlgorithmIdentifier(algorithm, params);
  add(algorithm_);
  encryptedData_ = new ASN1OctetString(code);
  add(encryptedData_);
    }
View Full Code Here

     *                 if the key could not be decrypted or decoded.
     */
    public PrivateKey getPrivateKey(char[] password)
      throws GeneralSecurityException {
  AlgorithmParameters params;
  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);

      return kf.generatePrivate(kspec);
  } catch (ASN1Exception e) {
      throw new UnrecoverableKeyException(e.getMessage());
View Full Code Here

     */
    public PrivateKeyInfo() {
  version_ = new ASN1Integer(VERSION);
  add(version_);

  algorithm_ = new AlgorithmIdentifier();
  add(algorithm_);

  encodedKey_ = new ASN1OctetString();
  add(encodedKey_);

View Full Code Here

  clear();

  version_ = new ASN1Integer(VERSION);
  add(version_);

  algorithm_ = new AlgorithmIdentifier();
  add(algorithm_);

  encodedKey_ = new ASN1OctetString();
  add(encodedKey_);
View Full Code Here

  certificationRequestInfo_.add(new ASN1TaggedType(0, attributes_, false,
    false));

  add(certificationRequestInfo_);

  signatureAlgorithmIdentifier_ = new AlgorithmIdentifier();
  add(signatureAlgorithmIdentifier_);

  signature_ = new ASN1BitString();
  add(signature_);
    }
View Full Code Here

      throws SignatureException, CertificateEncodingException,
      NoSuchAlgorithmException, InvalidAlgorithmParameterException {

  // extract signature parameters
  try {
      AlgorithmIdentifier keyAlgID = AlgorithmIdentifier
        .createAlgorithmIdentifier(signerPub);
      AlgorithmParameters params = keyAlgID.getParameters();
      AlgorithmIdentifier sigAlgID = new AlgorithmIdentifier(sig
        .getAlgorithm(), params);

      sig.update(getTBS());
      setSignature(sig.sign(), sigAlgID);
  } catch (CorruptedCodeException cce) {
View Full Code Here

     *                The <code>SignerInfo</code> to add.
     * @throws NullPointerException
     *                 if the <code>info</code> is <code>null</code>.
     */
    public void addSignerInfo(SignerInfo info) {
  AlgorithmIdentifier idn;
  AlgorithmIdentifier idv;
  Iterator i;

  if (info == null) {
      throw new NullPointerException("Need a SignerInfo!");
  }
View Full Code Here

     */
    public EncryptedContentInfo() {
  super(3);

  contentType_ = new ASN1ObjectIdentifier();
  cAlg_ = new AlgorithmIdentifier();
  econtent_ = new ASN1TaggedType(0, new ASN1OctetString(), false, true);

  add(contentType_);
  add(cAlg_);
  add(econtent_);
View Full Code Here

      throws InvalidAlgorithmParameterException {
  if (bea == null || bek == null) {
      throw new NullPointerException("BEK or BEA is null!");
  }
  contentType_ = new ASN1ObjectIdentifier(DATA_OID);
  cAlg_ = new AlgorithmIdentifier(bea, params);
  econtent_ = new ASN1TaggedType(0, new ASN1OctetString(), false, true);

  add(contentType_);
  add(cAlg_);
  add(econtent_);
View Full Code Here

TOP

Related Classes of rdpclient.ntlmssp.asn1.AlgorithmIdentifier

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.