Пример #1
0
 public virtual void ReadAttributes(Session session)
 {
     if (session == null)
     {
         throw new NullReferenceException("Argument \"session\" must not be null.");
     }
     class_ = ReadAttribute(session, hObj, new ObjectClassAttribute());
 }
Пример #2
0
        public static P11Object GetInstance(Session session, uint hObj)
        {
            if (session == null)
            {
                throw new Exception("Argument \"session\" must not be null.");
            }

            ObjectClassAttribute classAtr = (ObjectClassAttribute)
                                            AssignAttributeFromObj(session, hObj, new ObjectClassAttribute());

            switch (classAtr.ObjectType)
            {
            case CKO.CERTIFICATE:
                return(Certificate.GetInstance(session, hObj));

            case CKO.DATA:
                return(Data.GetInstance(session, hObj));

            case CKO.DOMAIN_PARAMETERS:
                return(DomainParameters.GetInstance(session, hObj));

            case CKO.HW_FEATURE:
                break;

            case CKO.MECHANISM:
                break;

            case CKO.PRIVATE_KEY:
                return(PrivateKey.GetInstance(session, hObj));

            case CKO.PUBLIC_KEY:
                return(PublicKey.GetInstance(session, hObj));

            case CKO.SECRET_KEY:
                return(SecretKey.GetInstance(session, hObj));

            case CKO.VENDOR_DEFINED:
                break;

            default:
                break;
            }

            return(null);
        }
Пример #3
0
 public static ObjectClassAttribute ReadAttribute(Session session, uint hObj, ObjectClassAttribute attr)
 {
     return((ObjectClassAttribute)GetAttribute(session, hObj, attr));
 }