AWS Cannot download a root CA for IoT

Reader Query: 

When I’m trying to create a new certificate – I can see the page with 4 downloading links (keys and certificates).
Unfortunately, I can download all, except for root CA, because when I’m pushing the last – it throws me to AWS Documentation.

Solution:

The AWS documentation that the link is redirecting you to contains the Root CA certificates. The Root CA certificates are available under the “Server Authentication” section:
https://docs.aws.amazon.com/iot/latest/developerguide/managing-device-certs.html#server-authentication

Based on the signing key, the following certificates are available from the documentation page:

-> RSA 2048 bit key: VeriSign Class 3 Public Primary G5 root CA certificate (https://www.symantec.com/content/en/us/enterprise/verisign/roots/VeriSign-Class%203-Public-Primary-Certification-Authority-G5.pem)
-> RSA 2048 bit key: Amazon Root CA 1 (https://www.amazontrust.com/repository/AmazonRootCA1.pem)
-> RSA 4096 bit key: Amazon Root CA 2 (https://www.amazontrust.com/repository/AmazonRootCA2.pem)
-> ECC 256 bit key: Amazon Root CA 3 (https://www.amazontrust.com/repository/AmazonRootCA3.pem)
-> ECC 384 bit key: Amazon Root CA 4 (https://www.amazontrust.com/repository/AmazonRootCA4.pem)

If you are creating a new thing using the web console and downloading the credentials (device certificate, device public and private key, etc) then “Amazon Root CA 1” can be used as the root CA certificate.
While creating a new thing from the console,  please do not forget to click on the “Activate” button prior to proceeding to the “Attach a Policy” section.

Advertisements

Python setattr()

The setattr() method sets the value of given attribute of an object.

The syntax of setattr() method is:

setattr(object, name, value)

If you want to get an attribute of an object, use getattr().


setattr() Parameters

The setattr() method takes three parameters:

  • object – object whose attribute has to be set
  • name – string which contains the name of the attribute to be set
  • value – value of the attribute to be set

Return value from setattr()

The setattr() method returns None.


Example 1: How setattr() works in Python?

class Person:
   name = 'Adam'

p = Person()
print('Before modification:', p.name)

# setting name to 'John'
setattr(p, 'name', 'John')

print('After modification:', p.name)

When you run the program, the output will be:

Before modification: Adam
After modification: John

Example 2: setattr() when named attribute is not found and setting attribute to None

However, this is only possible if the object implements __dict__() method.

You can check if it does by using dir() method.

class Person:
     name = 'Adam'

p = Person()


# setting attribute name to None
setattr(p, 'name', None)
print('Name is:', p.name)


# setting an attribute not present
# in Person
setattr(p, 'age', 23)
print('Age is:', p.age)

When you run the program, the output will be:

Name is: None
Age is: 23