Esempio n. 1
0
        public static new P11Object GetInstance(Session session, uint hObj)
        {
            KeyTypeAttribute keyType = ReadAttribute(session, hObj, new KeyTypeAttribute());

            switch (keyType.KeyType)
            {
            case CKK.RSA:
                return(RSAPublicKey.GetInstance(session, hObj));

            case CKK.GOST:
                return(GostPublicKey.GetInstance(session, hObj));

            default:
                return(null);
            }
        }
Esempio n. 2
0
        public override void ReadAttributes(Session session)
        {
            base.ReadAttributes(session);

            keyType = ReadAttribute(session, HObj, new KeyTypeAttribute());

            id = ReadAttribute(session, HObj, new ByteArrayAttribute(CKA.ID));

            startDate = ReadAttribute(session, HObj, new DateAttribute((uint)CKA.START_DATE));

            endDate = ReadAttribute(session, HObj, new DateAttribute((uint)CKA.END_DATE));

            derive = ReadAttribute(session, HObj, new BooleanAttribute(CKA.DERIVE));

            local = ReadAttribute(session, HObj, new BooleanAttribute(CKA.LOCAL));

            keyGenMechanism = ReadAttribute(session, HObj, new MechanismTypeAttribute(CKA.KEY_GEN_MECHANISM));
        }
Esempio n. 3
0
        public static new P11Object GetInstance(Session session, uint hObj)
        {
            KeyTypeAttribute keyType = ReadAttribute(session, hObj, new KeyTypeAttribute());

            switch (keyType.KeyType)
            {
            case CKK.DES:
                return(DesSecretKey.GetInstance(session, hObj));

            case CKK.DES2:
                return(Des2SecretKey.GetInstance(session, hObj));

            case CKK.DES3:
                return(Des3SecretKey.GetInstance(session, hObj));

            default:
                return(new SecretKey(session, hObj));    // Return at least some info about the secret key.
            }
        }
Esempio n. 4
0
 public static KeyTypeAttribute ReadAttribute(Session session, uint hObj, KeyTypeAttribute attr)
 {
     return((KeyTypeAttribute)GetAttribute(session, hObj, attr));
 }